#!/bin/sh # vim: set ts=4 sw=4 sts=4 et : # ------------------------------------------------------------------------------ # Source external scripts # ------------------------------------------------------------------------------ . ${SCRIPTSDIR}/vars.sh . ./umount_kill.sh >/dev/null # ------------------------------------------------------------------------------ # Configurations # ------------------------------------------------------------------------------ if [ "${VERBOSE}" -ge 2 -o "${DEBUG}" == "1" ]; then set -x else set -e fi # ------------------------------------------------------------------------------ # If .prepared_groups has not been completed, don't continue # ------------------------------------------------------------------------------ if ! [ -f "${INSTALLDIR}/tmp/.prepared_groups" ]; then error "prepared_groups installataion has not completed!... Exiting" exit 1 fi # ------------------------------------------------------------------------------ # Mount system mount points # ------------------------------------------------------------------------------ for fs in /dev /dev/pts /proc /sys /run; do mount -B $fs "${INSTALLDIR}/$fs"; done # ------------------------------------------------------------------------------ # Execute any template flavor or sub flavor 'pre' scripts # ------------------------------------------------------------------------------ buildStep "$0" "pre" # ------------------------------------------------------------------------------ # Install Qubes Packages # ------------------------------------------------------------------------------ if ! [ -f "${INSTALLDIR}/tmp/.prepared_qubes" ]; then debug "Installing qbues modules" # -------------------------------------------------------------------------- # Set up a temporary policy-rc.d to prevent apt from starting services # on package installation # -------------------------------------------------------------------------- cat > "${INSTALLCHROOT}/usr/sbin/policy-rc.d" <> "${INSTALLDIR}/etc/locale.gen" chroot "${INSTALLDIR}" locale-gen chroot "${INSTALLDIR}" update-locale LANG=en_US.UTF-8 # # -------------------------------------------------------------------------- # # Update /etc/fstab # # -------------------------------------------------------------------------- # #debug "Updating template fstab file..." # #cat >> "${INSTALLDIR}/etc/fstab" < "${INSTALLDIR}/etc/apt/sources.list.d/qubes-builder.list" </dev/null 2>&1; then # : # else # chroot "${INSTALLDIR}" groupadd -f user # chroot "${INSTALLDIR}" useradd -g user -G dialout,cdrom,floppy,sudo,audio,dip,video,plugdev -m -s /bin/bash user # fi # # -------------------------------------------------------------------------- # # Modules setup # # -------------------------------------------------------------------------- # echo "xen_netfront" >> "${INSTALLDIR}/etc/modules" # # -------------------------------------------------------------------------- # # Remove `mesg` from root/.profile? # # -------------------------------------------------------------------------- # sed -i -e '/^mesg n/d' "${INSTALLDIR}/root/.profile" # # -------------------------------------------------------------------------- # # Need a xen log directory or xen scripts will fail # # -------------------------------------------------------------------------- # mkdir -p -m 0700 "${INSTALLDIR}/var/log/xen" # -------------------------------------------------------------------------- # Copy extra files to installation directory. Contains: # - font fixes for display issues # -------------------------------------------------------------------------- copyTree "qubes-files" "${SCRIPTSDIR}" "${INSTALLDIR}" # # -------------------------------------------------------------------------- # # Looks like hosts file may contain tabs and qubes will not parse it # # correctly # # -------------------------------------------------------------------------- # expand "${INSTALLDIR}/etc/hosts" > "${INSTALLDIR}/etc/hosts.dist" # mv "${INSTALLDIR}/etc/hosts.dist" "${INSTALLDIR}/etc/hosts" touch "${INSTALLDIR}/tmp/.prepared_qubes" fi # ------------------------------------------------------------------------------ # Execute any template flavor or sub flavor 'post' scripts # ------------------------------------------------------------------------------ buildStep "$0" "post" # ------------------------------------------------------------------------------ # Kill all processes and umount all mounts within ${INSTALLDIR}, but not # ${INSTALLDIR} itself (extra '/' prevents ${INSTALLDIR} from being umounted itself) # ------------------------------------------------------------------------------ umount_kill "${INSTALLDIR}/" || :