diff options
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-x | share/scripts/debconf | 192 |
1 files changed, 34 insertions, 158 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index fbb20fa..fbabab4 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -174,22 +174,22 @@ EOF chmod 0755 "${DIRECTORY}/usr/sbin/policy-rc.d" # Upgrade system - Chroot "${DIRECTORY}" "apt-get update" - Chroot "${DIRECTORY}" "apt-get --yes --option APT::Force-LoopBreak=true --option Dpkg::Options::=--force-confnew upgrade" - Chroot "${DIRECTORY}" "apt-get --yes --option APT::Force-LoopBreak=true --option Dpkg::Options::=--force-confnew dist-upgrade" + Chroot "${DIRECTORY}" "apt update" + Chroot "${DIRECTORY}" "apt --yes --option Dpkg::Options::=--force-confnew upgrade" + Chroot "${DIRECTORY}" "apt --yes --option Dpkg::Options::=--force-confnew dist-upgrade" # Install systemd support packages - Chroot "${DIRECTORY}" "apt-get --yes install dbus libpam-systemd systemd-sysv" + Chroot "${DIRECTORY}" "apt --yes install dbus libpam-systemd systemd-sysv" - Chroot "${DIRECTORY}" "apt-get clean" + Chroot "${DIRECTORY}" "apt clean" } Cleanup_system () { DIRECTORY="${1}" - Chroot "${DIRECTORY}" "apt-get --yes --purge autoremove" - Chroot "${DIRECTORY}" "apt-get clean" + Chroot "${DIRECTORY}" "apt --yes --purge autoremove" + Chroot "${DIRECTORY}" "apt clean" # Cleanup rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/${SOFTWARE}" @@ -276,72 +276,26 @@ Configure_apt () PARENT_AREA="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's|,| |g')" PARENT_DIST="$(echo ${PARENT_DISTRIBUTION} | sed -e 's|-backports||')" - echo "deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA}" > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" +cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" << EOF +# /etc/apt/sources.list.d/debian.list - case "${MODE}" in - progress-linux) - AREA="$(echo ${ARCHIVE_AREAS} | sed -e 's|,| |g')" - DIST="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')" - - echo "deb ${MIRROR} ${DIST} ${AREA}" > "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - - case "${DISTRIBUTION}" in - *-backports) - echo "deb ${MIRROR} ${DIST}-backports ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - esac - -cat > "${DIRECTORY}/etc/apt/preferences.d/progress-linux.pref" << EOF -Package: * -Pin: release n=${DIST} -Pin-Priority: 999 - -Package: * -Pin: release n=${DIST}-security -Pin-Priority: 999 - -Package: * -Pin: release n=${DIST}-updates -Pin-Priority: 999 - -Package: * -Pin: release n=${DIST}-extras -Pin-Priority: 999 +deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA} EOF - case "${DISTRIBUTION}" in - *-backports) - -cat >> "${DIRECTORY}/etc/apt/preferences.d/progress-linux.pref" << EOF -Package: * -Pin: release n=${DIST}-backports -Pin-Priority: 999 + case "${MODE}" in + progress-linux) -Package: * -Pin: release n=${DIST}-backports-extras -Pin-Priority: 999 +cat > "${DIRECTORY}/progress-linux.cfg" << EOF +progress-linux progress-linux/archives multiselect ${ARCHIVES} +progress-linux progress-linux/archive-areas multiselect $(echo ${ARCHIVE_AREAS} | sed -e 's|,| |g') EOF - ;; - - *) + Chroot "${DIRECTORY}" "debconf-set-selections progress-linux.cfg" + Chroot "${DIRECTORY}" "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=criticial dpkg-reconfigure progress-linux" -cat >> "${DIRECTORY}/etc/apt/preferences.d/progress-linux.pref" << EOF + rm -f "${DIRECTORY}/progress-linux.cfg" -#Package: * -#Pin: release n=${DIST}-backports -#Pin-Priority: 999 - -#Package: * -#Pin: release n=${DIST}-backports-extras -#Pin-Priority: 999 -EOF - - ;; - esac - - Chroot "${DIRECTORY}" "apt-key add /usr/share/progress-linux/pgp-keys/apt.progress-linux.org.gpg" - Chroot "${DIRECTORY}" "apt-get update" + Chroot "${DIRECTORY}" "apt update" ;; esac } @@ -399,8 +353,6 @@ EOF fi # Removing resolv.conf - #rm -f "${DIRECTORY}/etc/resolv.conf" - # FIXME: needs to stay for the moment rm -f "${DIRECTORY}/etc/resolv.conf" cp /etc/resolv.conf "${DIRECTORY}/etc" @@ -429,7 +381,11 @@ Configure_system () PARENT_AREA="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's|,| |g')" PARENT_DIST="$(echo ${PARENT_DISTRIBUTION} | sed -e 's|-backports||')" - echo "deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA}" > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" +cat > "${DIRECTORY}/etc/apt/sources.list.d/debian.list" << EOF +# /etc/apt/sources.list.d/debian.list + +deb ${PARENT_MIRROR} ${PARENT_DIST} ${PARENT_AREA} +EOF for PARENT_REPO in ${PARENT_ARCHIVES} do @@ -458,79 +414,16 @@ Configure_system () case "${MODE}" in progress-linux) - AREA="$(echo ${ARCHIVE_AREAS} | sed -e 's|,| |g')" - DIST="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')" - echo "deb ${MIRROR} ${DIST} ${AREA}" > "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" +cat > "${DIRECTORY}/progress-linux.cfg" << EOF +progress-linux progress-linux/archives multiselect ${ARCHIVES} +progress-linux progress-linux/archive-areas multiselect $(echo ${ARCHIVE_AREAS} | sed -e 's|,| |g') +EOF - for REPO in ${ARCHIVES} - do - case "${REPO}" in - ${DIST}-staging) - echo "deb ${MIRROR} ${DIST}-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-security) - echo "deb ${MIRROR_SECURITY} ${DIST}-security ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-security-staging) - echo "deb ${MIRROR_SECURITY} ${DIST}-security-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-updates) - echo "deb ${MIRROR} ${DIST}-updates ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-updates-staging) - echo "deb ${MIRROR} ${DIST}-updates-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-extras) - if echo "${AREA}" | grep -qs non-free - then - echo "deb ${MIRROR} ${DIST}-extras ${AREA} restricted" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - else - echo "deb ${MIRROR} ${DIST}-extras ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - fi - ;; - - ${DIST}-extras-staging) - if echo "${AREA}" | grep -qs non-free - then - echo "deb ${MIRROR} ${DIST}-extras-staging ${AREA} restricted" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - else - echo "deb ${MIRROR} ${DIST}-extras-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - fi - ;; - - ${DIST}-backports) - echo "deb ${MIRROR} ${DIST}-backports ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-backports-staging) - echo "deb ${MIRROR} ${DIST}-backports-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - ;; - - ${DIST}-backports-extras) - if echo "${AREA}" | grep -qs non-free - then - echo "deb ${MIRROR} ${DIST}-backports-extras ${AREA} restricted" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - else - echo "deb ${MIRROR} ${DIST}-backports-extras ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - fi - ;; - - ${DIST}-backports-extras-staging) - if echo "${AREA}" | grep -qs non-free - then - echo "deb ${MIRROR} ${DIST}-backports-extras-staging ${AREA} restricted" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - else - echo "deb ${MIRROR} ${DIST}-backports-extras-staging ${AREA}" >> "${DIRECTORY}/etc/apt/sources.list.d/progress-linux.list" - fi - ;; - esac - done + Chroot "${DIRECTORY}" "debconf-set-selections progress-linux.cfg" + Chroot "${DIRECTORY}" "DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=criticial dpkg-reconfigure progress-linux" + + rm -f "${DIRECTORY}/progress-linux.cfg" ;; esac @@ -602,9 +495,6 @@ EOF rm -f "${DIRECTORY}/preseed.cfg" fi - # FIXME: All packages of priority of essential need to be reconfigured to reflect choices from preseeding - # -> fix: use two-stage bootstrap (foreign) and inject preseeds in between - # Manual hack to workaround broken preseeding in locales package if [ -n "${PRESEED_FILE}" ] then @@ -659,19 +549,9 @@ EOF fi done - # FIXME: Install additional packages after lxc-support has been run. - # This is suboptimal, ideally we should install all packages but not run the maintainer scripts, - # then run lxc-support, and run the maintainer scripts. This way, lxc-support would see - # all the installed packages and could skip those scripts entirely when a certain package is not - # installed. Unfortunately, that is not possible in any reasonable way with apt-get. - # FTR: The only known workaround for now would be to first apt-get install --download-only all - # packages, then unpack them with dpkg, run lxc-support, and dpkg --configure them. - # For the time being, it's better to have lxc-support see no packages at all and be run before - # packages are installed, than the other way around. - # Workaround: We're running lxc-support at the end of the template again. if [ -n "${PACKAGES}" ] then - Chroot "${DIRECTORY}" "apt-get --option APT::Force-LoopBreak=true --option Dpkg::Options::=--force-confnew --yes install ${PACKAGES}" + Chroot "${DIRECTORY}" "apt --option Dpkg::Options::=--force-confnew --yes install ${PACKAGES}" fi # Manual hack to regenerate ssh keys @@ -898,8 +778,6 @@ Commands () { DIRECTORY="${1}" - # config (FIXME) - # maximum of 15 characters, prefix is 'veth-' HOSTNAME_SHORT="$(echo ${NAME} | cut -c-8)" HOST_INTERFACE_NAME="$(echo ${NETWORK1_VETH:-veth-${HOSTNAME_SHORT}-0})" @@ -992,8 +870,6 @@ for DEBCONF_SCRIPT in "/usr/share/${PROJECT}/${PROGRAM}/scripts/debconf.d"/* do if [ -x "${DEBCONF_SCRIPT}" ] then - # FIXME - # debconf -o${SOFTWARE} "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -1078,7 +954,7 @@ fi Configure_system "${MACHINES}/${NAME}" Configure_network "${MACHINES}/${NAME}" -Configure_systemd_networkd "${MACHINES}/${NAME}" # FIXME +Configure_systemd_networkd "${MACHINES}/${NAME}" Cleanup_system "${MACHINES}/${NAME}" Commands "${MACHINES}/${NAME}" |