diff options
Diffstat (limited to 'debian/progress-linux.postinst')
-rwxr-xr-x | debian/progress-linux.postinst | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/debian/progress-linux.postinst b/debian/progress-linux.postinst new file mode 100755 index 0000000..70414bd --- /dev/null +++ b/debian/progress-linux.postinst @@ -0,0 +1,100 @@ +#!/bin/sh + +set -e + +Install () +{ + # 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-5-engywuck-archive-key.gpg ..." + ln -sf /usr/share/progress-linux/pgp-keys/progress-linux-5-engywuck-archive-key.gpg /etc/apt/trusted.gpg.d/progress-linux-5-engywuck-archive-key.gpg +} + +Remove () +{ + # 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-5-engywuck-archive-key.gpg ..." + rm -f /etc/apt/trusted.gpg.d/progress-linux-5-engywuck-archive-key.gpg +} + +Configure () +{ + ARCHIVE="${1}" + + # apt sources + cat >> /etc/apt/sources.list.d/progress-linux.list << EOF +deb https://deb.progress-linux.org/packages ${ARCHIVE} ${ARCHIVE_AREAS} +EOF + + # apt preferences + cat >> /etc/apt/preferences.d/progress-linux.pref << EOF + +Package: * +Pin: release n=${ARCHIVE} +Pin-Priority: 999 +EOF +} + +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 + else + Remove + fi + + ARCHIVES="$(echo ${ARCHIVES} | sed -e 's|,| |g')" + ARCHIVE_AREAS="$(echo ${ARCHIVE_AREAS} | sed -e 's|,| |g')" + + for ARCHIVE in ${ARCHIVES} + do + Configure ${ARCHIVE} + done + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 |