2015-02-10 15:18:02 +00:00
|
|
|
#!/bin/bash -e
|
2014-04-24 13:42:18 +00:00
|
|
|
# vim: set ts=4 sw=4 sts=4 et :
|
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
source "${SCRIPTSDIR}/vars.sh"
|
|
|
|
source "${SCRIPTSDIR}/distribution.sh"
|
2014-10-14 16:02:12 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
##### "=========================================================================
|
|
|
|
debug " Configuring and Installing packages for ${DIST}"
|
|
|
|
##### "=========================================================================
|
2014-10-16 16:03:05 +00:00
|
|
|
|
2014-10-14 16:02:12 +00:00
|
|
|
# If .prepared_debootstrap has not been completed, don't continue
|
2015-02-10 15:18:02 +00:00
|
|
|
exitOnNoFile "${INSTALLDIR}/${TMPDIR}/.prepared_debootstrap" "prepared_debootstrap installataion has not completed!... Exiting"
|
2014-10-14 16:02:12 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
# Create system mount points
|
|
|
|
prepareChroot
|
2014-10-14 16:02:12 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
# Make sure there is a resolv.conf with network of this AppVM for building
|
|
|
|
createResolvConf
|
2014-04-24 13:42:18 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
# ==============================================================================
|
|
|
|
# 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)'
|
|
|
|
#### '----------------------------------------------------------------------
|
2014-10-16 16:03:05 +00:00
|
|
|
trap cleanup ERR
|
|
|
|
trap cleanup EXIT
|
2014-10-14 16:02:12 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
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"
|
2014-10-14 16:02:12 +00:00
|
|
|
fi
|
2014-04-24 13:42:18 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
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'
|
|
|
|
#### '----------------------------------------------------------------------
|
2014-10-22 20:37:26 +00:00
|
|
|
buildStep "$0" "packages_installed"
|
2014-10-14 16:02:12 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
info ' apt-get dist-upgrade'
|
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
aptDistUpgrade
|
2014-10-17 04:24:00 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
info ' Cleanup'
|
|
|
|
#### '----------------------------------------------------------------------
|
|
|
|
touch "${INSTALLDIR}/${TMPDIR}/.prepared_groups"
|
2014-10-14 16:02:12 +00:00
|
|
|
trap - ERR EXIT
|
|
|
|
trap
|
|
|
|
fi
|
2014-04-24 13:42:18 +00:00
|
|
|
|
2015-02-10 15:18:02 +00:00
|
|
|
# ==============================================================================
|
2014-10-22 20:37:26 +00:00
|
|
|
# Execute any template flavor or sub flavor 'post' scripts
|
2015-02-10 15:18:02 +00:00
|
|
|
# ==============================================================================
|
|
|
|
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
|