Added nopython logic for decky

This commit is contained in:
sysmoon14 2024-03-06 09:40:33 +00:00 committed by GitHub
parent a0ec6cd09f
commit b3f1cfe346
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,28 +51,35 @@ check_for_updates() {
# Get the command line arguments # Get the command line arguments
args=("$@") args=("$@")
for arg in "${args[@]}"; do
if [ "$arg" = "NoPython" ]; then
#Download Modules nopython=true
# Define the repository and the folders to clone
repo_url='https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck/archive/refs/heads/main.zip'
folders_to_clone=('requests' 'urllib3' 'steamgrid' 'vdf')
# Define the parent folder
logged_in_home=$(eval echo ~$user)
parent_folder="${logged_in_home}/.config/systemd/user/Modules"
mkdir -p "${parent_folder}"
# Check if the folders already exist
folders_exist=true
for folder in "${folders_to_clone[@]}"; do
if [ ! -d "${parent_folder}/${folder}" ]; then
folders_exist=false
break break
fi fi
done done
if [ "${folders_exist}" = false ]; then if ["$nopython" = false]; then
#Download Modules
# Define the repository and the folders to clone
repo_url='https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck/archive/refs/heads/main.zip'
folders_to_clone=('requests' 'urllib3' 'steamgrid' 'vdf')
# Define the parent folder
logged_in_home=$(eval echo ~$user)
parent_folder="${logged_in_home}/.config/systemd/user/Modules"
mkdir -p "${parent_folder}"
# Check if the folders already exist
folders_exist=true
for folder in "${folders_to_clone[@]}"; do
if [ ! -d "${parent_folder}/${folder}" ]; then
folders_exist=false
break
fi
done
if [ "${folders_exist}" = false ]; then
# Download the repository as a zip file # Download the repository as a zip file
zip_file_path="${parent_folder}/repo.zip" zip_file_path="${parent_folder}/repo.zip"
wget -O "${zip_file_path}" "${repo_url}" wget -O "${zip_file_path}" "${repo_url}"
@ -92,57 +99,57 @@ if [ "${folders_exist}" = false ]; then
# Delete the downloaded zip file and the extracted repository folder # Delete the downloaded zip file and the extracted repository folder
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 #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
# Delete the service file # Delete the service file
rm -rf ${logged_in_home}/.config/systemd/user/nslgamescanner.service rm -rf ${logged_in_home}/.config/systemd/user/nslgamescanner.service
# Remove the symlink # Remove the symlink
unlink ${logged_in_home}/.config/systemd/user/default.target.wants/nslgamescanner.service unlink ${logged_in_home}/.config/systemd/user/default.target.wants/nslgamescanner.service
# Reload the systemd user instance # Reload the systemd user instance
systemctl --user daemon-reload systemctl --user daemon-reload
# Define your Python script path # Define your Python script path
python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py" python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py"
# Define your GitHub link # Define your GitHub link
github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py" github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py"
curl -o $python_script_path $github_link 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 #End of Rough Update of the .py
if [ -f "$env_vars" ]; then if [ -f "$env_vars" ]; then
echo "env_vars file found. Running the .py file." echo "env_vars file found. Running the .py file."
live="and is LIVE." live="and is LIVE."
else else
echo "env_vars file not found. Not Running the .py file." echo "env_vars file not found. Not Running the .py file."
live="and is not LIVE." live="and is not LIVE."
fi fi
# Check if "Decky Plugin" is one of the arguments # Check if "Decky Plugin" is one of the arguments
decky_plugin=false decky_plugin=false
for arg in "${args[@]}"; do for arg in "${args[@]}"; do
if [ "$arg" = "Decky Plugin" ]; then if [ "$arg" = "Decky Plugin" ]; then
decky_plugin=true decky_plugin=true
break break
fi fi
done done
# If the Decky Plugin argument is set, check if the env_vars file exists # If the Decky Plugin argument is set, check if the env_vars file exists
if [ "$decky_plugin" = true ]; then if [ "$decky_plugin" = true ]; then
if [ -f "$env_vars" ]; then if [ -f "$env_vars" ]; then
# If the env_vars file exists, run the .py file and continue with the script # 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..." echo "Decky Plugin argument set and env_vars file found. Running the .py file..."
@ -153,12 +160,13 @@ if [ "$decky_plugin" = true ]; then
echo "Decky Plugin argument set but env_vars file not found. Exiting the script." echo "Decky Plugin argument set but env_vars file not found. Exiting the script."
exit 0 exit 0
fi fi
else else
# If the Decky Plugin argument is not set, continue with the script # If the Decky Plugin argument is not set, continue with the script
echo "Decky Plugin argument not set. Continuing with the script..." echo "Decky Plugin argument not set. Continuing with the script..."
python3 $python_script_path python3 $python_script_path
echo "env_vars file found. Running the .py file." echo "env_vars file found. Running the .py file."
live="and is LIVE." live="and is LIVE."
fi
fi fi
@ -166,7 +174,6 @@ 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
@ -2757,31 +2764,31 @@ fi
if ["$nopython" = false]; then
#Setup NSLGameScanner.service
python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py"
#Setup NSLGameScanner.service # Define your GitHub link
python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py" github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py"
# Define your GitHub link # Check if the service is already running
github_link="https://raw.githubusercontent.com/moraroy/NonSteamLaunchers-On-Steam-Deck/main/NSLGameScanner.py" service_status=$(systemctl --user is-active nslgamescanner.service)
# Check if the service is already running if [ "$service_status" = "active" ] || [ "$service_status" = "activating" ]
service_status=$(systemctl --user is-active nslgamescanner.service) then
if [ "$service_status" = "active" ] || [ "$service_status" = "activating" ]
then
echo "Service is already running or activating. Stopping the service..." echo "Service is already running or activating. Stopping the service..."
systemctl --user stop nslgamescanner.service systemctl --user stop nslgamescanner.service
fi
echo "Updating Python script from GitHub..."
curl -o $python_script_path $github_link
echo "Starting the service..."
python3 $python_script_path
fi fi
echo "Updating Python script from GitHub..."
curl -o $python_script_path $github_link
echo "Starting the service..."
python3 $python_script_path