summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-11-07 17:52:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-11-07 17:52:32 +0000
commit7ffa6a7bfee9667eabea58d05ae3b9a493ba5351 (patch)
tree7bc56794afe5a618865f8457d594da666bea95f4
parentAdding upgrade-handling for hooks from buster to bullseye and newer. (diff)
downloadopen-infrastructure-compute-tools-7ffa6a7bfee9667eabea58d05ae3b9a493ba5351.tar.xz
open-infrastructure-compute-tools-7ffa6a7bfee9667eabea58d05ae3b9a493ba5351.zip
Moving upgrade handling in postinst to its own function.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/open-infrastructure-container-tools.postinst101
1 files changed, 53 insertions, 48 deletions
diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst
index 7514e29..0c9292c 100755
--- a/debian/open-infrastructure-container-tools.postinst
+++ b/debian/open-infrastructure-container-tools.postinst
@@ -38,54 +38,8 @@ Install ()
fi
}
-case "${1}" in
- configure)
- # build-scripts
- update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/mmdebstrap 1000
- update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/debootstrap 2000
- update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/progress-linux 3000
- update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/debian 4000
-
- # get-scripts
- update-alternatives --quiet --install /usr/share/compute-tools/get-scripts/default container_get-script /usr/share/compute-tools/get-scripts/curl 1000
-
- . /usr/share/debconf/confmodule
-
- db_get open-infrastructure-container-tools/machines
- MACHINES="${RET:-/var/lib/machines}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/config
- CONFIG="${RET:-/etc/compute-tools/config}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/debconf
- DEBCONF="${RET:-/etc/compute-tools/debconf}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/hooks
- HOOKS="${RET:-/etc/compute-tools/hooks}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/keys
- KEYS="${RET:-/etc/compute-tools/keys}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/cache
- CACHE="${RET:-/var/cache/container}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/build-script
- SCRIPT="${RET:-debian}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/irc
- IRK_TARGETS="${RET}" # string (w/ empty)
-
- db_stop
-
- Install "/var/lib/machines" "${MACHINES}"
- Install "/etc/compute-tools/config" "${CONFIG}"
- Install "/etc/compute-tools/debconf" "${DEBCONF}"
- Install "/etc/compute-tools/hooks" "${HOOKS}"
- Install "/etc/compute-tools/keys" "${KEYS}"
- Install "/var/cache/container" "${CACHE}"
-
- update-alternatives --quiet --set container_build-script "/usr/share/compute-tools/build-scripts/${SCRIPT}"
-
+Upgrade ()
+{
# upgrade from buster: conffile
if [ -e /etc/open-infrastructure/container.conf ] && [ ! -e "${CONFFILE}" ]
then
@@ -140,6 +94,57 @@ case "${1}" in
mv /var/log/open-infrastructure /var/log/compute-tools
fi
fi
+}
+
+case "${1}" in
+ configure)
+ # build-scripts
+ update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/mmdebstrap 1000
+ update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/debootstrap 2000
+ update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/progress-linux 3000
+ update-alternatives --quiet --install /usr/share/compute-tools/build-scripts/default container_build-script /usr/share/compute-tools/build-scripts/debian 4000
+
+ # get-scripts
+ update-alternatives --quiet --install /usr/share/compute-tools/get-scripts/default container_get-script /usr/share/compute-tools/get-scripts/curl 1000
+
+ . /usr/share/debconf/confmodule
+
+ db_get open-infrastructure-container-tools/machines
+ MACHINES="${RET:-/var/lib/machines}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/config
+ CONFIG="${RET:-/etc/compute-tools/config}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/debconf
+ DEBCONF="${RET:-/etc/compute-tools/debconf}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/hooks
+ HOOKS="${RET:-/etc/compute-tools/hooks}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/keys
+ KEYS="${RET:-/etc/compute-tools/keys}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/cache
+ CACHE="${RET:-/var/cache/container}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/build-script
+ SCRIPT="${RET:-debian}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/irc
+ IRK_TARGETS="${RET}" # string (w/ empty)
+
+ db_stop
+
+ Install "/var/lib/machines" "${MACHINES}"
+ Install "/etc/compute-tools/config" "${CONFIG}"
+ Install "/etc/compute-tools/debconf" "${DEBCONF}"
+ Install "/etc/compute-tools/hooks" "${HOOKS}"
+ Install "/etc/compute-tools/keys" "${KEYS}"
+ Install "/var/cache/container" "${CACHE}"
+
+ Upgrade
+
+ update-alternatives --quiet --set container_build-script "/usr/share/compute-tools/build-scripts/${SCRIPT}"
if [ ! -e "${CONFFILE}" ]
then