| |
---|
| | NEW_SQUASH=new-squashfs |
---|
| | |
---|
| | # 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 |
---|
| | SUDO=/usr/bin/sudo |
---|
| |
---|
| | UMOUNT=/bin/umount |
---|
| | MKDIR=/bin/mkdir |
---|
| | SED=/bin/sed |
---|
| | DD=/bin/dd |
---|
| | CHMOD=/bin/chmod |
---|
| | |
---|
| | |
---|
| | .PHONY: filesystem squashfs iso cleanup |
---|
| | |
---|
| |
---|
| | @# Mount squashfs source filesystem and set up work environment. |
---|
| | @${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 |
---|
| | @# using the utility at http://www.ubuntu-nl.org/source-o-matic/. |
---|
| | @${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. |
---|
| | @${ECHO} |
---|
| |
---|
| | |
---|
| | ${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. |
---|
| | |
---|
| |
---|
| | @${SUDO} ${MOUNT} -t iso9660 -o loop $< /cdrom |
---|
| | @${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. |
---|
| | @${ECHO} |
---|
| |
---|