From 618b2b94835be2e87be160fb4744a080758e699a Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Tue, 1 Sep 2026 18:42:02 +0200 Subject: [PATCH] chore: implemented whole functionality since it's not too complex (linux) --- logofclientctl.sh | 124 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 26 deletions(-) diff --git a/logofclientctl.sh b/logofclientctl.sh index 16dea00..162fe3c 100755 --- a/logofclientctl.sh +++ b/logofclientctl.sh @@ -21,57 +21,129 @@ show_help(){ install(){ printf "Fetching version...\n" - - GITEA_URL="${GITEA_URL:-https://git.mypapercloud.de}" OWNER="${OWNER:-fierke}" REPO="${REPO:-logofclient}" - API="${GITEA_URL%/}/api/v1" release_json="$( - curl --fail --silent --show-error --location \ - "$API/repos/$OWNER/$REPO/releases/latest" + curl --fail --silent --show-error --location \ + "$API/repos/$OWNER/$REPO/releases/latest" )" tag="$( - jq --exit-status --raw-output '.tag_name' <<<"$release_json" + jq --exit-status --raw-output '.tag_name' <<<"$release_json" )" - - printf "Installing logofclient $tag...\n" + + printf "Installing logofclient %s...\n" "$tag" ASSET="logofclient-$tag-linux.tar.xz" - + asset_url="$( - jq --exit-status --raw-output \ - --arg asset "$ASSET" \ - '.assets[] - | select(.name == $asset) - | .browser_download_url' \ - <<<"$release_json" + jq --exit-status --raw-output \ + --arg asset "$ASSET" \ + '.assets[] + | select(.name == $asset) + | .browser_download_url' \ + <<<"$release_json" )" - #printf 'Release tag: %s\n' "$tag" printf 'Downloading package: %s\n' "$asset_url" curl --fail --location --retry 3 \ - "${AUTH[@]}" \ - --output "$ASSET" \ - "$asset_url" + --output "$ASSET" \ + "$asset_url" - #printf 'Gespeichert als: %s\n' "$ASSET" + INSTALL_DIR="/opt/logofclient" + + printf 'Installing to: %s\n' "$INSTALL_DIR" + + sudo rm -rf "$INSTALL_DIR" + sudo mkdir -p "$INSTALL_DIR" + + sudo tar -xf "$ASSET" -C "$INSTALL_DIR" + echo "$tag" | sudo tee "$INSTALL_DIR/.version" > /dev/null + + sudo ln -sf "$INSTALL_DIR/Logof Client" "/usr/local/bin/logofclient" + + sudo tee /usr/share/applications/logofclient.desktop > /dev/null < %s\n" \ + "${installed_tag:-none}" "$latest_tag" + + if [[ -n "$installed_tag" ]]; then + uninstall + fi + + install +} + + while getopts "yhv" opt; do case $opt in v) exit 0 ;; @@ -91,13 +163,13 @@ fi if [[ "$1" == "update" ]]; then - # update + update exit 0 fi if [[ "$1" == "uninstall" ]]; then - # uninstall + uninstall exit 0 fi