fixed perm bug and tested

This commit is contained in:
Karim 2024-10-10 21:56:03 +02:00 committed by GitHub
parent 10f4d83bb4
commit 68b416f6d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@ symlinkpath="/usr/bin/spotube"
p="/usr/share/spotube-bin" # Path where the tar.xz should be downloaded and unpacked
tmpf="$p/test.tar.xz" # temporary .tar.xz name and location (within Path p)
repo="krtirtho/spotube" # define repo path
arch="aarch64" # arch? either aarch64 or x86_64
arch="x86_64" # arch? either aarch64 or x86_64
url="https://api.github.com/repos/$repo/releases/latest"
u="root" # who is the owner of /usr/share/spotube-bin/
@ -28,7 +28,7 @@ fi
a=$(curl -s "$url" | sed 's/[()",{}]/ /g; s/ /\n/g' | grep "https.*releases/download.*tar.xz" | grep "$arch") # select the correct binary from Github release path via JSON API
if [ -z "$a" ]; then
echo "[ERROR]: UPDATE FAILED: Url '$url' is invalid, exiting."
exit;
exit
fi
# rm "$p/*" -r # optionally remove everything in the folder before (avoiding left overs and other issues)
@ -59,8 +59,8 @@ echo "[+] unpacking completed"
# when updated
rm "$tmpf"
chmod 0400 "$p/lastupdate.txt"
echo "$(date -I'seconds')|$a" >> "$p/lastupdate.txt" # add datetime and tar.xz link entry to lastupdate.txt
chmod 0400 "$p/lastupdate.txt"
echo "[+] UPDATE LOOKS SUCCESSFUL. CHECK BY RUNNING $p/spotube"
echo "[+] updated symlink of /usr/bin/spotube to '$p'/spotube "
ln -sfn "$p/spotube" "$symlinkpath" # force update or creation of symlink
ln -sfn "$p/spotube" "$symlinkpath"