Skip to content

Commit

Permalink
Fix tkg updater and improve wine updater
Browse files Browse the repository at this point in the history
  • Loading branch information
p-mng committed Apr 27, 2021
1 parent b6a80eb commit aedf886
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
12 changes: 3 additions & 9 deletions proton-tkg-updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,16 @@ install() {
fi
cd "compatibilitytools.d"
# Check if current release is already installed
if [ -d "$(echo "$filename" | sed "s|\.zip||")" ]; then
if [ -d "$(echo "$filename" | sed "s|\.tar\..*||")" ]; then
echo "--> Current version is already installed."
return 0
else
# Download latest release, extract the files and delete the archive
echo "--> Downloading $filename..."
curl -L "$url" --output "$filename"
echo "--> Extracting $filename..."
mkdir "$(echo "$filename" | sed "s|\.zip||")"
# Additional steps required by Proton-TkG (tar within zip has to be unpacked)
unzip -qq "$filename" -d "$(echo "$filename" | sed "s|\.zip||")"
cd "$(echo "$filename" | sed "s|\.zip||")"
mkdir "dist"
tar -xf "proton_dist.tar.gz" -C "dist"
rm "proton_dist.tar.gz"
cd ..
mkdir "$(echo "$filename" | sed "s|\.tar\..*||")"
tar -xf "$filename" -C "$(echo "$filename" | sed "s|\.tar\..*||")"
echo "--> Removing the compressed archive..."
rm "$filename"
echo "--> Done. Please check the command line for errors and restart Steam for the changes to take effect."
Expand Down
20 changes: 16 additions & 4 deletions wine-tkg-git-updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

# Find the latest release url and filename (just like in the other scripts)
url="$(curl -s "https://api.github.com/repos/Frogging-Family/wine-tkg-git/releases/latest" | grep "browser_download_url" | grep "staging" | cut -d \" -f 4)"
filename="$(echo "$url" | sed "s|.*/||")"

# Download the latest version and install it using pacman
echo "--> Downloading and installing the latest wine-tkg..."
# Check if cache dir exists
if [ ! -d "$HOME/.cache/wine-tkg-git-updater" ]; then
mkdir -p "$HOME/.cache/wine-tkg-git-updater"
fi

# Check if current version was alredy downloaded, and if not do so
if [ ! -f "$HOME/.cache/wine-tkg-git-updater/$filename" ]; then
echo "--> Downloading..."
curl -L "$url" -o "$HOME/.cache/wine-tkg-git-updater/$filename"
else
echo "--> Current version has already been downloaded. Trying to install anyway..."
fi

# Install the package
if [ "$(id -u)" = "0" ]; then
echo "--> Installing as root..."
echo
pacman --needed -U "$url"
pacman --needed -U "$HOME/.cache/wine-tkg-git-updater/$filename"
echo
elif [ "$(which sudo)" ]; then
echo "--> Not running as root. Trying to elevate through sudo..."
echo
sudo pacman --needed -U "$url"
sudo pacman --needed -U "$HOME/.cache/wine-tkg-git-updater/$filename"
echo
else
echo "--> Error: Please run the script with root privileges."
Expand Down

0 comments on commit aedf886

Please sign in to comment.