qubes-linux-template-builder/scripts_debian/02_install_groups.sh
Jason Mehring 78a903b1f7 debian: Completely refactored Debian and Whonix
- New refactor allow qubuntu to share most of Debian's codebase
- Installation now more closely mimiks Debian's installation methods
- Added a shared functions lib named distributions.sh
- Any portions of Whonix that may need to be updatable have been moved
  to a new package named qubes-whonix which will be updatable via Debian
  package manager.  qubes-whonix is also added as part of installation
  process
2015-02-14 12:33:06 -05:00

85 lines
3.9 KiB
Bash
Executable File

#!/bin/bash -e
# vim: set ts=4 sw=4 sts=4 et :
source "${SCRIPTSDIR}/vars.sh"
source "${SCRIPTSDIR}/distribution.sh"
##### "=========================================================================
debug " Configuring and Installing packages for ${DIST}"
##### "=========================================================================
# If .prepared_debootstrap has not been completed, don't continue
exitOnNoFile "${INSTALLDIR}/${TMPDIR}/.prepared_debootstrap" "prepared_debootstrap installataion has not completed!... Exiting"
# Create system mount points
prepareChroot
# Make sure there is a resolv.conf with network of this AppVM for building
createResolvConf
# ==============================================================================
# Execute any template flavor or sub flavor 'pre' scripts
# ==============================================================================
buildStep "${0}" "pre"
# ==============================================================================
# Configure base system and install any adddtional packages which could
# include +TEMPLATE_FLAVOR such as gnome as set in configuration file
# ==============================================================================
if ! [ -f "${INSTALLDIR}/${TMPDIR}/.prepared_groups" ]; then
#### '----------------------------------------------------------------------
info ' Trap ERR and EXIT signals and cleanup (umount)'
#### '----------------------------------------------------------------------
trap cleanup ERR
trap cleanup EXIT
#### '----------------------------------------------------------------------
info 'Install standard Debian packages'
#### '----------------------------------------------------------------------
if ! [ -f "${INSTALLDIR}/${TMPDIR}/.debian_packages" ]; then
packages="$(chroot tasksel --new-install --task-packages standard)"
aptInstall ${packages}
touch "${INSTALLDIR}/${TMPDIR}/.debian_packages"
fi
#### '----------------------------------------------------------------------
info ' Distribution specific steps (install systemd, add sources, etc)'
#### '----------------------------------------------------------------------
buildStep "$0" "${DIST}"
#### '----------------------------------------------------------------------
info " Installing extra packages in script_${DIST}/packages.list file"
#### '----------------------------------------------------------------------
installPackages
createSnapshot "packages"
touch "${INSTALLDIR}/${TMPDIR}/.prepared_packages"
#### '----------------------------------------------------------------------
info ' Execute any template flavor or sub flavor scripts after packages are installed'
#### '----------------------------------------------------------------------
buildStep "$0" "packages_installed"
#### '----------------------------------------------------------------------
info ' apt-get dist-upgrade'
#### '----------------------------------------------------------------------
aptDistUpgrade
#### '----------------------------------------------------------------------
info ' Cleanup'
#### '----------------------------------------------------------------------
touch "${INSTALLDIR}/${TMPDIR}/.prepared_groups"
trap - ERR EXIT
trap
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)
# ==============================================================================
umount_all "${INSTALLDIR}/" || true