Skip to content

Commit

Permalink
Ludusavi Game Save Backups
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Sep 8, 2024
1 parent bc1440c commit e98bd5d
Showing 1 changed file with 194 additions and 1 deletion.
195 changes: 194 additions & 1 deletion NonSteamLaunchers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ exec > >(tee -a $log_file) 2>&1


# Version number (major.minor)
version=v3.9.3
version=v3.9.4

# TODO: tighten logic to check whether major/minor version is up-to-date via `-eq`, `-lt`, or `-gt` operators
# Check repo releases via GitHub API then display current stable version
Expand Down Expand Up @@ -1144,6 +1144,15 @@ export STEAM_COMPAT_DATA_PATH="${logged_in_home}/.local/share/Steam/steamapps/co



if [[ $options == *"NSLGameSaves"* ]]; then
echo "Running restore..."
nohup flatpak run com.github.mtkennerly.ludusavi restore --force > /dev/null 2>&1 &
wait $!
echo "Restore completed"
zenity --info --text="Restore was successful" --timeout=5
exit 0
fi

###Launcher Installations
#Terminate Processese
function terminate_processes {
Expand Down Expand Up @@ -1613,7 +1622,191 @@ if [[ $options == *"Netflix"* ]] || [[ $options == *"Fortnite"* ]] || [[ $option
fi
fi

echo "99.1"
echo "# Checking if Ludusavi is installed...please wait..."

# AutoInstall Ludusavi
# Check if Ludusavi is already installed
if flatpak list | grep com.github.mtkennerly.ludusavi &> /dev/null; then
echo "Ludusavi is already installed"
else
# Check if the Flathub repository exists
if flatpak remote-list | grep flathub &> /dev/null; then
echo "Flathub repository exists"
else
# Add the Flathub repository
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi

# Install Ludusavi
flatpak install --user flathub com.github.mtkennerly.ludusavi -y
fi

echo "Ludusavi installation script completed"

# Ensure Ludusavi is installed before proceeding
if ! flatpak list | grep com.github.mtkennerly.ludusavi &> /dev/null; then
echo "Ludusavi installation failed. Exiting script."
exit 1
fi

rclone_zip_url="https://downloads.rclone.org/rclone-current-linux-amd64.zip"
rclone_zip_file="${logged_in_home}/Downloads/NonSteamLaunchersInstallation/rclone-current-linux-amd64.zip"
rclone_extract_dir="${logged_in_home}/Downloads/NonSteamLaunchersInstallation/rclone-v1.67.0-linux-amd64"
rclone_bin="${rclone_extract_dir}/rclone"

# Download and extract rclone
if [ -d "${logged_in_home}/Downloads/NonSteamLaunchersInstallation" ]; then
echo "Downloading rclone..."
wget -O "$rclone_zip_file" "$rclone_zip_url"
echo "Extracting rclone..."
unzip -o "$rclone_zip_file" -d "${logged_in_home}/Downloads/NonSteamLaunchersInstallation"
echo "rclone downloaded and extracted"
else
echo "Download directory does not exist. Exiting script."
exit 1
fi

# Setting up Backup Saves through Ludusavi

# Define the directory and file path
config_dir="${logged_in_home}/.var/app/com.github.mtkennerly.ludusavi/config/ludusavi"
config_file="$config_dir/config.yaml"
backup_dir="$config_dir/config_backups"
timestamp=$(date +%m-%d-%Y_%H:%M:%S)
backup_config_file="$backup_dir/config.yaml.bak_$timestamp"

# Create the backup directory if it doesn't exist
mkdir -p "$backup_dir"

# Backup existing config.yaml if it exists
if [ -f "$config_file" ]; then
cp "$config_file" "$backup_config_file"
echo "Existing config.yaml backed up to $backup_config_file"
fi

# Create the directory if it doesn't exist
mkdir -p "$config_dir"

# Move rclone to the config directory
mv "$rclone_bin" "$config_dir"
rclone_path="${config_dir}/rclone"

# Write the configuration to the file
cat <<EOL > "$config_file"
---
runtime:
threads: ~
release:
check: true
manifest:
enable: true
language: en-US
theme: light
roots:
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/NonSteamLaunchers/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/EpicGamesLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/GogGalaxyLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/UplayLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/Battle.netLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/TheEAappLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/AmazonGamesLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/itchioLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/LegacyGamesLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/HumbleGamesLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/IndieGalaLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/RockstarGamesLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/GlyphLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/PlaystationPlusLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/VKPlayLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/HoYoPlayLauncher/pfx/drive_c/
- store: otherWindows
path: ${logged_in_home}/.local/share/Steam/steamapps/compatdata/NexonLauncher/pfx/drive_c/
redirects: []
backup:
path: ${logged_in_home}/NSLGameSaves
ignoredGames: []
filter:
excludeStoreScreenshots: false
cloud:
exclude: false
epic: false
gog: false
origin: false
steam: false
uplay: false
ignoredPaths: []
ignoredRegistry: []
toggledPaths: {}
toggledRegistry: {}
sort:
key: status
reversed: false
retention:
full: 1
differential: 0
format:
chosen: simple
zip:
compression: deflate
compression:
deflate:
level: 6
bzip2:
level: 6
zstd:
level: 10
restore:
path: ${logged_in_home}/NSLGameSaves
ignoredGames: []
toggledPaths: {}
toggledRegistry: {}
sort:
key: status
reversed: false
scan:
showDeselectedGames: true
showUnchangedGames: true
showUnscannedGames: true
cloud:
remote: ~
path: NSLGameSaves
synchronize: true
apps:
rclone:
path: "$rclone_path"
arguments: "--fast-list --ignore-checksum"
customGames: []
EOL

echo "Configuration file created at $config_file"
# Update the manifest
echo "Updating manifest..."
flatpak run com.github.mtkennerly.ludusavi manifest update
echo "Manifest update completed"

# Run Once
echo "Running backup..."
nohup flatpak run com.github.mtkennerly.ludusavi backup --force > /dev/null 2>&1 &
wait $!
echo "Backup completed"
# End of Ludusavi configuration



Expand Down

0 comments on commit e98bd5d

Please sign in to comment.