diff options
author | Florian Dold <florian@dold.me> | 2023-03-08 19:23:46 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-03-08 19:23:46 +0100 |
commit | 4fd465d1423694d5629d162ba92c38cea40ce3e4 (patch) | |
tree | d83cbaaba95c05c999132170c3452d4657a6265b | |
parent | ae648b3d47d7b9a9204b8a2a331ce01d5d8b8890 (diff) | |
download | deployment-4fd465d1423694d5629d162ba92c38cea40ce3e4.tar.gz deployment-4fd465d1423694d5629d162ba92c38cea40ce3e4.tar.bz2 deployment-4fd465d1423694d5629d162ba92c38cea40ce3e4.zip |
detect distro
-rwxr-xr-x | netzbon/functions.sh | 10 | ||||
-rwxr-xr-x | netzbon/install_packages.sh (renamed from netzbon/install_debian_packages.sh) | 18 | ||||
-rwxr-xr-x | netzbon/main.sh | 4 |
3 files changed, 28 insertions, 4 deletions
diff --git a/netzbon/functions.sh b/netzbon/functions.sh index afdd12e..b4c265d 100755 --- a/netzbon/functions.sh +++ b/netzbon/functions.sh @@ -52,3 +52,13 @@ function assign_user_permissions() su - postgres -c "createdb -O $n taler-$n" done } + +# Set DISTRO to the detected distro or return non-zero +# status if distro not supported. +function detect_distro() +{ + unset DISTRO + uname -a | grep Ubuntu >/dev/null && DISTRO=ubuntu && return 0 + uname -a | grep Debian >/dev/null && DISTRO=debian && return 0 + return 1 +} diff --git a/netzbon/install_debian_packages.sh b/netzbon/install_packages.sh index fcd494f..e543aa3 100755 --- a/netzbon/install_debian_packages.sh +++ b/netzbon/install_packages.sh @@ -7,6 +7,8 @@ source functions.sh source config/user.conf source config/internal.conf +detect_distro + # Program versions PG_VERSION=14 @@ -28,9 +30,21 @@ apt install uuid-runtime \ ## Add GNU Taler deb.taler.net to /etc/apt/sources.list -say "Adding GNU Taler Debian repository" +say "Adding GNU Taler apt repository" + +case $DISTRO in + debian) + echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/ubuntu stable main" > /etc/apt/sources.list.d/taler.list + ;; + ubuntu) + echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian stable main" > /etc/apt/sources.list.d/taler.list + ;; + *) + say "Unsupported distro: $DISTRO" + exit 1 + ;; +esac -echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian stable main" > /etc/apt/sources.list.d/taler.list wget -P /etc/apt/keyrings https://taler.net/taler-systems.gpg diff --git a/netzbon/main.sh b/netzbon/main.sh index 97841db..5848915 100755 --- a/netzbon/main.sh +++ b/netzbon/main.sh @@ -79,8 +79,8 @@ fi # Check if the user is root, otherwise EXIT. check_user -# Installation of Debian packages required -. install_debian_packages.sh +# Installation of deb packages required +. install_packages.sh if test -z "${NEXUS_EXCHANGE_PASSWORD:-}" then |