#!/bin/sh # vim: set ts=4 sw=4 sts=4 et : # ------------------------------------------------------------------------------ # Configurations # ------------------------------------------------------------------------------ set -x # ------------------------------------------------------------------------------ # Source external scripts # ------------------------------------------------------------------------------ . $SCRIPTSDIR/vars.sh . ./umount_kill.sh >/dev/null # ------------------------------------------------------------------------------ # If .prepared_groups has not been completed, don't continue # ------------------------------------------------------------------------------ if ! [ -f "$INSTALLDIR/tmp/.prepared_groups" ]; then echo "--> 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 custom pre configuration scripts # ------------------------------------------------------------------------------ customStep "$0" "pre" # ------------------------------------------------------------------------------ # Install Qubes Packages # ------------------------------------------------------------------------------ if ! [ -f "$INSTALLDIR/tmp/.prepared_qubes" ]; then echo "--> 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" < Generate locales" echo "en_US.UTF-8 UTF-8" >> "$INSTALLDIR/etc/locale.gen" chroot "$INSTALLDIR" locale-gen chroot "$INSTALLDIR" update-locale LANG=en_US.UTF-8 # -------------------------------------------------------------------------- # Update /etc/fstab # -------------------------------------------------------------------------- echo "--> Updating template fstab file..." cat >> "$INSTALLDIR/etc/fstab" < Installing qubes packages" export CUSTOMREPO="$PWD/yum_repo_qubes/$DIST" # -------------------------------------------------------------------------- # Install keyrings # -------------------------------------------------------------------------- if ! [ -e "$CACHEDIR/repo-secring.gpg" ]; then mkdir -p "$CACHEDIR" gpg --gen-key --batch < "$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 over any extra files that may be needed that are located in # $SCRIPT_DIR/extra-qubes-files # -------------------------------------------------------------------------- echo "-> Copy extra files..." copy_dirs "extra-qubes-files" touch "$INSTALLDIR/tmp/.prepared_qubes" fi # ------------------------------------------------------------------------------ # Execute any custom post configuration scripts # ------------------------------------------------------------------------------ customStep "$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/" || :