From 5c0d0fd521d07d68d714f60046b0106c68d586f5 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 20 May 2026 17:31:29 +0200 Subject: [PATCH] small security changes --- ersc-script.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ersc-script.sh b/ersc-script.sh index 2f08c7b..08f9688 100755 --- a/ersc-script.sh +++ b/ersc-script.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail search_paths=("$HOME/.steam/steam/steamapps/common" "$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common" "$HOME/.local/share/Steam/steamapps/common" "/mnt" "/") repository_url="https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest" @@ -10,11 +11,11 @@ read -p "Do you want to use the official Github-Repository [d] to download the m if [[ $input == "l" || $input == "L" || $input == "local" || $input == "Local" ]]; then echo "Searching Downloads folder..." - local_path=$(timeout 5 find $HOME/Downloads -iname Seamless*.zip) || true + local_path=$(timeout 5 find "$HOME/Downloads" -iname Seamless*.zip) || true - if [[ -f "$local_path" && "$local_path" =~ ^.*Seamless.*.zip$ ]]; then + if [[ -f "$local_path" && "$local_path" =~ ^.*Seamless.*\.zip$ ]]; then echo "File found at $local_path" - + else echo "File not found in $HOME/Downloads" read -p "Please specify the path to your local .zip archive: " input @@ -27,7 +28,7 @@ if [[ $input == "l" || $input == "L" || $input == "local" || $input == "Local" ] echo "File found at $local_path" elif [[ ! -z "$input" ]]; then - local_path=$(timeout 5 find $input -iname Seamless*.zip) + local_path=$(timeout 5 find "$input" -iname Seamless*.zip) if [[ -f "$local_path" ]]; then echo "File found at $local_path" else @@ -73,6 +74,12 @@ input="" echo "Creating temp folder" temp_dir=$(mktemp -d) + + +cleanup() { + rm -rf "$temp_dir" +} + cd "$temp_dir" if [[ -z $sc_download_url && -f $local_path ]]; then @@ -103,10 +110,6 @@ rsync -r --remove-source-files * "$eldenring_dir" echo "Deleting temp download folder" -cleanup() { - rm -rf "$temp_dir" -} - trap cleanup EXIT echo "Done"