65 |
local systemdcmd |
local systemdcmd |
66 |
|
|
67 |
case ${cmd} in |
case ${cmd} in |
68 |
add|del|default) |
add|del|default|is-enabled) |
69 |
# add given services from profile |
# add given services from profile |
70 |
if [[ -n ${services} ]] |
if [[ -n ${services} ]] |
71 |
then |
then |
78 |
case ${cmd} in |
case ${cmd} in |
79 |
add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;; |
add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;; |
80 |
del) chroot ${CDCHROOTDIR} systemctl disable ${i} ;; |
del) chroot ${CDCHROOTDIR} systemctl disable ${i} ;; |
81 |
|
is-enabled) chroot ${CDCHROOTDIR} systemctl is-enabled ${i} ;; |
82 |
default) |
default) |
83 |
# convert targets |
# convert targets |
84 |
case ${i} in |
case ${i} in |
199 |
if [[ -z $(chroot ${CDCHROOTDIR} getent group lock) ]] |
if [[ -z $(chroot ${CDCHROOTDIR} getent group lock) ]] |
200 |
then |
then |
201 |
echo "adding missing group 'lock'" |
echo "adding missing group 'lock'" |
202 |
chroot ${CDCHROOTDIR} groupadd -g 54 lock |
chroot ${CDCHROOTDIR} /usr/lib/mage/mgroupadd -o "-g 54" lock |
203 |
fi |
fi |
204 |
# dbus plugdev group |
# dbus plugdev group |
205 |
if [[ -z $(chroot ${CDCHROOTDIR} getent group plugdev) ]] |
if [[ -z $(chroot ${CDCHROOTDIR} getent group plugdev) ]] |
206 |
then |
then |
207 |
echo "adding missing group 'plugdev'" |
echo "adding missing group 'plugdev'" |
208 |
chroot ${CDCHROOTDIR} groupadd -g 302 plugdev |
chroot ${CDCHROOTDIR} /usr/lib/mage/mgroupadd -o "-g 302" plugdev |
209 |
fi |
fi |
210 |
# dbus messagebus group |
# dbus messagebus group |
211 |
if [[ -z $(chroot ${CDCHROOTDIR} getent group messagebus) ]] |
if [[ -z $(chroot ${CDCHROOTDIR} getent group messagebus) ]] |
212 |
then |
then |
213 |
echo "adding missing group 'messagebus'" |
echo "adding missing group 'messagebus'" |
214 |
chroot ${CDCHROOTDIR} groupadd -g 300 messagebus |
chroot ${CDCHROOTDIR} /usr/lib/mage/mgroupadd -o "-g 300" messagebus |
215 |
fi |
fi |
216 |
# dbus messagebus user |
# dbus messagebus user |
217 |
if [[ -z $(chroot ${CDCHROOTDIR} getent passwd messagebus) ]] |
if [[ -z $(chroot ${CDCHROOTDIR} getent passwd messagebus) ]] |
218 |
then |
then |
219 |
echo "adding missing user 'messagebus'" |
echo "adding missing user 'messagebus'" |
220 |
chroot ${CDCHROOTDIR} useradd -u 300 -g messagebus -d /dev/null -s /bin/false messagebus |
chroot ${CDCHROOTDIR} /usr/lib/mage/museradd -o "-u 300 -g messagebus -d /dev/null -s /bin/false" messagebus |
221 |
fi |
fi |
222 |
fi |
fi |
223 |
install -m 0644 $(get_profile fstab) ${CDCHROOTDIR}/etc/fstab || die |
install -m 0644 $(get_profile fstab) ${CDCHROOTDIR}/etc/fstab || die |
254 |
then |
then |
255 |
install -m 0644 $(get_profile getty) ${CDCHROOTDIR}/etc/conf.d/getty || die |
install -m 0644 $(get_profile getty) ${CDCHROOTDIR}/etc/conf.d/getty || die |
256 |
|
|
257 |
custom_services add getty@.service |
custom_services add getty@tty1.service |
258 |
custom_services add remote-fs.target |
custom_services add remote-fs.target |
259 |
# disable readahead |
# disable readahead |
260 |
custom_services del systemd-readahead-replay.service |
custom_services is-enabled systemd-readahead-replay.service && custom_services del systemd-readahead-replay.service |
261 |
custom_services del systemd-readahead-collect.service |
custom_services is-enabled systemd-readahead-collect.service && custom_services del systemd-readahead-collect.service |
262 |
fi |
fi |
263 |
|
|
264 |
# # add hardware detection |
# # add hardware detection |
397 |
install ${ISOLINUX_BIN} ${CDISOROOT}/isolinux || die |
install ${ISOLINUX_BIN} ${CDISOROOT}/isolinux || die |
398 |
|
|
399 |
# kernel |
# kernel |
400 |
local kimg="$(basename $(readlink ${CDCHROOTDIR}/boot/vmlinuz))" |
# support kernel installations without symlinks |
401 |
|
if [ -L ${CDCHROOTDIR}/boot/vmlinuz ] |
402 |
|
then |
403 |
|
local kimg="$(basename $(readlink ${CDCHROOTDIR}/boot/vmlinuz))" |
404 |
|
else |
405 |
|
local kimg="$(find ${CDCHROOTDIR}/boot -name kernel-\* -printf '%f\n')" |
406 |
|
fi |
407 |
install ${CDCHROOTDIR}/boot/${kimg} ${CDISOROOT}/isolinux/${CDKERNELNAME} || die |
install ${CDCHROOTDIR}/boot/${kimg} ${CDISOROOT}/isolinux/${CDKERNELNAME} || die |
408 |
|
|
409 |
install -m 0644 $(get_profile isolinux.cfg) ${CDISOROOT}/isolinux || die |
install -m 0644 $(get_profile isolinux.cfg) ${CDISOROOT}/isolinux || die |
434 |
echo Generating initrd image ... |
echo Generating initrd image ... |
435 |
echo '#!/bin/bash' > ${CHROOTSH} || die |
echo '#!/bin/bash' > ${CHROOTSH} || die |
436 |
echo 'export LC_ALL=C' >> ${CHROOTSH} || die |
echo 'export LC_ALL=C' >> ${CHROOTSH} || die |
437 |
echo 'kv="$(readlink /boot/vmlinuz)"' >> ${CHROOTSH} || die |
# support kernel installations without symlinks |
438 |
echo 'kv="${kv/kernel-}/"' >> ${CHROOTSH} || die |
if [ -L ${CDCHROOTDIR}/boot/vmlinuz ] |
439 |
|
then |
440 |
|
echo 'kv="$(readlink /boot/vmlinuz)"' >> ${CHROOTSH} || die |
441 |
|
else |
442 |
|
echo "kv=\$(find /boot -name kernel-\* -printf '%f\n')" >> ${CHROOTSH} || die |
443 |
|
fi |
444 |
|
echo 'kv="${kv/kernel-/}"' >> ${CHROOTSH} || die |
445 |
# prefer dracut |
# prefer dracut |
446 |
echo 'if [[ -x /sbin/dracut ]] || [[ -x /usr/sbin/dracut ]] || [[ -x /usr/bin/dracut ]]' >> ${CHROOTSH} || die |
echo 'if [[ -x /sbin/dracut ]] || [[ -x /usr/sbin/dracut ]] || [[ -x /usr/bin/dracut ]]' >> ${CHROOTSH} || die |
447 |
echo 'then' >> ${CHROOTSH} || die |
echo 'then' >> ${CHROOTSH} || die |