Skip to content

Commit 135e944

Browse files
authored
Test for Ubuntu and Ubuntu version (#3199)
1 parent 1265a7f commit 135e944

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

linux/setup_repo.sh

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,42 @@
33
# This script installs a Jamulus repository to Debian based systems
44

55
if [[ ${EUID} -ne 0 ]]; then
6-
echo "Error: This script must be run as root."
7-
exit 1
6+
echo "Error: This script must be run as root."
7+
exit 1
8+
fi
9+
10+
# Check for apt version >= 2.2.0 (if found, assuming Debian-based compatible with repo)
11+
# Issue: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1950095
12+
13+
if APT_VERSION="$(apt --version)"; then
14+
APT_MAJOR=$(echo "$APT_VERSION" | cut -d' ' -f 2 | cut -d'.' -f 1)
15+
APT_MINOR=$(echo "$APT_VERSION" | cut -d' ' -f 2 | cut -d'.' -f 2)
16+
else
17+
echo "This script is only compatible with Debian based distributions which have apt, but apt is not available. Please check that your OS is supported."
18+
exit 1
19+
fi
20+
21+
if [[ ${APT_MAJOR} -lt 2 || (${APT_MAJOR} -eq 2 && ${APT_MINOR} -lt 2) ]]; then
22+
echo "This repository is not compatible with your apt version."
23+
echo "You can install Jamulus manually using the .deb package from "
24+
echo "https://github.com/jamulussoftware/jamulus/releases or update your OS."
25+
echo "For more information see: https://github.com/orgs/jamulussoftware/discussions/3180"
26+
echo "Also of interest: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1950095"
27+
echo
28+
echo "Do you wish to attempt to install the repository anyway?"
29+
echo "(not recommended, as you might need to fix your apt configuration)"
30+
select yn in "Yes" "No"; do
31+
case $yn in
32+
Yes)
33+
echo "Proceeding with override. You have been warned!"
34+
break
35+
;;
36+
No)
37+
echo "Exiting."
38+
exit 0
39+
;;
40+
esac
41+
done
842
fi
943

1044
REPO_FILE=/etc/apt/sources.list.d/jamulus.list
@@ -18,8 +52,8 @@ curl --fail --show-error -sLo "${KEY_FILE}" https://github.com/${GITHUB_REPOSITO
1852

1953
CURL_EXITCODE=$?
2054
if [[ ${CURL_EXITCODE} -ne 0 ]]; then
21-
echo "Error: Download of gpg key failed. Please try again later."
22-
exit ${CURL_EXITCODE}
55+
echo "Error: Download of gpg key failed. Please try again later."
56+
exit ${CURL_EXITCODE}
2357
fi
2458

2559
echo "Running apt update..."

0 commit comments

Comments
 (0)