reworked some logic on .sh

This commit is contained in:
Roy 2024-01-29 23:04:03 -08:00 committed by GitHub
parent 0bde135a14
commit d5ef01e05a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,18 +48,7 @@ args=("$@")
#Download Modules
# Check if "Decky Plugin" is one of the arguments
decky_plugin=false
for arg in "${args[@]}"; do
if [ "$arg" = "Decky Plugin" ]; then
decky_plugin=true
break
fi
done
# Define the repository and the folders to clone # Define the repository and the folders to clone
repo_url='https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck/archive/refs/heads/main.zip' repo_url='https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck/archive/refs/heads/main.zip'
folders_to_clone=('requests' 'urllib3' 'steamgrid') folders_to_clone=('requests' 'urllib3' 'steamgrid')
@ -99,6 +88,8 @@ if [ "${folders_exist}" = false ]; then
rm "${zip_file_path}" rm "${zip_file_path}"
rm -r "${parent_folder}/NonSteamLaunchers-On-Steam-Deck-main" rm -r "${parent_folder}/NonSteamLaunchers-On-Steam-Deck-main"
fi fi
#End of Download Modules
#Service File rough update #Service File rough update
rm -rf ${logged_in_home}/.config/systemd/user/NSLGameScanner.py rm -rf ${logged_in_home}/.config/systemd/user/NSLGameScanner.py
@ -121,25 +112,40 @@ curl -o $python_script_path $github_link
# Define the path to the env_vars file # Define the path to the env_vars file
env_vars="${logged_in_home}/.config/systemd/user/env_vars" env_vars="${logged_in_home}/.config/systemd/user/env_vars"
#End of Rough Update of the .py
# Check if the env_vars file exists
if [ -f "$env_vars" ]; then
# If the file exists and the decky_plugin argument is set, run the .py file and then exit
if [ "$decky_plugin" = true ]; then
echo "env_vars file found and Decky Plugin argument set. Running the .py file..."
# Check if "Decky Plugin" is one of the arguments
decky_plugin=false
for arg in "${args[@]}"; do
if [ "$arg" = "Decky Plugin" ]; then
decky_plugin=true
break
fi
done
# If the Decky Plugin argument is set, check if the env_vars file exists
if [ "$decky_plugin" = true ]; then
if [ -f "$env_vars" ]; then
# If the env_vars file exists, run the .py file and continue with the script
echo "Decky Plugin argument set and env_vars file found. Running the .py file..."
python3 $python_script_path python3 $python_script_path
echo "Python script ran. Exiting the script." echo "Python script ran. Continuing with the script..."
exit 0
else else
# If the file exists but the decky_plugin argument is not set, run the .py file # If the env_vars file does not exist, exit the script
echo "env_vars file found but Decky Plugin argument not set. Running the .py file..." echo "Decky Plugin argument set but env_vars file not found. Exiting the script."
python3 $python_script_path exit 0
live="and is LIVE."
fi fi
else else
# If the file does not exist, do not run the .py file # If the Decky Plugin argument is not set, continue with the script
echo "env_vars file not found. Not running the .py file." echo "Decky Plugin argument not set. Continuing with the script..."
live="and is NOT LIVE." python3 $python_script_path
fi fi
@ -147,6 +153,7 @@ fi
# Check if any command line arguments were provided # Check if any command line arguments were provided
if [ ${#args[@]} -eq 0 ]; then if [ ${#args[@]} -eq 0 ]; then
# No command line arguments were provided, so check for updates and display the zenity window if necessary # No command line arguments were provided, so check for updates and display the zenity window if necessary