gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] 02/02: detect distro


From: gnunet
Subject: [taler-deployment] 02/02: detect distro
Date: Wed, 08 Mar 2023 19:23:59 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository deployment.

commit 4fd465d1423694d5629d162ba92c38cea40ce3e4
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Mar 8 19:23:46 2023 +0100

    detect distro
---
 netzbon/functions.sh                                   | 10 ++++++++++
 ...{install_debian_packages.sh => install_packages.sh} | 18 ++++++++++++++++--
 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
similarity index 60%
rename from netzbon/install_debian_packages.sh
rename to 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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]