Magellan Linux

Annotation of /trunk/mlivecdbuild/profiles/alx-0_7_branch/common/prepare_custom

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3230 - (hide annotations) (download)
Tue Sep 19 09:44:54 2023 UTC (8 months, 2 weeks ago) by niro
File size: 16085 byte(s)
-make install tarball creation more variable to be able to create root filesystems for multiple install target flavors
1 niro 2119 #!/bin/bash
2    
3 niro 2664 updateconfig()
4     {
5     local variables="$@"
6     local value
7     local i
8    
9     if [[ -z ${CONFIG} ]]
10     then
11     echo "You must define \$CONFIG varibale first!"
12     return 1
13     fi
14    
15     for i in ${variables}
16     do
17     value="$(eval echo \${NEW_${i}})"
18     if [[ ! -z $(grep "^${i}=" ${CONFIG}) ]]
19     then
20     echo "fixing ${i} -> ${value}"
21     sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${CONFIG}
22     else
23     echo "adding ${i}=${value}"
24     echo "${i}=\"${value}\"" >> ${CONFIG}
25     fi
26     done
27     }
28    
29 niro 3230 # prepare_custom_baseconfig $_OSROOT $_HOSTNAME $_HOSTDOMAIN
30 niro 3070 prepare_custom_baseconfig()
31 niro 2664 {
32 niro 3070 local _OSROOT="$1"
33 niro 3230 local _HOSTNAME="$2"
34     local _HOSTDOMAIN="$3"
35 niro 3070 if [[ -z ${_OSROOT} ]]
36 niro 3061 then
37 niro 3070 echo "no _OSROOT given"
38     return 1
39 niro 3061 fi
40 niro 3070 if [[ ! -d ${_OSROOT} ]]
41     then
42     echo "Root dir '${_OSROOT}' does not exist"
43     return 1
44     fi
45 niro 3230 if [[ -z ${_HOSTNAME} ]]
46 niro 3070 then
47 niro 3230 echo "no _HOSTNAME given"
48 niro 3070 return 1
49     fi
50 niro 3230 if [[ -z ${_HOSTDOMAIN} ]]
51 niro 3070 then
52 niro 3230 echo "no _HOSTDOMAIN given"
53 niro 3070 return 1
54     fi
55 niro 3061
56     # generate a new machine-id on first-boot
57 niro 3070 :> ${_OSROOT}/etc/machine-id
58 niro 3061
59     # fix localtime symlink
60 niro 3070 ln -snf ../usr/share/zoneinfo/Europe/Berlin ${_OSROOT}/etc/localtime
61 niro 3061
62     # activate timeserver via dhcp (NTP - option 42)
63 niro 3070 CDCHROOTDIR=${_OSROOT} custom_services add systemd-timesyncd.service
64 niro 3061
65     # empty root password
66 niro 3070 chroot ${_OSROOT} passwd -d root
67 niro 2664
68 niro 3061 # empty user password
69 niro 3070 chroot ${_OSROOT} passwd -d station
70 niro 3061
71 niro 3070 if [ -x ${_OSROOT}/usr/bin/mcorepasswd ] ||
72     [ -L ${_OSROOT}/usr/bin/mcorepasswd ]
73 niro 3061 then
74     # add mcored default user
75 niro 3070 ( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${_OSROOT} /usr/bin/mcorepasswd mcore
76 niro 3061 fi
77    
78 niro 2664 # fix hostname and hosts file
79 niro 3230 echo "${_HOSTNAME}" > ${_OSROOT}/etc/hostname
80     echo "127.0.0.1 localhost ${_HOSTNAME}.${_HOSTDOMAIN} ${_HOSTNAME}" > ${_OSROOT}/etc/hosts
81 niro 3070 cat >> ${_OSROOT}/etc/hosts << EOF
82 niro 2664 ::1 ip6-localhost ip6-loopback
83     fe00::0 ip6-localnet
84     ff00::0 ip6-mcastprefix
85     ff02::1 ip6-allnodes
86     ff02::2 ip6-allrouters
87     ff02::3 ip6-allhosts
88     EOF
89 niro 3070 }
90 niro 2664
91 niro 3070 # prepare_custom_installertarball $_OSROOT $_TARBALLNAME $_TARBALLTARGET
92     prepare_custom_installertarball()
93     {
94     local _OSROOT="$1"
95     local _TARBALLNAME="$2"
96     local _TARBALLTARGET="$3"
97     if [[ -z ${_OSROOT} ]]
98     then
99     echo "no _OSROOT given"
100     return 1
101     fi
102     if [[ ! -d ${_OSROOT} ]]
103     then
104     echo "Root dir '${_OSROOT}' does not exist"
105     return 1
106     fi
107     if [[ -z ${_TARBALLNAME} ]]
108     then
109     echo "no _TARBALLNAME given"
110     return 1
111     fi
112     if [[ -z ${_TARBALLTARGET} ]]
113     then
114     echo "no _TARBALLTARGET given"
115     return 1
116     fi
117    
118 niro 2664 # create tarball
119 niro 3070 [[ -f ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ]] && rm ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2
120 niro 3230 ( cd ${_OSROOT}; tar cvjpf ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ./ | tee ${LIVECDROOT}/${_TARBALLNAME}.log )
121 niro 2664
122     # create images.conf
123 niro 3070 echo "CDIMAGENAME=${_TARBALLNAME}.tar.bz2" > ${_TARBALLTARGET}/images.conf
124     echo "TOTALLINES=$(wc -l ${LIVECDROOT}/${_TARBALLNAME}.log | cut -d' ' -f1)" >> ${_TARBALLTARGET}/images.conf
125 niro 2664
126     # clean up
127 niro 3070 if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]]
128 niro 2664 then
129 niro 3070 if [[ -d ${_OSROOT} ]]
130     then
131     rm -r ${_OSROOT}
132     fi
133     if [[ -f ${LIVECDROOT}/${_TARBALLNAME}.log ]]
134     then
135     rm ${LIVECDROOT}/${_TARBALLNAME}.log
136     fi
137 niro 2664 fi
138 niro 3070 }
139    
140     ##
141     # create the install tarball
142     ##
143     create_install_tarball()
144     {
145 niro 3230 local INSTALL_BASESYSTEM
146     local INSTALL_FLAVOR
147     local INSTALL_ISOROOT
148     local INSTALL_CHROOT
149 niro 3070
150 niro 3230 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 niro 3070 # use all settings from the global config, but the basesystem
166     # has to be the normal install basesystem not for livecds
167     mage-bootstrap \
168 niro 3230 --root ${INSTALL_CHROOT} \
169 niro 3070 --profile ${MAGE_PROFILE} \
170     --magerc ${MAGERC} \
171     --toolchain ${TOOLCHAIN} \
172     --update-tarball \
173 niro 3230 --basesystem ${INSTALL_BASESYSTEM} || die "bootstrapping target system failed!"
174 niro 3070
175     ## DEV SERVER ##
176     # NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern"
177 niro 3230 # CONFIG="${INSTALL_CHROOT}/etc/mcore/mcore.conf"
178 niro 3070 # updateconfig MCORE_CONTROL_SERVER
179     ###
180    
181     # fix missing symlink
182 niro 3230 if [ ! -L ${INSTALL_CHROOT}/usr/bin/X ]
183 niro 3065 then
184 niro 3230 ln -snf Xorg ${INSTALL_CHROOT}/usr/bin/X
185 niro 3065 fi
186 niro 3070
187 niro 3230 # remove .bash_history
188     [ -f ${INSTALL_CHROOT}/root/.bash_history ] && rm ${INSTALL_CHROOT}/root/.bash_history
189    
190 niro 3070 # os config
191 niro 3230 prepare_custom_baseconfig "${INSTALL_CHROOT}" "alx-${CDOSARCH}" "magellan-linux.de"
192 niro 3070
193     # create tarball
194 niro 3230 prepare_custom_installertarball "${INSTALL_CHROOT}" "alx-${CDOSARCH}" "${INSTALL_ISOROOT}"
195 niro 2664 }
196    
197     ##
198     # create the network image
199     ##
200     create_netboot_image()
201     {
202 niro 3230 local NETBOOT_BASESYSTEM
203     local NETBOOT_FLAVOR
204     local NETBOOT_ISOROOT
205     local NETBOOT_CHROOT
206     local NETBOOT_SQUASHFS
207 niro 2664
208 niro 3230 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 niro 3070 # use all settings from the global config, but use netbootsysten as basesystem
227     mage-bootstrap \
228 niro 3230 --root ${NETBOOT_CHROOT} \
229 niro 3070 --profile ${MAGE_PROFILE} \
230     --magerc ${MAGERC} \
231     --toolchain ${TOOLCHAIN} \
232     --update-tarball \
233 niro 3230 --basesystem ${NETBOOT_BASESYSTEM} || die "bootstrapping target system failed!"
234 niro 2664
235 niro 3070 # os config
236 niro 3230 prepare_custom_baseconfig "${NETBOOT_CHROOT}" "alx-${CDOSARCH}" "magellan-linux.de"
237 niro 3070
238     # creating netboot image from here on
239 niro 3230 install -d ${NETBOOT_SQUASHFS}/{LiveOS,mnt} || die
240 niro 3070
241 niro 3061 # fix fstab, use the livecd fstab without rootfs and swap
242 niro 3230 install -m 0644 $(get_profile fstab) ${NETBOOT_CHROOT}/etc/fstab || die
243 niro 3061
244 niro 3230 # remove .bash_history
245     [ -f ${NETBOOT_CHROOT}/root/.bash_history ] && rm ${NETBOOT_CHROOT}/root/.bash_history
246    
247 niro 2664 # get the actual size of the chroot
248 niro 3230 size=$(du -s ${NETBOOT_CHROOT} | sed 's:^\(.*\)[[:space:]].*:\1:')
249 niro 2664
250     # generate a ext3fs file for devicemapper
251 niro 3230 dd if=/dev/zero of=${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die
252 niro 2664 # create a filesystem
253 niro 3230 mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die
254 niro 2664 # set mount_counts and check_intervals to 0
255 niro 3061 # set dir_index top, to speed up things with hashed b-trees
256 niro 2664 # allow acls too
257 niro 3230 tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die
258 niro 3061 # strip the journal
259 niro 3230 # tune2fs -O^has_journal ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die
260 niro 3061 # fsck after journal removal
261 niro 3230 # fsck ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die
262 niro 2664
263     # losetup the device
264     loopdev=$(losetup -f)
265     [[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?"
266    
267     # mount the image
268 niro 3230 losetup ${loopdev} ${NETBOOT_SQUASHFS}/LiveOS/ext3fs.img || die
269     mount ${loopdev} ${NETBOOT_SQUASHFS}/mnt || die
270 niro 2664
271     # copy everything to the image file and preserve permissions
272 niro 3230 ( cd ${NETBOOT_CHROOT} && tar cpf - . ) | ( cd ${NETBOOT_SQUASHFS}/mnt && tar xvpf - )
273 niro 2664 sleep 3
274    
275     # now umount everything and create the squashfs image
276 niro 3230 umount ${NETBOOT_SQUASHFS}/mnt || die
277 niro 2664 losetup -d ${loopdev} || die
278     # remove mount to not ending up in the squashfs image
279 niro 3230 if [[ -d ${NETBOOT_SQUASHFS}/mnt ]]
280 niro 2664 then
281 niro 3230 rm -r ${NETBOOT_SQUASHFS}/mnt || die
282 niro 2664 fi
283 niro 3230 mksquashfs ${NETBOOT_SQUASHFS} ${NETBOOT_ISOROOT}/squashfs.img || die
284 niro 2664
285 niro 2872 # copy kernel, bootloader and create initramfs to isoroot/netboot
286 niro 3230 install -d ${NETBOOT_ISOROOT} || die
287 niro 2664 # kernel
288 niro 3230 kimg="$(find ${NETBOOT_CHROOT}/boot -name kernel-\* -printf '%f\n')"
289     install ${NETBOOT_CHROOT}/boot/${kimg} ${NETBOOT_ISOROOT}/${CDKERNELNAME} || die
290 niro 2664 # initrd
291 niro 3230 install -d ${NETBOOT_CHROOT}/etc/dracut.conf.d || die
292     echo 'add_dracutmodules+=" livenet busybox "' > ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die
293     echo 'omit_dracutmodules+=" mcored "' >> ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die
294     echo 'hostonly="no"' >> ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf || die
295 niro 2664 # install dracut-dev package to have all modules
296 niro 3230 CUSTOM_PACKAGES_CHROOT="${NETBOOT_CHROOT}" custom_packages install "dracut-dev curl curl-dev" || die
297 niro 2664 ## mlivecdbuild function
298 niro 3230 INITRD_CHROOT="${NETBOOT_CHROOT}" generate_initrd
299     mv ${CDISOROOT}/isolinux/initrd.gz ${NETBOOT_ISOROOT}/ || die
300 niro 3061 # fix initrd permissions
301 niro 3230 chmod 0644 ${NETBOOT_ISOROOT}/initrd.gz || die
302     if [ -e ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf ]
303 niro 2664 then
304 niro 3230 rm ${NETBOOT_CHROOT}/etc/dracut.conf.d/03-netboot.conf
305 niro 2664 fi
306 niro 3230
307 niro 3061 # bootloader pxelinux
308 niro 3230 install -d ${NETBOOT_ISOROOT}/pxelinux/pxelinux.cfg
309     # bios
310     [ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${NETBOOT_ISOROOT}/pxelinux/
311     [ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${NETBOOT_ISOROOT}/pxelinux/
312     # efi-x32
313     [ -f $(get_profile netboot/bootx32.efi) ] && install -m0644 $(get_profile netboot/bootx32.efi) ${NETBOOT_ISOROOT}/pxelinux/
314     [ -f $(get_profile netboot/ldlinux.e32) ] && install -m0644 $(get_profile netboot/ldlinux.e32) ${NETBOOT_ISOROOT}/pxelinux/
315     # efi-x64
316     [ -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 niro 3061 # bootloader lpxelinux
328 niro 3230 install -d ${NETBOOT_ISOROOT}/lpxelinux/pxelinux.cfg
329     # bios
330     [ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${NETBOOT_ISOROOT}/lpxelinux/
331     [ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${NETBOOT_ISOROOT}/lpxelinux/
332     # efi-x32
333     [ -f $(get_profile netboot/bootx32.efi) ] && install -m0644 $(get_profile netboot/bootx32.efi) ${NETBOOT_ISOROOT}/lpxelinux/
334     [ -f $(get_profile netboot/ldlinux.e32) ] && install -m0644 $(get_profile netboot/ldlinux.e32) ${NETBOOT_ISOROOT}/lpxelinux/
335     # efi-x64
336     [ -f $(get_profile netboot/bootx64.efi) ] && install -m0644 $(get_profile netboot/bootx64.efi) ${NETBOOT_ISOROOT}/lpxelinux/
337     [ -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 niro 2664
347     # final cleanup
348 niro 3070 if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]]
349 niro 2664 then
350 niro 3230 if [[ -d ${NETBOOT_SQUASHFS} ]]
351 niro 3070 then
352 niro 3230 rm -r ${NETBOOT_SQUASHFS} || die
353 niro 3070 fi
354 niro 3230 if [[ -d ${NETBOOT_CHROOT} ]]
355 niro 3070 then
356 niro 3230 rm -r ${NETBOOT_CHROOT}
357 niro 3070 fi
358 niro 2664 fi
359     }
360    
361 niro 3061 ##
362     # create the server tarball
363     ##
364     create_server_tarball()
365     {
366 niro 3230 local SERVER_BASESYSTEM
367     local SERVER_FLAVOR
368     local SERVER_ISOROOT
369     local SERVER_CHROOT
370 niro 3061
371 niro 3230 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 niro 3061 mage-bootstrap \
387 niro 3230 --root ${SERVER_CHROOT} \
388 niro 3061 --profile ${MAGE_PROFILE} \
389     --magerc ${MAGERC} \
390     --toolchain ${TOOLCHAIN} \
391     --update-tarball \
392     --basesystem serversystem || die "bootstrapping target system failed!"
393    
394     # enable getty1
395 niro 3230 install -d ${SERVER_CHROOT}/etc/systemd/system/getty.target.wants
396     ln -snf /usr/lib/systemd/system/getty@.service ${SERVER_CHROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service
397 niro 3061
398     # be more verbose
399 niro 3230 sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${SERVER_CHROOT}/etc/conf.d/grub
400 niro 3061
401     # remove phpmyadmin configuration directory
402 niro 3230 if [ -d ${SERVER_CHROOT}/usr/share/phpmyadmin/config ]
403 niro 3061 then
404 niro 3230 rm -r ${SERVER_CHROOT}/usr/share/phpmyadmin/config
405 niro 3061 fi
406    
407 niro 3070 # os config
408 niro 3230 prepare_custom_baseconfig "${SERVER_CHROOT}" "alx-svr-${CDOSARCH}" "magellan-linux.de"
409 niro 3070
410 niro 3061 # fix certificate issues with mcored (common name of cert issuer) and >php-5.4
411 niro 3230 echo "127.0.0.1 mcored" >> ${SERVER_CHROOT}/etc/hosts
412 niro 3061
413 niro 3230 # remove .bash_history
414     [ -f ${SERVER_CHROOT}/root/.bash_history ] && rm ${SERVER_CHROOT}/root/.bash_history
415    
416 niro 3061 # create tarball
417 niro 3230 prepare_custom_installertarball "${SERVER_CHROOT}" "alx-svr-${CDOSARCH}" "${SERVER_ISOROOT}"
418 niro 3061 }
419    
420 niro 2119 # set an empty root password
421     chroot ${CDCHROOTDIR} passwd -d root
422    
423     # install a custom boot-duration matching this livecd
424     install -d ${CDCHROOTDIR}/var/lib/plymouth || die
425     install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die
426    
427 niro 2661 # setup de keymap and locales
428     if [ -f ${CDCHROOTDIR}/etc/vconsole.conf ]
429     then
430 niro 2663 cat > ${CDCHROOTDIR}/etc/vconsole.conf << EOF || die
431 niro 2661 KEYMAP=de
432     KEYMAP_TOGGLE=
433     FONT=lat9w-16
434     FONT_MAP=8859-1_to_uni
435     FONT_UNIMAP=
436     EOF
437     fi
438     if [ -f ${CDCHROOTDIR}/etc/locale.conf ]
439     then
440 niro 2662 sed -i "s:^\(LANG=\).*:\1\"de_DE.utf8\":" ${CDCHROOTDIR}/etc/locale.conf || die
441 niro 2661 fi
442    
443 niro 2119 # stop here if the user don't want to create the install tarball
444 niro 3230 [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball basesystem
445     [[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball basesystem-legacy
446 niro 2119
447 niro 3070 # stop here if the user don't want to create the netboot image
448 niro 3230 [[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image netbootsystem
449     [[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image netbootsystem-legacy
450 niro 3070
451 niro 3061 # stop here if the user don't want to create the server tarball
452 niro 3230 [[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball serversystem
453 niro 3061
454 niro 2119 # install usb-install script
455     [ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install
456     [ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install
457     [ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install
458     [ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install
459 niro 3061
460     # add installer-server script
461     cat > ${CDCHROOTDIR}/usr/bin/installer-server << EOF
462     #!/bin/bash
463     /usr/bin/installer --imageroot /run/initramfs/live/server
464     EOF
465     chmod 0755 ${CDCHROOTDIR}/usr/bin/installer-server