summaryrefslogtreecommitdiff
path: root/update_ungoogled_chromium-portable_linux_64.sh
diff options
context:
space:
mode:
authorlshprung <lshprung@yahoo.com>2021-08-17 17:25:32 -0700
committerlshprung <lshprung@yahoo.com>2021-08-17 17:25:32 -0700
commitd11e881244e3661cb00c3359497e24ef98d62735 (patch)
tree84a382d9c717e5ef5dbc1906e03e18925458ccf2 /update_ungoogled_chromium-portable_linux_64.sh
parent22eb12c832c3f6e405e94a0b32889cbf7e60d36a (diff)
Broke main outline into three files; switched focus from appimage to portable
Diffstat (limited to 'update_ungoogled_chromium-portable_linux_64.sh')
-rwxr-xr-xupdate_ungoogled_chromium-portable_linux_64.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/update_ungoogled_chromium-portable_linux_64.sh b/update_ungoogled_chromium-portable_linux_64.sh
new file mode 100755
index 0000000..e8d7d32
--- /dev/null
+++ b/update_ungoogled_chromium-portable_linux_64.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# Shell script to update ungoogled-chromium Portable Linux 64-bit to the latest version
+# $1 -> Wrapper symlink location
+# $2 (optional) -> Install location
+
+# If first time installing: user must specify a symlink location and an installation directory
+# If checking for updates: user must pass a symlink for ungoogled-chromium (this is typically just the command name if a symlink is part of the path)
+ # Use the symlink target to determine installation directory
+
+PLATFORM="Portable Linux 64-bit"
+
+
+# Print help message
+print_help() {
+ echo "Usage: $0 LINK [LOCATION]"
+ echo
+ echo "LINK is the path for a symlink pointing to the ungoogled-chromium executable"
+ echo "LOCATION is the desired install location for ungoogled-chromium. It does not need to be specified unless installing ungoogled-chromium for the first time"
+}
+
+# Function to determine absolute path of helper scripts
+# $1 -> script name
+get_absolute_path() {
+ echo "$(dirname "$(which "$1")")/$1"
+}
+
+
+# Exit if $1 does not exist
+if [ -z "$1" ]; then
+ echo "Error: too few arguments"
+ print_help
+ exit 0
+fi
+
+# Fetch info, break and store into variables
+FULL_INFO=$($(get_absolute_path "fetch_info.sh") "$PLATFORM")
+
+if [ $? -eq 0 ]; then
+ echo "Error: Could not get latest version info"
+ exit 0
+fi
+
+NAME=$(echo "$FULL_INFO" | head -n 1 | cut -d ':' -f 1)
+VERSION=$(echo "$FULL_INFO" | head -n 1 | cut -d ':' -f 2 | sed 's/^[ ]*//g' | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
+URL=$(echo "$FULL_INFO" | sed -n "2p")
+
+echo "$NAME"
+echo "$VERSION"
+echo "$URL"
+
+# Check installed version number (if exists)
+if [ -h "$1" ]; then
+ MY_VERSION=$($1 --version | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
+ echo "$MY_VERSION"
+
+ # Compare versions to determine if an update is necessary
+fi
+