diff --git a/OARiNZ/DIY/LiveCD/Makefile b/OARiNZ/DIY/LiveCD/Makefile index 7826142..ffa0774 100755 --- a/OARiNZ/DIY/LiveCD/Makefile +++ b/OARiNZ/DIY/LiveCD/Makefile @@ -16,7 +16,7 @@ # Miscellaneous files. REMOVE_FILES=${NEW_SQUASH}/etc/resolv.conf ${NEW_SQUASH}/etc/apt/apt.conf \ - ${NEW_SQUASH}/Makefile.chroot + ${NEW_SQUASH}/Makefile.chroot ${NEW_SQUASH}/usr/sbin/policy-rc.d # Commands locations. ECHO=/bin/echo @@ -28,6 +28,7 @@ MKDIR=/bin/mkdir SED=/bin/sed DD=/bin/dd +CHMOD=/bin/chmod .PHONY: filesystem squashfs iso cleanup @@ -86,8 +87,8 @@ @${ECHO} @${ECHO} "=== Initialising." @${SUDO} ${MOUNT} -o loop $< ${NEW_SQUASH} - ${SUDO} ${CP} /etc/resolv.conf ${NEW_SQUASH}/etc - ${SUDO} ${MOUNT} -t proc -o bind /proc ${NEW_SQUASH}/proc + ${SUDO} ${CP} -p /etc/resolv.conf ${NEW_SQUASH}/etc + ${SUDO} ${MOUNT} -t proc --bind /proc ${NEW_SQUASH}/proc @# Copy in cached .deb files to save on downloads and set up apt @# sources, etc. An appropriate sources.list can be generated @@ -95,24 +96,40 @@ @${ECHO} @${ECHO} "=== Setting up apt (takes about 10 seconds)." ${SUDO} ${CP} -a apt-cache/. ${NEW_SQUASH}/var/cache/apt/archives - ${SUDO} ${CP} /etc/apt/apt.conf ${NEW_SQUASH}/etc/apt - ${SUDO} ${CP} -b --suffix=.old sources.list ${NEW_SQUASH}/etc/apt + @# HACK: I've been having problems with the update servers. Since it + @# takes so long to get back to this point in the process, I've + @# cheated and pre-generated the various index files. Just drop 'em + @# in! They should be safe to leave there afterwards. + ${SUDO} ${CP} -a apt-lists/. ${NEW_SQUASH}/var/lib/apt/lists + ${SUDO} ${CP} -p /etc/apt/apt.conf ${NEW_SQUASH}/etc/apt + ${SUDO} ${CP} sources.list ${NEW_SQUASH}/etc/apt + @# The following stops the daemons from attempting to restart, which + @# will fail miserably in a chroot environment. Make sure to set the + @# permissions correctly, just in case they've been eaten by CVS or + @# something. + ${SUDO} ${CP} policy-rc.d ${NEW_SQUASH}/usr/sbin + ${SUDO} ${CHMOD} 755 ${NEW_SQUASH}/usr/sbin/policy-rc.d + @# Finally, preseed the debconf database so that we don't get asked + @# any annoying configuration questions during installs. + ${SUDO} ${CP} -a debconf-db/. ${NEW_SQUASH}/var/cache/debconf @# Chroot to the squashfs source filesystem and reconfigure - @# installed packages. + @# installed packages. Note that we need to stop Webmin for the + @# duration, otherwise installing Webmin in the chroot fails ("port + @# 10000 is already in use"). @${ECHO} @${ECHO} "=== Reconfiguring installed packages (takes about xx minutes)." + @${SUDO} /etc/init.d/webmin stop @${SUDO} ${CP} Makefile.chroot ${NEW_SQUASH} time ${SUDO} chroot ${NEW_SQUASH} /usr/bin/env HOME=/root LC_ALL=C \ - make -f Makefile.chroot + DEBIAN_FRONTEND=noninteractive make -f Makefile.chroot + @${SUDO} /etc/init.d/webmin start @# Clean up. @${ECHO} @${ECHO} "=== Cleaning up." ${SUDO} ${UMOUNT} ${NEW_SQUASH}/proc ${SUDO} ${RM} -f ${REMOVE_FILES} - ${SUDO} /bin/mv ${NEW_SQUASH}/etc/apt/sources.list.old \ - ${NEW_SQUASH}/etc/apt/sources.list ${SUDO} ${RM} -rf ${NEW_SQUASH}/tmp/* @# Update manifest and disk name. @@ -148,7 +165,7 @@ ${INSTANT_EPRINTS}_work.ext2: ${INSTANT_EPRINTS}.ext2 @${ECHO} @${ECHO} "=== Making working copy of original filesystem (takes about 2.5 minutes)." - time ${SUDO} ${CP} $< $@ + ${SUDO} ${CP} $< $@ # Build source filesystem. @@ -166,7 +183,7 @@ @${MKDIR} -p ${LIVECD} ${SUDO} ${RM} -rf ${LIVECD}/* ${CP} -a /cdrom/. ${LIVECD} - /bin/chmod -R u+w ${LIVECD} + ${CHMOD} -R u+w ${LIVECD} @${SUDO} ${UMOUNT} /cdrom @# Remove unnecessary Windows cruft.