Codebase list debian-edu-install / HEAD pre-pkgsel
HEAD

Tree @HEAD (Download .tar.gz)

pre-pkgsel @HEADraw · history · blame

#!/bin/sh

set -e

#export DEBCONF_DEBUG='developer'
. /usr/share/debconf/confmodule
. /lib/debian-edu-common

log() {
    logger -t edu-pre-pkgsel "info: $*"
}

error() {
    logger -t edu-pre-pkgsel "error: $*"
}

report_fatal_error() {
    template=debian-edu-install/errors-pkg-installation
    db_subst $template PACKAGES "$p"
    db_fset $template seen false
    db_capb "" # Disable "Go Back" button
    db_settitle $template-title
    db_input critical $template || [ $? -eq 30 ]
    db_go
    db_capb backup
    reboot
}

at_exit() {
    error "script $0 terminated unexpectedly."
    report_fatal_error "unexpected exit"
}
disable_exception() { trap - INT TERM EXIT; }
trap at_exit INT TERM EXIT

# Install required packages, report fatal error and reboot if it fail.
install_required_pkg() {
    p="$1"
    log "installing package $p"
    if apt-install --allow-remove --with-recommends $p ; then
	:
    else
	report_fatal_error "$p"
    fi
}

load_proxy_conf

db_get debian-edu-install/quick-install
if [ true = "$RET" ] ; then
    edu-eatmydata-install enable
else
    log "not enabling quick install, preseed debian-edu-install/quick-install=true to change this."
fi

# Initialize etckeeper early
edu-etcvcs init

db_get debian-edu-install/profile
PROFILE="$RET"

db_get debian-installer/language
LANGCODE="$RET"

db_get debian-installer/locale
LOCALE="$RET"

if [ ! -d /target/etc/debian-edu ] ; then
    if mkdir /target/etc/debian-edu ; then
        :
    else
        error "unable to create /target/etc/debian-edu"
    fi
fi

# get the current version
VERSION="$(cat /usr/lib/debian-edu-install/version || true)"
if [ -z "$VERSION" ] ; then
    error "missing /usr/lib/debian-edu-install/version, incomplete /etc/debian-edu/config created."
fi

(
    echo "# Generated by debian-edu-profile-udeb"
    echo "VERSION=\"$VERSION\""
    echo "PROFILE=\"$PROFILE\""
    echo "LANGCODE=\"$LANGCODE\""
    echo "LOCALE=\"$LOCALE\""
) >> /target/etc/debian-edu/config

if edu-is-testinstall ; then
    echo "TESTINSTALL=\"true\"" >> /target/etc/debian-edu/config
fi

edu-etcvcs commit

log "asking for a few extra packages to be installed"

# education tasksel tasks
install_required_pkg education-tasks

# the debian-edu preseeding files
install_required_pkg debian-edu-install

edu-etcvcs commit

hook=/target/usr/share/debian-edu-config/d-i/pre-pkgsel
if [ -x $hook ] ; then
    log "Running debian-edu-config pre-pkgsel hook"
    $hook
fi

edu-etcvcs commit

disable_exception
exit 0