--- trunk/mlivecdbuild/mlivecdbuild2.sh 2011/11/04 11:34:30 1531 +++ trunk/mlivecdbuild/mlivecdbuild2.sh 2012/05/29 11:08:26 1821 @@ -72,7 +72,7 @@ for i in ${services} do # systemd - if [[ -x ${CDCHROOTDIR}/sbin/systemctl ]] + if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]] then case ${cmd} in add) chroot ${CDCHROOTDIR} systemctl enable ${i} ;; @@ -80,14 +80,14 @@ default) # convert targets case ${i} in - 2|3) service="multi-user.target" ;; - 5) service="graphical.target" ;; + 2|3|multi-user) service="multi-user.target" ;; + 5|graphical) service="graphical.target" ;; esac chroot ${CDCHROOTDIR} systemctl enable ${i} ;; esac fi # busybox and sysvinit - if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] + if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] && [[ ! -x ${CDCHROOTDIR}/bin/systemctl ]] && [[ ! -x ${CDCHROOTDIR}/usr/bin/systemctl ]] then MROOT="${CDCHROOTDIR}" rc-config ${cmd} ${i} || die "rc ${cmd} ${i}" fi @@ -168,19 +168,30 @@ echo Preparing LiveCD ISO Image ... # fixes some issues with xfree/xorg xkb - if [[ -L ${CDCHROOTDIR}/etc/X11/xkb ]] && [[ -d /usr/X11R6/lib/X11/xkb ]] + if [[ -L ${CDCHROOTDIR}/etc/X11/xkb ]] && + [[ -d ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb ]] then rm ${CDCHROOTDIR}/etc/X11/xkb || die mv ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb ${CDCHROOTDIR}/etc/X11 || die ln -s ../../../../etc/X11/xkb ${CDCHROOTDIR}/usr/X11R6/lib/X11/xkb || die fi + # fix issues with >=dracut-014 which drops some default modules like livecd + if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]] + then + install -d ${CDCHROOTDIR}/etc/dracut.conf.d || die + echo 'add_dracutmodules+=" dmsquash-live "' \ + > ${CDCHROOTDIR}/etc/dracut.conf.d/02-livecd.conf || die + fi + # only on sysvinit or busybox systems if [[ -x ${CDCHROOTDIR}/sbin/rc-config ]] then install -m 0644 $(get_profile inittab) ${CDCHROOTDIR}/etc/inittab || die fi - if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] + if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]] then # check lock group on systemd systems if [[ -z $(chroot ${CDCHROOTDIR} getent group lock) ]] @@ -212,6 +223,7 @@ install -m 0644 $(get_profile issue) ${CDCHROOTDIR}/etc/issue || die install -m 0644 $(get_profile net.eth0) ${CDCHROOTDIR}/etc/conf.d/net.eth0 || die echo "${CDHOSTNAME}" > ${CDCHROOTDIR}/etc/hostname || die + install -d ${CDCHROOTDIR}/mnt/magellan || die echo Setting up services ... @@ -224,7 +236,20 @@ # enable them ln -snf ../tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/tmp.mount || die ln -snf ../var-tmp.mount ${CDCHROOTDIR}/lib/systemd/system/local-fs.target.wants/var-tmp.mount || die + fi + # newer systemd goes to /usr/lib + if [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]] + then + # install tmpfs /tmp and /var/tmp + install -m 0644 $(get_profile tmp.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/ || die + install -m 0644 $(get_profile var-tmp.mount) ${CDCHROOTDIR}/usr/lib/systemd/system/ || die + # enable them + ln -snf ../tmp.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/tmp.mount || die + ln -snf ../var-tmp.mount ${CDCHROOTDIR}/usr/lib/systemd/system/local-fs.target.wants/var-tmp.mount || die + fi + if [[ -x ${CDCHROOTDIR}/bin/systemctl ]] || [[ -x ${CDCHROOTDIR}/usr/bin/systemctl ]] + then install -m 0644 $(get_profile getty) ${CDCHROOTDIR}/etc/conf.d/getty || die custom_services add getty@.service @@ -299,7 +324,9 @@ fi echo Generating squashfs compressed rootfs loopfile ... - if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] + if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]] then install -d ${LIVECDROOT}/loop/{LiveOS,mnt} || die @@ -347,7 +374,9 @@ echo Moving rootfs loopfile to isoroot ... install -d ${CDISOROOT} - if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] + if [[ -x ${CDCHROOTDIR}/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/sbin/dracut ]] || + [[ -x ${CDCHROOTDIR}/usr/bin/dracut ]] then install -d ${CDISOROOT}/LiveOS mv ${LIVECDROOT}/livecdrootfs.sqsh ${CDISOROOT}/LiveOS/squashfs.img @@ -399,7 +428,7 @@ echo 'kv="$(readlink /boot/vmlinuz)"' >> ${CHROOTSH} || die echo 'kv="${kv/kernel-}/"' >> ${CHROOTSH} || die # prefer dracut - echo 'if [[ -x /sbin/dracut ]]' >> ${CHROOTSH} || die + echo 'if [[ -x /sbin/dracut ]] || [[ -x /usr/sbin/dracut ]] || [[ -x /usr/bin/dracut ]]' >> ${CHROOTSH} || die echo 'then' >> ${CHROOTSH} || die echo ' dracut -v -f /initrd.gz ${kv}' >> ${CHROOTSH} || die echo 'else' >> ${CHROOTSH} || die