#!/bin/sh set -e Install_apt () { # apt sources echo "Installing /etc/apt/sources.list.d/progress-linux.list ..." cat > /etc/apt/sources.list.d/progress-linux.list << EOF # /etc/apt/sources.list.d/progress-linux.list EOF # apt preferences echo "Installing /etc/apt/preferences.d/progress-linux.pref ..." cat > /etc/apt/preferences.d/progress-linux.pref << EOF # /etc/apt/preferences.d/progress-linux.pref EOF # apt key echo "Installing /etc/apt/trusted.gpg.d/progress-linux.gpg ..." rm -f /etc/apt/trusted.gpg.d/progress-linux.gpg for KEY in /usr/share/progress-linux/pgp-keys/*archive-key.gpg do cat "${KEY}" >> /etc/apt/trusted.gpg.d/progress-linux.gpg done } Remove_apt () { # apt sources echo "Removing /etc/apt/sources.list.d/progress-linux.list ..." rm -f /etc/apt/sources.list.d/progress-linux.list # apt preferences echo "Removing /etc/apt/sources.list.d/progress-linux.list ..." rm -f /etc/apt/preferences.d/progress-linux.pref # apt key echo "Removing /etc/apt/trusted.gpg.d/progress-linux.gpg ..." rm -f /etc/apt/trusted.gpg.d/progress-linux.gpg } Configure_apt () { ARCHIVE="${1}" case "${ARCHIVE}" in *-extras) AREAS="${ARCHIVE_AREAS}" ;; *) AREAS="$(echo ${ARCHIVE_AREAS} | sed -e 's| restricted||')" ;; esac # apt sources cat >> /etc/apt/sources.list.d/progress-linux.list << EOF deb https://deb.progress-linux.org/packages ${ARCHIVE} ${AREAS} EOF # apt preferences cat >> /etc/apt/preferences.d/progress-linux.pref << EOF Package: * Pin: release n=${ARCHIVE} Pin-Priority: 999 EOF } Configure_ssh () { KEY="$(cat /usr/share/progress-linux/ssh-keys/ssh.progress-linux.org.pub)" echo "Installing /etc/ssh/ssh_known_hosts ..." if [ ! -e "/etc/ssh/ssh_known_hosts" ] then # ssh cert-authority mkdir -p /etc/ssh cat > "/etc/ssh/ssh_known_hosts" << EOF # /etc/ssh/ssh_known_hosts @cert-authority *.progress-linux.org ${KEY} EOF else grep -v '^@cert-authority \*.progress-linux.org' /etc/ssh/ssh_known_hosts > /etc/ssh/ssh_known_hosts.tmp cat >> "/etc/ssh/ssh_known_hosts.tmp" << EOF @cert-authority *.progress-linux.org ${KEY} EOF mv -f /etc/ssh/ssh_known_hosts.tmp /etc/ssh/ssh_known_hosts fi } case "${1}" in configure) . /usr/share/debconf/confmodule db_get progress-linux/archives ARCHIVES="${RET}" # multiselect w/ empty db_get progress-linux/archive-areas ARCHIVE_AREAS="${RET:-main}" # string w/o empty db_stop if [ -n "${ARCHIVES}" ] then Install_apt else Remove_apt fi ARCHIVES="$(echo ${ARCHIVES} | sed -e 's|, | |g')" ARCHIVE_AREAS="$(echo ${ARCHIVE_AREAS} | sed -e 's|, | |g')" for ARCHIVE in ${ARCHIVES} do Configure_apt ${ARCHIVE} done Configure_ssh ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`${1}'" >&2 exit 1 ;; esac #DEBHELPER# exit 0