UpdateAuthelia.sh: Difference between revisions
From FlowerHouseWiki
(Created page with "<syntaxhighlight lang="bash" line> #!/bin/bash # Variables name="Authelia" repo="authelia/authelia" architecture="linux-amd64" binary_path="/usr/bin" binary_name="authelia" # ===== VERSION CHECKING, CUSTOMIZE VARIBLES FOR IT ===== # Get current version current=$($binary_path/$binary_name --version) # Retain everything after last space current=${current##* } # Get latest release tag latest=$(curl -sL https://api.github.com/repos/$repo/releases/latest | jq -r ".tag_n...") |
No edit summary |
||
Line 5: | Line 5: | ||
name="Authelia" | name="Authelia" | ||
repo="authelia/authelia" | repo="authelia/authelia" | ||
architecture=" | architecture="amd64" | ||
binary_path="/usr/bin" | binary_path="/usr/bin" | ||
Line 32: | Line 32: | ||
if (("${current//[!0-9]/}" > "${latest//[!0-9]/}")); then | if (("${current//[!0-9]/}" > "${latest//[!0-9]/}")); then | ||
echo -e "-------------------------------------------------------------------------------------------" | echo -e "-------------------------------------------------------------------------------------------" | ||
echo -e "- Installed ${current} is newer than available version, repository deprecated?" | echo -e "- Installed ${current} is newer than available version ${latest}, repository deprecated?" | ||
echo -e "-------------------------------------------------------------------------------------------" | echo -e "-------------------------------------------------------------------------------------------" | ||
exit 0 | exit 0 | ||
Line 52: | Line 52: | ||
# ===== INSTALLATION PART, CUSTOMIZE FOR EACH SOFTWARE ===== | # ===== INSTALLATION PART, CUSTOMIZE FOR EACH SOFTWARE ===== | ||
# Download files | # Download files | ||
wget https://github.com/authelia/authelia/releases/download/ | wget https://github.com/authelia/authelia/releases/download/${latest}/authelia_${latest}_${architecture}.deb || exit 1 | ||
# | # Install software | ||
apt install ./authelia_${latest}_${architecture}.deb || exit 1 | |||
# Remove old files | # Remove old files | ||
rm | rm authelia_${latest}_${architecture}.deb || exit 1 | ||
# ===== FINISH INSTALLATION SCRIPT ==== | # ===== FINISH INSTALLATION SCRIPT ==== |
Latest revision as of 21:58, 28 July 2022
#!/bin/bash
# Variables
name="Authelia"
repo="authelia/authelia"
architecture="amd64"
binary_path="/usr/bin"
binary_name="authelia"
# ===== VERSION CHECKING, CUSTOMIZE VARIBLES FOR IT =====
# Get current version
current=$($binary_path/$binary_name --version)
# Retain everything after last space
current=${current##* }
# Get latest release tag
latest=$(curl -sL https://api.github.com/repos/$repo/releases/latest | jq -r ".tag_name")
# Check if new version available
if (("${current//[!0-9]/}" == "${latest//[!0-9]/}")); then
echo -e "-------------------------------------------------------------------------------------------"
echo -e "- Installed ${current} is up to date"
echo -e "-------------------------------------------------------------------------------------------"
exit 0
fi
# Check if repo is deprecated
if (("${current//[!0-9]/}" > "${latest//[!0-9]/}")); then
echo -e "-------------------------------------------------------------------------------------------"
echo -e "- Installed ${current} is newer than available version ${latest}, repository deprecated?"
echo -e "-------------------------------------------------------------------------------------------"
exit 0
fi
# Write information
echo -e "-------------------------------------------------------------------------------------------"
echo -e "- Update ${name} ${current} to ${latest}?"
echo -e "-------------------------------------------------------------------------------------------"
echo -e -n "Continue? [y/N]"
echo ""
read -n 1 c
if [ "${c}" != "y" ]; then
exit 0
fi
# ===== INSTALLATION PART, CUSTOMIZE FOR EACH SOFTWARE =====
# Download files
wget https://github.com/authelia/authelia/releases/download/${latest}/authelia_${latest}_${architecture}.deb || exit 1
# Install software
apt install ./authelia_${latest}_${architecture}.deb || exit 1
# Remove old files
rm authelia_${latest}_${architecture}.deb || exit 1
# ===== FINISH INSTALLATION SCRIPT ====
echo -e "-------------------------------------------------------------------------------------------"
echo -e "- Update to ${latest} completed!"
echo -e "-------------------------------------------------------------------------------------------"