26 |
done |
done |
27 |
} |
} |
28 |
|
|
29 |
# prepare_custom_baseconfig $_OSROOT $_OSHOSTNAME $_OSHOSTDOMAIN |
# prepare_custom_baseconfig $_OSROOT $_HOSTNAME $_HOSTDOMAIN |
30 |
prepare_custom_baseconfig() |
prepare_custom_baseconfig() |
31 |
{ |
{ |
32 |
local _OSROOT="$1" |
local _OSROOT="$1" |
33 |
local _OSHOSTNAME="$2" |
local _HOSTNAME="$2" |
34 |
local _OSHOSTDOMAIN="$3" |
local _HOSTDOMAIN="$3" |
35 |
if [[ -z ${_OSROOT} ]] |
if [[ -z ${_OSROOT} ]] |
36 |
then |
then |
37 |
echo "no _OSROOT given" |
echo "no _OSROOT given" |
42 |
echo "Root dir '${_OSROOT}' does not exist" |
echo "Root dir '${_OSROOT}' does not exist" |
43 |
return 1 |
return 1 |
44 |
fi |
fi |
45 |
if [[ -z ${_OSHOSTNAME} ]] |
if [[ -z ${_HOSTNAME} ]] |
46 |
then |
then |
47 |
echo "no _OSHOSTNAME given" |
echo "no _HOSTNAME given" |
48 |
return 1 |
return 1 |
49 |
fi |
fi |
50 |
if [[ -z ${_OSHOSTDOMAIN} ]] |
if [[ -z ${_HOSTDOMAIN} ]] |
51 |
then |
then |
52 |
echo "no _OSHOSTDOMAIN given" |
echo "no _HOSTDOMAIN given" |
53 |
return 1 |
return 1 |
54 |
fi |
fi |
55 |
|
|
76 |
fi |
fi |
77 |
|
|
78 |
# fix hostname and hosts file |
# fix hostname and hosts file |
79 |
echo "${_OSHOSTNAME}" > ${_OSROOT}/etc/hostname |
echo "${_HOSTNAME}" > ${_OSROOT}/etc/hostname |
80 |
echo "127.0.0.1 localhost ${_OSHOSTNAME}.${_OSHOSTDOMAIN} ${_OSHOSTNAME}" > ${_OSROOT}/etc/hosts |
echo "127.0.0.1 localhost ${_HOSTNAME}.${_HOSTDOMAIN} ${_HOSTNAME}" > ${_OSROOT}/etc/hosts |
81 |
cat >> ${_OSROOT}/etc/hosts << EOF |
cat >> ${_OSROOT}/etc/hosts << EOF |
82 |
::1 ip6-localhost ip6-loopback |
::1 ip6-localhost ip6-loopback |
83 |
fe00::0 ip6-localnet |
fe00::0 ip6-localnet |
117 |
|
|
118 |
# create tarball |
# create tarball |
119 |
[[ -f ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ]] && rm ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 |
[[ -f ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ]] && rm ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 |
120 |
( cd ${_OSROOT}; tar cvjpf ${CDISOROOT}/${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ./ | tee ${LIVECDROOT}/${_TARBALLNAME}.log ) |
( cd ${_OSROOT}; tar cvjpf ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ./ | tee ${LIVECDROOT}/${_TARBALLNAME}.log ) |
121 |
|
|
122 |
# create images.conf |
# create images.conf |
123 |
echo "CDIMAGENAME=${_TARBALLNAME}.tar.bz2" > ${_TARBALLTARGET}/images.conf |
echo "CDIMAGENAME=${_TARBALLNAME}.tar.bz2" > ${_TARBALLTARGET}/images.conf |
142 |
## |
## |
143 |
create_install_tarball() |
create_install_tarball() |
144 |
{ |
{ |
145 |
install -d ${LIVECDROOT}/install-chroot |
local INSTALL_BASESYSTEM |
146 |
install -d ${CDISOROOT}/system |
local INSTALL_FLAVOR |
147 |
|
local INSTALL_ISOROOT |
148 |
|
local INSTALL_CHROOT |
149 |
|
|
150 |
|
INSTALL_BASESYSTEM="$1" |
151 |
|
INSTALL_FLAVOR="${1//basesystem/install}" |
152 |
|
INSTALL_ISOROOT="${CDISOROOT}/${INSTALL_FLAVOR//install/system}" |
153 |
|
INSTALL_CHROOT="${LIVECDROOT}/${INSTALL_FLAVOR}-chroot" |
154 |
|
|
155 |
|
if [[ -z ${INSTALL_BASESYSTEM} ]] |
156 |
|
then |
157 |
|
INSTALL_BASESYSTEM="basesystem" |
158 |
|
INSTALL_ISOROOT="${CDISOROOT}/system" |
159 |
|
INSTALL_CHROOT="${LIVECDROOT}/install-chroot" |
160 |
|
fi |
161 |
|
|
162 |
|
install -d ${INSTALL_CHROOT} |
163 |
|
install -d ${INSTALL_ISOROOT} |
164 |
|
|
165 |
# use all settings from the global config, but the basesystem |
# use all settings from the global config, but the basesystem |
166 |
# has to be the normal install basesystem not for livecds |
# has to be the normal install basesystem not for livecds |
167 |
mage-bootstrap \ |
mage-bootstrap \ |
168 |
--root ${LIVECDROOT}/install-chroot \ |
--root ${INSTALL_CHROOT} \ |
169 |
--profile ${MAGE_PROFILE} \ |
--profile ${MAGE_PROFILE} \ |
170 |
--magerc ${MAGERC} \ |
--magerc ${MAGERC} \ |
171 |
--toolchain ${TOOLCHAIN} \ |
--toolchain ${TOOLCHAIN} \ |
172 |
--update-tarball \ |
--update-tarball \ |
173 |
--basesystem basesystem || die "bootstrapping target system failed!" |
--basesystem ${INSTALL_BASESYSTEM} || die "bootstrapping target system failed!" |
174 |
|
|
175 |
## DEV SERVER ## |
## DEV SERVER ## |
176 |
# NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern" |
# NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern" |
177 |
# CONFIG="${LIVECDROOT}/install-chroot/etc/mcore/mcore.conf" |
# CONFIG="${INSTALL_CHROOT}/etc/mcore/mcore.conf" |
178 |
# updateconfig MCORE_CONTROL_SERVER |
# updateconfig MCORE_CONTROL_SERVER |
179 |
### |
### |
180 |
|
|
181 |
# fix missing symlink |
# fix missing symlink |
182 |
if [ ! -L ${LIVECDROOT}/install-chroot/usr/bin/X ] |
if [ ! -L ${INSTALL_CHROOT}/usr/bin/X ] |
183 |
then |
then |
184 |
ln -snf Xorg ${LIVECDROOT}/install-chroot/usr/bin/X |
ln -snf Xorg ${INSTALL_CHROOT}/usr/bin/X |
185 |
fi |
fi |
186 |
|
|
187 |
|
# remove .bash_history |
188 |
|
[ -f ${INSTALL_CHROOT}/root/.bash_history ] && rm ${INSTALL_CHROOT}/root/.bash_history |
189 |
|
|
190 |
# os config |
# os config |
191 |
prepare_custom_baseconfig "${LIVECDROOT}/install-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
prepare_custom_baseconfig "${INSTALL_CHROOT}" "alx-${CDOSARCH}" "magellan-linux.de" |
192 |
|
|
193 |
# create tarball |
# create tarball |
194 |
prepare_custom_installertarball "${LIVECDROOT}/install-chroot" "alx-${CDOSARCH}" "${CDISOROOT}/system" |
prepare_custom_installertarball "${INSTALL_CHROOT}" "alx-${CDOSARCH}" "${INSTALL_ISOROOT}" |
195 |
} |
} |
196 |
|
|
197 |
## |
## |
199 |
## |
## |
200 |
create_netboot_image() |
create_netboot_image() |
201 |
{ |
{ |
202 |
install -d ${CDISOROOT}/netboot |
local NETBOOT_BASESYSTEM |
203 |
install -d ${LIVECDROOT}/netboot-chroot |
local NETBOOT_FLAVOR |
204 |
install -d ${LIVECDROOT}/netboot-squashfs |
local NETBOOT_ISOROOT |
205 |
|
local NETBOOT_CHROOT |
206 |
|
local NETBOOT_SQUASHFS |
207 |
|
|
208 |
|
NETBOOT_BASESYSTEM="$1" |
209 |
|
NETBOOT_FLAVOR="${1//system}" |
210 |
|
NETBOOT_ISOROOT="${CDISOROOT}/${NETBOOT_FLAVOR}" |
211 |
|
NETBOOT_CHROOT="${LIVECDROOT}/${NETBOOT_FLAVOR}-chroot" |
212 |
|
NETBOOT_SQUASHFS="${LIVECDROOT}/${NETBOOT_FLAVOR}-squashfs" |
213 |
|
|
214 |
|
if [[ -z ${NETBOOT_BASESYSTEM} ]] |
215 |
|
then |
216 |
|
NETBOOT_BASESYSTEM="netbootsystem" |
217 |
|
NETBOOT_ISOROOT="${CDISOROOT}/netboot" |
218 |
|
NETBOOT_CHROOT="${LIVECDROOT}/netboot-chroot" |
219 |
|
NETBOOT_SQUASHFS="${LIVECDROOT}/netboot-squashfs" |
220 |
|
fi |
221 |
|
|
222 |
|
install -d ${NETBOOT_ISOROOT} |
223 |
|
install -d ${NETBOOT_CHROOT} |
224 |
|
install -d ${NETBOOT_SQUASHFS} |
225 |
|
|
226 |
# use all settings from the global config, but use netbootsysten as basesystem |
# use all settings from the global config, but use netbootsysten as basesystem |
227 |
mage-bootstrap \ |
mage-bootstrap \ |
228 |
--root ${LIVECDROOT}/netboot-chroot \ |
--root ${NETBOOT_CHROOT} \ |
229 |
--profile ${MAGE_PROFILE} \ |
--profile ${MAGE_PROFILE} \ |
230 |
--magerc ${MAGERC} \ |
--magerc ${MAGERC} \ |
231 |
--toolchain ${TOOLCHAIN} \ |
--toolchain ${TOOLCHAIN} \ |
232 |
--update-tarball \ |
--update-tarball \ |
233 |
--basesystem netbootsystem || die "bootstrapping target system failed!" |
--basesystem ${NETBOOT_BASESYSTEM} || die "bootstrapping target system failed!" |
234 |
|
|
235 |
# os config |
# os config |
236 |
prepare_custom_baseconfig "${LIVECDROOT}/netboot-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
prepare_custom_baseconfig "${NETBOOT_CHROOT}" "alx-${CDOSARCH}" "magellan-linux.de" |
237 |
|
|
238 |
# creating netboot image from here on |
# creating netboot image from here on |
239 |
install -d ${LIVECDROOT}/netboot-squashfs/{LiveOS,mnt} || die |
install -d ${NETBOOT_SQUASHFS}/{LiveOS,mnt} || die |
240 |
|
|
241 |
# fix fstab, use the livecd fstab without rootfs and swap |
# fix fstab, use the livecd fstab without rootfs and swap |
242 |
install -m 0644 $(get_profile fstab) ${LIVECDROOT}/netboot-chroot/etc/fstab || die |
install -m 0644 $(get_profile fstab) ${NETBOOT_CHROOT}/etc/fstab || die |
243 |
|
|
244 |
|
# remove .bash_history |
245 |
|
[ -f ${NETBOOT_CHROOT}/root/.bash_history ] && rm ${NETBOOT_CHROOT}/root/.bash_history |
246 |
|
|
247 |
# get the actual size of the chroot |
# get the actual size of the chroot |
248 |
size=$(du -s ${LIVECDROOT}/netboot-chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
size=$(du -s ${NETBOOT_CHROOT} | sed 's:^\(.*\)[[:space:]].*:\1:') |
249 |
|
|
250 |
# generate a ext3fs file for devicemapper |
# generate a ext3fs file for devicemapper |
251 |
dd if=/dev/zero of=${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die |
dd if=/dev/zero of=${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die |
252 |
# create a filesystem |
# create a filesystem |
253 |
mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die |
254 |
# set mount_counts and check_intervals to 0 |
# set mount_counts and check_intervals to 0 |
255 |
# set dir_index top, to speed up things with hashed b-trees |
# set dir_index top, to speed up things with hashed b-trees |
256 |
# allow acls too |
# allow acls too |
257 |
tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die |
258 |
# strip the journal |
# strip the journal |
259 |
# tune2fs -O^has_journal ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
# tune2fs -O^has_journal ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die |
260 |
# fsck after journal removal |
# fsck after journal removal |
261 |
# fsck ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
# fsck ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die |
262 |
|
|
263 |
# losetup the device |
# losetup the device |
264 |
loopdev=$(losetup -f) |
loopdev=$(losetup -f) |
265 |
[[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?" |
[[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?" |
266 |
|
|
267 |
# mount the image |
# mount the image |
268 |
losetup ${loopdev} ${LIVECDROOT}/netboot-squashfs/LiveOS/ext3fs.img || die |
losetup ${loopdev} ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die |
269 |
mount ${loopdev} ${LIVECDROOT}/netboot-squashfs/mnt || die |
mount ${loopdev} ${NETBOOT_SQUASHFS}/mnt || die |
270 |
|
|
271 |
# copy everything to the image file and preserve permissions |
# copy everything to the image file and preserve permissions |
272 |
( cd ${LIVECDROOT}/netboot-chroot && tar cpf - . ) | ( cd ${LIVECDROOT}/netboot-squashfs/mnt && tar xvpf - ) |
( cd ${NETBOOT_CHROOT} && tar cpf - . ) | ( cd ${NETBOOT_SQUASHFS}/mnt && tar xvpf - ) |
273 |
sleep 3 |
sleep 3 |
274 |
|
|
275 |
# now umount everything and create the squashfs image |
# now umount everything and create the squashfs image |
276 |
umount ${LIVECDROOT}/netboot-squashfs/mnt || die |
umount ${NETBOOT_SQUASHFS}/mnt || die |
277 |
losetup -d ${loopdev} || die |
losetup -d ${loopdev} || die |
278 |
# remove mount to not ending up in the squashfs image |
# remove mount to not ending up in the squashfs image |
279 |
if [[ -d ${LIVECDROOT}/netboot-squashfs/mnt ]] |
if [[ -d ${NETBOOT_SQUASHFS}/mnt ]] |
280 |
then |
then |
281 |
rm -r ${LIVECDROOT}/netboot-squashfs/mnt || die |
rm -r ${NETBOOT_SQUASHFS}/mnt || die |
282 |
fi |
fi |
283 |
mksquashfs ${LIVECDROOT}/netboot-squashfs ${CDISOROOT}/netboot/squashfs.img || die |
mksquashfs ${NETBOOT_SQUASHFS} ${NETBOOT_ISOROOT}/squashfs.img || die |
284 |
|
|
285 |
# copy kernel, bootloader and create initramfs to isoroot/netboot |
# copy kernel, bootloader and create initramfs to isoroot/netboot |
286 |
install -d ${CDISOROOT}/netboot || die |
install -d ${NETBOOT_ISOROOT} || die |
287 |
# kernel |
# kernel |
288 |
kimg="$(find ${CDCHROOTDIR}/boot -name kernel-\* -printf '%f\n')" |
kimg="$(find ${NETBOOT_CHROOT}/boot -name kernel-\* -printf '%f\n')" |
289 |
install ${CDCHROOTDIR}/boot/${kimg} ${CDISOROOT}/netboot/${CDKERNELNAME} || die |
install ${NETBOOT_CHROOT}/boot/${kimg} ${NETBOOT_ISOROOT}/${CDKERNELNAME} || die |
290 |
# initrd |
# initrd |
291 |
install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die |
install -d ${NETBOOT_CHROOT}/etc/dracut.conf.d || die |
292 |
echo 'add_dracutmodules+=" livenet busybox "' > ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
echo 'add_dracutmodules+=" livenet busybox "' > ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die |
293 |
echo 'omit_dracutmodules+=" mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
echo 'omit_dracutmodules+=" mcored "' >> ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die |
294 |
echo 'hostonly="no"' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
echo 'hostonly="no"' >> ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die |
295 |
# install dracut-dev package to have all modules |
# install dracut-dev package to have all modules |
296 |
custom_packages install "dracut-dev curl curl-dev" || die |
CUSTOM_PACKAGES_CHROOT="${NETBOOT_CHROOT}" custom_packages install "dracut-dev curl curl-dev" || die |
297 |
## mlivecdbuild function |
## mlivecdbuild function |
298 |
generate_initrd |
INITRD_CHROOT="${NETBOOT_CHROOT}" generate_initrd |
299 |
mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die |
mv ${CDISOROOT}/isolinux/initrd.gz ${NETBOOT_ISOROOT}/ || die |
300 |
# fix initrd permissions |
# fix initrd permissions |
301 |
chmod 0644 ${CDISOROOT}/netboot/initrd.gz || die |
chmod 0644 ${NETBOOT_ISOROOT}/initrd.gz || die |
302 |
if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ] |
if [ -e ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf ] |
303 |
then |
then |
304 |
rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf |
rm ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf |
305 |
fi |
fi |
306 |
|
|
307 |
# bootloader pxelinux |
# bootloader pxelinux |
308 |
install -d ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg |
install -d ${NETBOOT_ISOROOT}/pxelinux/pxelinux.cfg |
309 |
[ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${CDISOROOT}/netboot/pxelinux/ |
# bios |
310 |
[ -f $(get_profile netboot/pxelinux.cfg/pxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/pxelinux-default) ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg |
[ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${NETBOOT_ISOROOT}/pxelinux/ |
311 |
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/pxelinux/ |
[ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${NETBOOT_ISOROOT}/pxelinux/ |
312 |
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/pxelinux/ |
# efi-x32 |
313 |
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/pxelinux/ |
[ -f $(get_profile netboot/bootx32.efi) ] && install -m0644 $(get_profile netboot/bootx32.efi) ${NETBOOT_ISOROOT}/pxelinux/ |
314 |
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/pxelinux/ |
[ -f $(get_profile netboot/ldlinux.e32) ] && install -m0644 $(get_profile netboot/ldlinux.e32) ${NETBOOT_ISOROOT}/pxelinux/ |
315 |
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/pxelinux/ |
# efi-x64 |
316 |
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/pxelinux/ |
[ -f $(get_profile netboot/bootx64.efi) ] && install -m0644 $(get_profile netboot/bootx64.efi) ${NETBOOT_ISOROOT}/pxelinux/ |
317 |
|
[ -f $(get_profile netboot/ldlinux.e64) ] && install -m0644 $(get_profile netboot/ldlinux.e64) ${NETBOOT_ISOROOT}/pxelinux/ |
318 |
|
# common pxelinux config |
319 |
|
[ -f $(get_profile netboot/pxelinux.cfg/pxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/pxelinux-default) ${NETBOOT_ISOROOT}/pxelinux/pxelinux.cfg |
320 |
|
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${NETBOOT_ISOROOT}/pxelinux/ |
321 |
|
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${NETBOOT_ISOROOT}/pxelinux/ |
322 |
|
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${NETBOOT_ISOROOT}/pxelinux/ |
323 |
|
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${NETBOOT_ISOROOT}/pxelinux/ |
324 |
|
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${NETBOOT_ISOROOT}/pxelinux/ |
325 |
|
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${NETBOOT_ISOROOT}/pxelinux/ |
326 |
|
|
327 |
# bootloader lpxelinux |
# bootloader lpxelinux |
328 |
install -d ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg |
install -d ${NETBOOT_ISOROOT}/lpxelinux/pxelinux.cfg |
329 |
[ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${CDISOROOT}/netboot/lpxelinux/ |
# bios |
330 |
[ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${CDISOROOT}/netboot/lpxelinux/ |
[ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${NETBOOT_ISOROOT}/lpxelinux/ |
331 |
[ -f $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg |
[ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${NETBOOT_ISOROOT}/lpxelinux/ |
332 |
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/lpxelinux/ |
# efi-x32 |
333 |
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/lpxelinux/ |
[ -f $(get_profile netboot/bootx32.efi) ] && install -m0644 $(get_profile netboot/bootx32.efi) ${NETBOOT_ISOROOT}/lpxelinux/ |
334 |
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/lpxelinux/ |
[ -f $(get_profile netboot/ldlinux.e32) ] && install -m0644 $(get_profile netboot/ldlinux.e32) ${NETBOOT_ISOROOT}/lpxelinux/ |
335 |
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/lpxelinux/ |
# efi-x64 |
336 |
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/lpxelinux/ |
[ -f $(get_profile netboot/bootx64.efi) ] && install -m0644 $(get_profile netboot/bootx64.efi) ${NETBOOT_ISOROOT}/lpxelinux/ |
337 |
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/lpxelinux/ |
[ -f $(get_profile netboot/ldlinux.e64) ] && install -m0644 $(get_profile netboot/ldlinux.e64) ${NETBOOT_ISOROOT}/lpxelinux/ |
338 |
|
# common lpxelinux config |
339 |
|
[ -f $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ${NETBOOT_ISOROOT}/lpxelinux/pxelinux.cfg |
340 |
|
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${NETBOOT_ISOROOT}/lpxelinux/ |
341 |
|
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${NETBOOT_ISOROOT}/lpxelinux/ |
342 |
|
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${NETBOOT_ISOROOT}/lpxelinux/ |
343 |
|
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${NETBOOT_ISOROOT}/lpxelinux/ |
344 |
|
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${NETBOOT_ISOROOT}/lpxelinux/ |
345 |
|
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${NETBOOT_ISOROOT}/lpxelinux/ |
346 |
|
|
347 |
# final cleanup |
# final cleanup |
348 |
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
349 |
then |
then |
350 |
if [[ -d ${LIVECDROOT}/netboot-squashfs ]] |
if [[ -d ${NETBOOT_SQUASHFS} ]] |
351 |
then |
then |
352 |
rm -r ${LIVECDROOT}/netboot-squashfs || die |
rm -r ${NETBOOT_SQUASHFS} || die |
353 |
fi |
fi |
354 |
if [[ -d ${LIVECDROOT}/netboot-chroot ]] |
if [[ -d ${NETBOOT_CHROOT} ]] |
355 |
then |
then |
356 |
rm -r ${LIVECDROOT}/netboot-chroot |
rm -r ${NETBOOT_CHROOT} |
357 |
fi |
fi |
358 |
fi |
fi |
359 |
} |
} |
363 |
## |
## |
364 |
create_server_tarball() |
create_server_tarball() |
365 |
{ |
{ |
366 |
install -d ${LIVECDROOT}/server-chroot |
local SERVER_BASESYSTEM |
367 |
install -d ${CDISOROOT}/server |
local SERVER_FLAVOR |
368 |
|
local SERVER_ISOROOT |
369 |
|
local SERVER_CHROOT |
370 |
|
|
371 |
|
SERVER_BASESYSTEM="$1" |
372 |
|
SERVER_FLAVOR="${1//system}" |
373 |
|
SERVER_ISOROOT="${CDISOROOT}/${SERVER_FLAVOR}" |
374 |
|
SERVER_CHROOT="${LIVECDROOT}/${SERVER_FLAVOR}-chroot" |
375 |
|
|
376 |
|
if [[ -z ${SERVER_BASESYSTEM} ]] |
377 |
|
then |
378 |
|
SERVER_BASESYSTEM="serversystem" |
379 |
|
SERVER_ISOROOT="${CDISOROOT}/server" |
380 |
|
SERVER_CHROOT="${LIVECDROOT}/server-chroot" |
381 |
|
fi |
382 |
|
|
383 |
|
install -d ${SERVER_CHROOT} |
384 |
|
install -d ${SERVER_ISOROOT} |
385 |
|
|
386 |
mage-bootstrap \ |
mage-bootstrap \ |
387 |
--root ${LIVECDROOT}/server-chroot \ |
--root ${SERVER_CHROOT} \ |
388 |
--profile ${MAGE_PROFILE} \ |
--profile ${MAGE_PROFILE} \ |
389 |
--magerc ${MAGERC} \ |
--magerc ${MAGERC} \ |
390 |
--toolchain ${TOOLCHAIN} \ |
--toolchain ${TOOLCHAIN} \ |
391 |
--update-tarball \ |
--update-tarball \ |
392 |
--basesystem serversystem || die "bootstrapping target system failed!" |
--basesystem serversystem || die "bootstrapping target system failed!" |
393 |
|
|
|
|
|
394 |
# enable getty1 |
# enable getty1 |
395 |
install -d ${LIVECDROOT}/server-chroot/etc/systemd/system/getty.target.wants |
install -d ${SERVER_CHROOT}/etc/systemd/system/getty.target.wants |
396 |
ln -snf /usr/lib/systemd/system/getty@.service ${LIVECDROOT}/server-chroot/etc/systemd/system/getty.target.wants/getty@tty1.service |
ln -snf /usr/lib/systemd/system/getty@.service ${SERVER_CHROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service |
397 |
|
|
398 |
# be more verbose |
# be more verbose |
399 |
sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${LIVECDROOT}/server-chroot/etc/conf.d/grub |
sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${SERVER_CHROOT}/etc/conf.d/grub |
400 |
|
|
401 |
# remove phpmyadmin configuration directory |
# remove phpmyadmin configuration directory |
402 |
if [ -d ${LIVECDROOT}/server-chroot/usr/share/phpmyadmin/config ] |
if [ -d ${SERVER_CHROOT}/usr/share/phpmyadmin/config ] |
403 |
then |
then |
404 |
rm -r ${LIVECDROOT}/server-chroot/usr/share/phpmyadmin/config |
rm -r ${SERVER_CHROOT}/usr/share/phpmyadmin/config |
405 |
fi |
fi |
406 |
|
|
407 |
# os config |
# os config |
408 |
prepare_custom_baseconfig "${LIVECDROOT}/server-chroot" "alx-svr-${CDOSARCH}" "magellan-linux.de" |
prepare_custom_baseconfig "${SERVER_CHROOT}" "alx-svr-${CDOSARCH}" "magellan-linux.de" |
409 |
|
|
410 |
# fix certificate issues with mcored (common name of cert issuer) and >php-5.4 |
# fix certificate issues with mcored (common name of cert issuer) and >php-5.4 |
411 |
echo "127.0.0.1 mcored" >> ${LIVECDROOT}/server-chroot/etc/hosts |
echo "127.0.0.1 mcored" >> ${SERVER_CHROOT}/etc/hosts |
412 |
|
|
413 |
|
# remove .bash_history |
414 |
|
[ -f ${SERVER_CHROOT}/root/.bash_history ] && rm ${SERVER_CHROOT}/root/.bash_history |
415 |
|
|
416 |
# create tarball |
# create tarball |
417 |
prepare_custom_installertarball "${LIVECDROOT}/server-chroot" "alx-svr-${CDOSARCH}" "${CDISOROOT}/server" |
prepare_custom_installertarball "${SERVER_CHROOT}" "alx-svr-${CDOSARCH}" "${SERVER_ISOROOT}" |
418 |
} |
} |
419 |
|
|
420 |
# set an empty root password |
# set an empty root password |
441 |
fi |
fi |
442 |
|
|
443 |
# stop here if the user don't want to create the install tarball |
# stop here if the user don't want to create the install tarball |
444 |
[[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball |
[[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball basesystem |
445 |
|
[[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball basesystem-legacy |
446 |
|
|
447 |
# stop here if the user don't want to create the netboot image |
# stop here if the user don't want to create the netboot image |
448 |
[[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image |
[[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image netbootsystem |
449 |
|
[[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image netbootsystem-legacy |
450 |
|
|
451 |
# stop here if the user don't want to create the server tarball |
# stop here if the user don't want to create the server tarball |
452 |
[[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball |
[[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball serversystem |
453 |
|
|
454 |
# install usb-install script |
# install usb-install script |
455 |
[ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install |
[ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install |