Skip to content

Commit

Permalink
Minor text change (add line break) and use shfmt
Browse files Browse the repository at this point in the history
I have literally run this through shfmt to clean code inconsistencies

All it did was change a couple indentations and get rid of some semicolons after if/fi; blocks, but they worked before.

Maybe this will pass now? If it doesn't, I'm stumped, or I'm triggering a minor bug in GitHub actions.
  • Loading branch information
houbsta authored Nov 23, 2023
1 parent 3762abb commit 5536538
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions linux/setup_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
# This script installs a Jamulus repository to Debian based systems

if [[ ${EUID} -ne 0 ]]; then
echo "Error: This script must be run as root."
exit 1
echo "Error: This script must be run as root."
exit 1
fi

# Check for apt version >= 2.2.0 (if found, assuming Debian-based compatible with repo)
# Issue: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1950095

if APT_VERSION="$(apt --version)"; then
APT_MAJOR=$(echo "$APT_VERSION"| cut -d' ' -f 2 | cut -d'.' -f 1)
APT_MINOR=$(echo "$APT_VERSION"| cut -d' ' -f 2 | cut -d'.' -f 2)
APT_MAJOR=$(echo "$APT_VERSION" | cut -d' ' -f 2 | cut -d'.' -f 1)
APT_MINOR=$(echo "$APT_VERSION" | cut -d' ' -f 2 | cut -d'.' -f 2)
else
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."
echo "This script is only compatible with Debian based distributions which have apt."
echo "It seems apt is not available. Please check that your OS is supported."
exit 1
fi;
fi

if (( $(echo "${APT_MAJOR}.${APT_MINOR} < 2.2" | bc -l) )); then
if (($(echo "${APT_MAJOR}.${APT_MINOR} < 2.2" | bc -l))); then
echo "Your apt version is incompatible. You may not be able install this repository. "
echo "See: https://github.com/orgs/jamulussoftware/discussions/3180"
echo "Also of interest: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1950095"
Expand All @@ -27,31 +28,31 @@ if (( $(echo "${APT_MAJOR}.${APT_MINOR} < 2.2" | bc -l) )); then
echo "(not recommended, as you might need to fix your apt configuration)"
select yn in "Yes" "No"; do
case $yn in
Yes )
Yes)
echo "Proceeding with override. You have been warned!"
break
;;
No )
No)
echo "Exiting."
exit 0
;;
esac
done
fi;
fi

REPO_FILE=/etc/apt/sources.list.d/jamulus.list
KEY_FILE=/etc/apt/trusted.gpg.d/jamulus.asc
GITHUB_REPOSITORY="jamulussoftware/jamulus"

echo "Setting up Jamulus repo at ${REPO_FILE}..."
echo "deb https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/ ./" > ${REPO_FILE}
echo "deb https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/ ./" >${REPO_FILE}
echo "Installing Jamulus GPG key at ${KEY_FILE}..."
curl --fail --show-error -sLo "${KEY_FILE}" https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/key.asc

CURL_EXITCODE=$?
if [[ ${CURL_EXITCODE} -ne 0 ]]; then
echo "Error: Download of gpg key failed. Please try again later."
exit ${CURL_EXITCODE}
echo "Error: Download of gpg key failed. Please try again later."
exit ${CURL_EXITCODE}
fi

echo "Running apt update..."
Expand Down

0 comments on commit 5536538

Please sign in to comment.