1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
|
|
# set an empty root password |
|
|
chroot ${CDCHROOTDIR} passwd -d root |
|
|
|
|
|
# install a custom boot-duration matching this livecd |
|
|
install -d ${CDCHROOTDIR}/var/lib/plymouth || die |
|
|
install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die |
|
|
|
|
|
# install mnt-cdrom mount service, should be provided by alxinstall-ng |
|
|
#install -m 0644 $(get_profile mnt-cdrom.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/mnt-cdrom.mount || die |
|
|
#ln -snf ../mnt-cdrom.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/mnt-cdrom.mount || die |
|
|
|
|
|
# disable splash X11 vt change and set splash to be always verbose |
|
|
#if [[ -f ${CDCHROOTDIR}/etc/splash/splash.conf ]] |
|
|
#then |
|
|
# sed -i -e 's:^\(SPLASH_X11_TTY=.*\):#\1:' \ |
|
|
# -e 's:^\(SPLASH_MODE=\).*:\1\"verbose\":' \ |
|
|
# ${CDCHROOTDIR}/etc/splash/splash.conf |
|
|
#fi |
|
|
|
|
|
# setup de keymap and locales |
|
|
if [ -f ${CDCHROOTDIR}/etc/vconsole.conf ] |
|
|
then |
|
|
cat > ${CDCHROOTDIR}/etc/vconsole.conf || die << EOF |
|
|
KEYMAP=de |
|
|
KEYMAP_TOGGLE= |
|
|
FONT=lat9w-16 |
|
|
FONT_MAP=8859-1_to_uni |
|
|
FONT_UNIMAP= |
|
|
EOF |
|
|
fi |
|
|
if [ -f ${CDCHROOTDIR}/etc/locale.conf ] |
|
|
then |
|
|
sed "s:^\(LANG=\).*:\1\"de_DE.utf8\":" ${CDCHROOTDIR}/etc/locale.conf || die |
|
|
fi |
|
|
|
|
|
# stop here if the user don't want to create the install tarball |
|
|
[[ ! -z ${SKIP_CREATE_INSTALL_TARBALL} ]] && exit 0 |
|
|
|
|
|
|
|
|
## |
|
|
# create the install tarball |
|
|
## |
|
|
|
|
|
install -d ${LIVECDROOT}/install-temp |
|
|
install -d ${CDISOROOT}/system |
|
|
|
|
|
# use all settings from the global config, but the basesystem |
|
|
# has to be the normal install basesystem not for livecds |
|
|
mage-bootstrap \ |
|
|
--root ${LIVECDROOT}/install-temp \ |
|
|
--profile ${MAGE_PROFILE} \ |
|
|
--magerc ${MAGERC} \ |
|
|
--toolchain ${TOOLCHAIN} \ |
|
|
--update-tarball \ |
|
|
--basesystem basesystem || die "bootstrapping target system failed!" |
|
|
|
|
|
# set an empty root password for the install system too |
|
|
chroot ${LIVECDROOT}/install-temp passwd -d root |
|
|
|
|
|
# add user station with empty password |
|
|
chroot ${LIVECDROOT}/install-temp adduser -G users -h /home/station -s /bin/bash -D station |
|
|
|
|
|
# install xinitrc |
|
|
echo 'exec startfluxbox' > ${LIVECDROOT}/install-temp/home/station/.xinitrc |
|
|
|
|
|
# fix hostname and hosts file |
|
|
echo "alx-i486" > ${LIVECDROOT}/install-temp/etc/hostname |
|
|
echo "127.0.0.1 localhost alx-i486.magellan-linux.de alx-i486" > ${LIVECDROOT}/install-temp/etc/hosts |
|
|
cat >> ${LIVECDROOT}/install-temp/etc/hosts << EOF |
|
|
::1 ip6-localhost ip6-loopback |
|
|
fe00::0 ip6-localnet |
|
|
ff00::0 ip6-mcastprefix |
|
|
ff02::1 ip6-allnodes |
|
|
ff02::2 ip6-allrouters |
|
|
ff02::3 ip6-allhosts |
|
|
EOF |
|
|
|
|
|
# create a default network interface config file |
|
|
cat > ${LIVECDROOT}/install-temp/etc/conf.d/net.eth0 << EOF |
|
|
ONBOOT="yes" |
|
|
NETWORKING="dhcp" |
|
|
EOF |
|
|
|
|
|
# fix mage.rc and config.rc |
|
3 |
updateconfig() |
updateconfig() |
4 |
{ |
{ |
5 |
local variables="$@" |
local variables="$@" |
25 |
fi |
fi |
26 |
done |
done |
27 |
} |
} |
|
NEW_SQL_USER="alx_install" |
|
|
NEW_SQL_PASS="@lx" |
|
|
NEW_SQL_HOST="128.20.41.110" |
|
|
NEW_SQL_DB="alx_web" |
|
|
NEW_SMB_UPDATE_HOST="//${NEW_SQL_HOST}/magetmp" |
|
|
NEW_SMB_UPDATE_USER="${NEW_SQL_USER}" |
|
|
NEW_SMB_UPDATE_PASS="${NEW_SQL_PASS}" |
|
|
NEW_MAGE_MIRRORS="http://${NEW_SQL_HOST}/magellan/alx-070" |
|
|
NEW_MAGE_RSYNC="rsync://${NEW_SQL_HOST}/mage-alx-070" |
|
|
NEW_RSYNC="${NEW_MAGE_RSYNC}" |
|
|
NEW_SMAGE2RSYNC="rsync://${NEW_SQL_HOST}/smage-alx-070" |
|
|
NEW_MIRRORS="${NEW_MAGE_MIRRORS}" |
|
|
NEW_MAGE_UNINSTALL_TIMEOUT="0" |
|
|
CONFIG="${LIVECDROOT}/install-temp/etc/mage.rc" |
|
|
updateconfig RSYNC SMAGE2RSYNC MIRRORS MAGE_UNINSTALL_TIMEOUT |
|
|
CONFIG="${LIVECDROOT}/install-temp/etc/alxconfig-ng/config.rc" |
|
|
updateconfig SQL_USER SQL_PASS SQL_HOST SQL_DB SMB_UPDATE_HOST SMB_UPDATE_USER SMB_UPDATE_PASS MAGE_MIRRORS MAGE_RSYNC |
|
|
|
|
|
# create tarball |
|
|
[[ -f ${CDISOROOT}/system/alx-i486.tar.bz2 ]] && rm ${CDISOROOT}/system/alx-i486.tar.bz2 |
|
|
( cd ${LIVECDROOT}/install-temp; tar cvjpf ${CDISOROOT}/system/alx-i486.tar.bz2 ./ | tee log) |
|
|
|
|
|
# create images.conf |
|
|
echo "CDIMAGENAME=alx-i486.tar.bz2" > ${CDISOROOT}/system/images.conf |
|
|
echo "TOTALLINES=$(wc -l ${LIVECDROOT}/install-temp/log | cut -d' ' -f1)" >> ${CDISOROOT}/system/images.conf |
|
28 |
|
|
29 |
# clean up |
# prepare_custom_baseconfig $_OSROOT $_OSHOSTNAME $_OSHOSTDOMAIN |
30 |
if [[ -d ${LIVECDROOT}/install-temp ]] |
prepare_custom_baseconfig() |
31 |
|
{ |
32 |
|
local _OSROOT="$1" |
33 |
|
local _OSHOSTNAME="$2" |
34 |
|
local _OSHOSTDOMAIN="$3" |
35 |
|
if [[ -z ${_OSROOT} ]] |
36 |
|
then |
37 |
|
echo "no _OSROOT given" |
38 |
|
return 1 |
39 |
|
fi |
40 |
|
if [[ ! -d ${_OSROOT} ]] |
41 |
|
then |
42 |
|
echo "Root dir '${_OSROOT}' does not exist" |
43 |
|
return 1 |
44 |
|
fi |
45 |
|
if [[ -z ${_OSHOSTNAME} ]] |
46 |
|
then |
47 |
|
echo "no _OSHOSTNAME given" |
48 |
|
return 1 |
49 |
|
fi |
50 |
|
if [[ -z ${_OSHOSTDOMAIN} ]] |
51 |
|
then |
52 |
|
echo "no _OSHOSTDOMAIN given" |
53 |
|
return 1 |
54 |
|
fi |
55 |
|
|
56 |
|
# generate a new machine-id on first-boot |
57 |
|
:> ${_OSROOT}/etc/machine-id |
58 |
|
|
59 |
|
# fix localtime symlink |
60 |
|
ln -snf ../usr/share/zoneinfo/Europe/Berlin ${_OSROOT}/etc/localtime |
61 |
|
|
62 |
|
# activate timeserver via dhcp (NTP - option 42) |
63 |
|
CDCHROOTDIR=${_OSROOT} custom_services add systemd-timesyncd.service |
64 |
|
|
65 |
|
# empty root password |
66 |
|
chroot ${_OSROOT} passwd -d root |
67 |
|
|
68 |
|
# empty user password |
69 |
|
chroot ${_OSROOT} passwd -d station |
70 |
|
|
71 |
|
if [ -x ${_OSROOT}/usr/bin/mcorepasswd ] || |
72 |
|
[ -L ${_OSROOT}/usr/bin/mcorepasswd ] |
73 |
|
then |
74 |
|
# add mcored default user |
75 |
|
( echo "foobar"; sleep 0.1; echo "foobar" ) | chroot ${_OSROOT} /usr/bin/mcorepasswd mcore |
76 |
|
fi |
77 |
|
|
78 |
|
# fix hostname and hosts file |
79 |
|
echo "${_OSHOSTNAME}" > ${_OSROOT}/etc/hostname |
80 |
|
echo "127.0.0.1 localhost ${_OSHOSTNAME}.${_OSHOSTDOMAIN} ${_OSHOSTNAME}" > ${_OSROOT}/etc/hosts |
81 |
|
cat >> ${_OSROOT}/etc/hosts << EOF |
82 |
|
::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 |
|
} |
90 |
|
|
91 |
|
# 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 |
|
# create tarball |
119 |
|
[[ -f ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ]] && rm ${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 |
120 |
|
( cd ${_OSROOT}; tar cvjpf ${CDISOROOT}/${_TARBALLTARGET}/${_TARBALLNAME}.tar.bz2 ./ | tee ${LIVECDROOT}/${_TARBALLNAME}.log ) |
121 |
|
|
122 |
|
# create images.conf |
123 |
|
echo "CDIMAGENAME=${_TARBALLNAME}.tar.bz2" > ${_TARBALLTARGET}/images.conf |
124 |
|
echo "TOTALLINES=$(wc -l ${LIVECDROOT}/${_TARBALLNAME}.log | cut -d' ' -f1)" >> ${_TARBALLTARGET}/images.conf |
125 |
|
|
126 |
|
# clean up |
127 |
|
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
128 |
|
then |
129 |
|
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 |
|
fi |
138 |
|
} |
139 |
|
|
140 |
|
## |
141 |
|
# create the install tarball |
142 |
|
## |
143 |
|
create_install_tarball() |
144 |
|
{ |
145 |
|
install -d ${LIVECDROOT}/install-chroot |
146 |
|
install -d ${CDISOROOT}/system |
147 |
|
|
148 |
|
# use all settings from the global config, but the basesystem |
149 |
|
# has to be the normal install basesystem not for livecds |
150 |
|
mage-bootstrap \ |
151 |
|
--root ${LIVECDROOT}/install-chroot \ |
152 |
|
--profile ${MAGE_PROFILE} \ |
153 |
|
--magerc ${MAGERC} \ |
154 |
|
--toolchain ${TOOLCHAIN} \ |
155 |
|
--update-tarball \ |
156 |
|
--basesystem basesystem || die "bootstrapping target system failed!" |
157 |
|
|
158 |
|
## DEV SERVER ## |
159 |
|
# NEW_MCORE_CONTROL_SERVER="alx-control-dev.dom-aka-nt.intern" |
160 |
|
# CONFIG="${LIVECDROOT}/install-chroot/etc/mcore/mcore.conf" |
161 |
|
# updateconfig MCORE_CONTROL_SERVER |
162 |
|
### |
163 |
|
|
164 |
|
# fix missing symlink |
165 |
|
if [ ! -L ${LIVECDROOT}/install-chroot/usr/bin/X ] |
166 |
|
then |
167 |
|
ln -snf Xorg ${LIVECDROOT}/install-chroot/usr/bin/X |
168 |
|
fi |
169 |
|
|
170 |
|
# os config |
171 |
|
prepare_custom_baseconfig "${LIVECDROOT}/install-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
172 |
|
|
173 |
|
# create tarball |
174 |
|
prepare_custom_installertarball "${LIVECDROOT}/install-chroot" "alx-${CDOSARCH}" "${CDISOROOT}/system" |
175 |
|
} |
176 |
|
|
177 |
|
## |
178 |
|
# create the network image |
179 |
|
## |
180 |
|
create_netboot_image() |
181 |
|
{ |
182 |
|
install -d ${CDISOROOT}/netboot |
183 |
|
install -d ${LIVECDROOT}/netboot-chroot |
184 |
|
install -d ${LIVECDROOT}/network-squashfs-temp |
185 |
|
|
186 |
|
# use all settings from the global config, but use netbootsysten as basesystem |
187 |
|
mage-bootstrap \ |
188 |
|
--root ${LIVECDROOT}/netboot-chroot \ |
189 |
|
--profile ${MAGE_PROFILE} \ |
190 |
|
--magerc ${MAGERC} \ |
191 |
|
--toolchain ${TOOLCHAIN} \ |
192 |
|
--update-tarball \ |
193 |
|
--basesystem netbootsystem || die "bootstrapping target system failed!" |
194 |
|
|
195 |
|
# os config |
196 |
|
prepare_custom_baseconfig "${LIVECDROOT}/netboot-chroot" "alx-${CDOSARCH}" "magellan-linux.de" |
197 |
|
|
198 |
|
# creating netboot image from here on |
199 |
|
install -d ${LIVECDROOT}/network-squashfs-temp/{LiveOS,mnt} || die |
200 |
|
|
201 |
|
# fix fstab, use the livecd fstab without rootfs and swap |
202 |
|
install -m 0644 $(get_profile fstab) ${LIVECDROOT}/netboot-chroot/etc/fstab || die |
203 |
|
|
204 |
|
# get the actual size of the chroot |
205 |
|
size=$(du -s ${LIVECDROOT}/netboot-chroot | sed 's:^\(.*\)[[:space:]].*:\1:') |
206 |
|
|
207 |
|
# generate a ext3fs file for devicemapper |
208 |
|
dd if=/dev/zero of=${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img bs=1024 count=$(( ${size} + 20000 )) || die |
209 |
|
# create a filesystem |
210 |
|
mkfs.ext3 -L "_${CDID}_EXT3" -m 1 -b 1024 -F ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
211 |
|
# set mount_counts and check_intervals to 0 |
212 |
|
# set dir_index top, to speed up things with hashed b-trees |
213 |
|
# allow acls too |
214 |
|
tune2fs -c0 -i0 -Odir_index -ouser_xattr,acl ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
215 |
|
# strip the journal |
216 |
|
# tune2fs -O^has_journal ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
217 |
|
# fsck after journal removal |
218 |
|
# fsck ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
219 |
|
|
220 |
|
# losetup the device |
221 |
|
loopdev=$(losetup -f) |
222 |
|
[[ -z ${loopdev} ]] && die "No unused loopdev found. Maybe you want 'modprobe loop'?" |
223 |
|
|
224 |
|
# mount the image |
225 |
|
losetup ${loopdev} ${LIVECDROOT}/network-squashfs-temp/LiveOS/ext3fs.img || die |
226 |
|
mount ${loopdev} ${LIVECDROOT}/network-squashfs-temp/mnt || die |
227 |
|
|
228 |
|
# copy everything to the image file and preserve permissions |
229 |
|
( cd ${LIVECDROOT}/netboot-chroot && tar cpf - . ) | ( cd ${LIVECDROOT}/network-squashfs-temp/mnt && tar xvpf - ) |
230 |
|
sleep 3 |
231 |
|
|
232 |
|
# now umount everything and create the squashfs image |
233 |
|
umount ${LIVECDROOT}/network-squashfs-temp/mnt || die |
234 |
|
losetup -d ${loopdev} || die |
235 |
|
# remove mount to not ending up in the squashfs image |
236 |
|
if [[ -d ${LIVECDROOT}/network-squashfs-temp/mnt ]] |
237 |
|
then |
238 |
|
rm -r ${LIVECDROOT}/network-squashfs-temp/mnt || die |
239 |
|
fi |
240 |
|
mksquashfs ${LIVECDROOT}/network-squashfs-temp ${CDISOROOT}/netboot/squashfs.img || die |
241 |
|
|
242 |
|
# copy kernel, bootloader and create initramfs to isoroot/netboot |
243 |
|
install -d ${CDISOROOT}/netboot || die |
244 |
|
# kernel |
245 |
|
kimg="$(find ${CDCHROOTDIR}/boot -name kernel-\* -printf '%f\n')" |
246 |
|
install ${CDCHROOTDIR}/boot/${kimg} ${CDISOROOT}/netboot/${CDKERNELNAME} || die |
247 |
|
# initrd |
248 |
|
install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die |
249 |
|
echo 'add_dracutmodules+=" livenet busybox "' > ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
250 |
|
echo 'omit_dracutmodules+=" mcored "' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
251 |
|
echo 'hostonly="no"' >> ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf || die |
252 |
|
# install dracut-dev package to have all modules |
253 |
|
custom_packages install "dracut-dev curl curl-dev" || die |
254 |
|
## mlivecdbuild function |
255 |
|
generate_initrd |
256 |
|
mv ${CDISOROOT}/isolinux/initrd.gz ${CDISOROOT}/netboot/ || die |
257 |
|
# fix initrd permissions |
258 |
|
chmod 0644 ${CDISOROOT}/netboot/initrd.gz || die |
259 |
|
if [ -e ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf ] |
260 |
|
then |
261 |
|
rm ${CDCHROOTDIR}/etc/dracut.conf.d/03-netboot.conf |
262 |
|
fi |
263 |
|
# bootloader pxelinux |
264 |
|
install -d ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg |
265 |
|
[ -f $(get_profile netboot/pxelinux.0) ] && install -m0644 $(get_profile netboot/pxelinux.0) ${CDISOROOT}/netboot/pxelinux/ |
266 |
|
[ -f $(get_profile netboot/pxelinux.cfg/pxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/pxelinux-default) ${CDISOROOT}/netboot/pxelinux/pxelinux.cfg |
267 |
|
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/pxelinux/ |
268 |
|
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/pxelinux/ |
269 |
|
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/pxelinux/ |
270 |
|
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/pxelinux/ |
271 |
|
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/pxelinux/ |
272 |
|
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/pxelinux/ |
273 |
|
# bootloader lpxelinux |
274 |
|
install -d ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg |
275 |
|
[ -f $(get_profile netboot/lpxelinux.0) ] && install -m0644 $(get_profile netboot/lpxelinux.0) ${CDISOROOT}/netboot/lpxelinux/ |
276 |
|
[ -f $(get_profile netboot/ldlinux.c32) ] && install -m0644 $(get_profile netboot/ldlinux.c32) ${CDISOROOT}/netboot/lpxelinux/ |
277 |
|
[ -f $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/lpxelinux-default) ${CDISOROOT}/netboot/lpxelinux/pxelinux.cfg |
278 |
|
[ -f $(get_profile netboot/pxelinux.cfg/boot.cat) ] && install -m0644 $(get_profile netboot/pxelinux.cfg/boot.cat) ${CDISOROOT}/netboot/lpxelinux/ |
279 |
|
[ -f $(get_profile boot.lss) ] && install -m0644 $(get_profile boot.lss) ${CDISOROOT}/netboot/lpxelinux/ |
280 |
|
[ -f $(get_profile boot.msg) ] && install -m0644 $(get_profile boot.msg) ${CDISOROOT}/netboot/lpxelinux/ |
281 |
|
[ -f $(get_profile debug.msg) ] && install -m0644 $(get_profile debug.msg) ${CDISOROOT}/netboot/lpxelinux/ |
282 |
|
[ -f $(get_profile help.msg) ] && install -m0644 $(get_profile help.msg) ${CDISOROOT}/netboot/lpxelinux/ |
283 |
|
[ -f $(get_profile index.msg) ] && install -m0644 $(get_profile index.msg) ${CDISOROOT}/netboot/lpxelinux/ |
284 |
|
|
285 |
|
# final cleanup |
286 |
|
if [[ -z ${SKIP_REMOVE_INSTALLROOT} ]] |
287 |
|
then |
288 |
|
if [[ -d ${LIVECDROOT}/network-squasfs-temp ]] |
289 |
|
then |
290 |
|
rm -r ${LIVECDROOT}/network-squasfs-temp || die |
291 |
|
fi |
292 |
|
if [[ -d ${LIVECDROOT}/netboot-chroot ]] |
293 |
|
then |
294 |
|
rm -r ${LIVECDROOT}/netboot-chroot |
295 |
|
fi |
296 |
|
fi |
297 |
|
} |
298 |
|
|
299 |
|
## |
300 |
|
# create the server tarball |
301 |
|
## |
302 |
|
create_server_tarball() |
303 |
|
{ |
304 |
|
install -d ${LIVECDROOT}/server-chroot |
305 |
|
install -d ${CDISOROOT}/server |
306 |
|
|
307 |
|
mage-bootstrap \ |
308 |
|
--root ${LIVECDROOT}/server-chroot \ |
309 |
|
--profile ${MAGE_PROFILE} \ |
310 |
|
--magerc ${MAGERC} \ |
311 |
|
--toolchain ${TOOLCHAIN} \ |
312 |
|
--update-tarball \ |
313 |
|
--basesystem serversystem || die "bootstrapping target system failed!" |
314 |
|
|
315 |
|
|
316 |
|
# enable getty1 |
317 |
|
install -d ${LIVECDROOT}/server-chroot/etc/systemd/system/getty.target.wants |
318 |
|
ln -snf /usr/lib/systemd/system/getty@.service ${LIVECDROOT}/server-chroot/etc/systemd/system/getty.target.wants/getty@tty1.service |
319 |
|
|
320 |
|
# be more verbose |
321 |
|
sed -i 's:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1"rd.info":' ${LIVECDROOT}/server-chroot/etc/conf.d/grub |
322 |
|
|
323 |
|
# remove phpmyadmin configuration directory |
324 |
|
if [ -d ${LIVECDROOT}/server-chroot/usr/share/phpmyadmin/config ] |
325 |
|
then |
326 |
|
rm -r ${LIVECDROOT}/server-chroot/usr/share/phpmyadmin/config |
327 |
|
fi |
328 |
|
|
329 |
|
# os config |
330 |
|
prepare_custom_baseconfig "${LIVECDROOT}/server-chroot" "alx-svr-${CDOSARCH}" "magellan-linux.de" |
331 |
|
|
332 |
|
# fix certificate issues with mcored (common name of cert issuer) and >php-5.4 |
333 |
|
echo "127.0.0.1 mcored" >> ${LIVECDROOT}/server-chroot/etc/hosts |
334 |
|
|
335 |
|
# create tarball |
336 |
|
prepare_custom_installertarball "${LIVECDROOT}/server-chroot" "alx-svr-${CDOSARCH}" "${CDISOROOT}/server" |
337 |
|
} |
338 |
|
|
339 |
|
# set an empty root password |
340 |
|
chroot ${CDCHROOTDIR} passwd -d root |
341 |
|
|
342 |
|
# install a custom boot-duration matching this livecd |
343 |
|
install -d ${CDCHROOTDIR}/var/lib/plymouth || die |
344 |
|
install -m 0644 $(get_profile boot-duration.livecd) ${CDCHROOTDIR}/var/lib/plymouth/boot-duration || die |
345 |
|
|
346 |
|
# setup de keymap and locales |
347 |
|
if [ -f ${CDCHROOTDIR}/etc/vconsole.conf ] |
348 |
|
then |
349 |
|
cat > ${CDCHROOTDIR}/etc/vconsole.conf << EOF || die |
350 |
|
KEYMAP=de |
351 |
|
KEYMAP_TOGGLE= |
352 |
|
FONT=lat9w-16 |
353 |
|
FONT_MAP=8859-1_to_uni |
354 |
|
FONT_UNIMAP= |
355 |
|
EOF |
356 |
|
fi |
357 |
|
if [ -f ${CDCHROOTDIR}/etc/locale.conf ] |
358 |
then |
then |
359 |
rm -rf ${LIVECDROOT}/install-temp |
sed -i "s:^\(LANG=\).*:\1\"de_DE.utf8\":" ${CDCHROOTDIR}/etc/locale.conf || die |
360 |
fi |
fi |
361 |
|
|
362 |
|
# stop here if the user don't want to create the install tarball |
363 |
|
[[ -n ${SKIP_CREATE_INSTALL_TARBALL} ]] || create_install_tarball |
364 |
|
|
365 |
|
# stop here if the user don't want to create the netboot image |
366 |
|
[[ -n ${SKIP_CREATE_NETBOOT_TARBALL} ]] || create_netboot_image |
367 |
|
|
368 |
|
# stop here if the user don't want to create the server tarball |
369 |
|
[[ -n ${SKIP_CREATE_SERVER_TARBALL} ]] || create_server_tarball |
370 |
|
|
371 |
# install usb-install script |
# install usb-install script |
372 |
[ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install |
[ ! -d ${CDISOROOT}/usb-install ] && mkdir ${CDISOROOT}/usb-install |
373 |
[ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install |
[ -f $(get_profile usb-install/usb-install.cmd) ] && cp $(get_profile usb-install)/usb-install.cmd ${CDISOROOT}/usb-install |
374 |
[ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install |
[ -f $(get_profile usb-install/syslinux.exe) ] && cp $(get_profile usb-install)/syslinux.exe ${CDISOROOT}/usb-install |
375 |
[ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install |
[ -f $(get_profile usb-install/syslinux.cfg) ] && cp $(get_profile usb-install)/syslinux.cfg ${CDISOROOT}/usb-install |
376 |
|
|
377 |
|
# add installer-server script |
378 |
|
cat > ${CDCHROOTDIR}/usr/bin/installer-server << EOF |
379 |
|
#!/bin/bash |
380 |
|
/usr/bin/installer --imageroot /run/initramfs/live/server |
381 |
|
EOF |
382 |
|
chmod 0755 ${CDCHROOTDIR}/usr/bin/installer-server |