From 393ec31287f79caa247f5188d2c661d9586dded3 Mon Sep 17 00:00:00 2001 From: wasabi Date: Thu, 29 May 2025 15:14:38 -0500 Subject: [PATCH] Progress --- install.sh | 41 +++++---- src/scripts/config.sh | 90 +++++++++++++++++++ src/scripts/sim/setup.sh | 66 ++++++++++++++ .../sim/steamtricks_install_manager.sh | 4 +- src/steamtricks.conf | 3 + webinstall.sh | 7 +- 6 files changed, 192 insertions(+), 19 deletions(-) create mode 100644 src/scripts/config.sh create mode 100644 src/scripts/sim/setup.sh rename multiple_install_manager.sh => src/scripts/sim/steamtricks_install_manager.sh (97%) create mode 100644 src/steamtricks.conf diff --git a/install.sh b/install.sh index a723303..f8340f1 100644 --- a/install.sh +++ b/install.sh @@ -1,23 +1,32 @@ #!/usr/bin/env bash +install () { + mkdir ~/.steamtricks + cp src/* ~/.steamtricks + export SHELLPROFILE="~/.${1}rc" + echo "export STEAMTRICKS_PREFIX=\"~/.steamtricks\"">>"${SHELLPROFILE}" + echo "source ~/.steamtricks/steamtricks.conf">>"${SHELLPROFILE}" + source "${SHELLPROFILE}" + edit_prefix -install_manager () { - case "$1" in - sh) echo "Shell not supported"; exit 1 - ;; - bash | zsh) cat multiple_install_manager.sh >> "${HOME}/.${1}rc" - ;; - *) echo "You will need to install this by manually adding it to either your /etc/profile for system-wide installation or to your shell's profile" - ;; - esac } -echo "Would you like to install the multiple-install game manager?" -echo -n "[y/N]: " -read ANS +install_manager () { + case "$1" in + sh | fish) echo "Shell ${SHELL} not supported"; exit 1 + ;; + bash | zsh | yash) install + ;; + *) echo "You will need to install this by manually adding it to either your /etc/profile for system-wide installation or to your shell's profile" + ;; + esac +} + + +read -r -p "Would you like to install the multiple-install game manager? [y/N]" ANS case "$ANS" in - y* | Y* ) install_manager $(echo $SHELL | awk -F "/" '{print $NF}') - ;; - *) echo "Aborting with no change"; exit 1 - ;; + [yY]* ) install_manager "$(echo $SHELL | awk -F "/" '{print $NF}')" + ;; + *) echo "Aborting with no change"; exit 1 + ;; esac diff --git a/src/scripts/config.sh b/src/scripts/config.sh new file mode 100644 index 0000000..e0cdfa3 --- /dev/null +++ b/src/scripts/config.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +list_tools () { + echo "Available tools in this version:" + echo "sim Steamtricks Install Manager" +} + +test_enable () { + + +steamtricks_enable () { + if [ "$#" -ne 1 ]; then + echo "Usage:" + echo "steamtricks_enable " + list_tools + exit 1 + fi + + source "${STEAMTRICKS_PREFIX}/steamtricks.conf" + + case "${1}" in + sim | SIM) +} + + +local sed_steam_prefix () { + export SHELLPROFILE="${1}" + while true; do + read -r -p "What would you like your STEAMPREFIX to be?: " ANS1 + read -r -p "is ${ANS1} correct?" ANS2 + case "${ANS2}" in + [yY]* ) echo "s|STEAMPREFIX=.?|STEAMPREFIX=\"${ANS1}\"|g" >>"/tmp/steamprefix.sed"; sed -i -f "/tmp/steamprefix.sed" "${SHELLPROFILE}"; break + ;; + *) + ;; + esac + done +} + +edit_steam_prefix () { + export SHELLPROFILE="${1}" + + echo "Your prefix is currently set to: ${STEAMPREFIX}" + echo "If this is not where you install your games," + echo "you will need to set it to the path where your" + echo "steamapps/common folder exists." + + echo "" + echo "Some common defaults: " + echo "1: /var/games/SteamLibrary/steamapps/common - Default" + echo "2. ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common - flatpak default" + echo "3. ~/.steam/steam/steamapps/common - system package default" + echo "4. ~/.local/share/steam/steamapps/common - old system package default" + echo "5. I have changed it, enter a custom path" + + while true; do + read -r -p "Choice [1-5]: " ANS + case "$ANS" in + 1) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="/var|games/SteamLibrary/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 2) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 3) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.steam/steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 4) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.local/share/steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 5) sed_steam_prefix; break + ;; + *) echo "Please select an option between 1 and 5" + ;; + esac + done + +} + +steam_prefix_config () { + export SHELLPROFILE="~/.${1}rc" + source "~/.${1}rc" + echo "The current STEAMPREFIX variable is set to ${STEAMPREFIX}" + echo -n "Do you wish to change this? [y/N]: " + read ANS + + case "$ANS" in + y* | Y* ) sed_prefix "${SHELLPROFILE}" + ;; + * ) echo "Installation complete" + ;; + esac + +} diff --git a/src/scripts/sim/setup.sh b/src/scripts/sim/setup.sh new file mode 100644 index 0000000..6a6190c --- /dev/null +++ b/src/scripts/sim/setup.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +sed_steam_prefix () { + export SHELLPROFILE="${1}" + while true; do + read -r -p "What would you like your STEAMPREFIX to be?: " ANS1 + read -r -p "is ${ANS1} correct?" ANS2 + case "${ANS2}" in + [yY]* ) echo "s|STEAMPREFIX=.?|STEAMPREFIX=\"${ANS1}\"|g" >>"/tmp/steamprefix.sed"; sed -i -f "/tmp/steamprefix.sed" "${SHELLPROFILE}"; break + ;; + *) + ;; + esac + done +} + +edit_steam_prefix () { + export SHELLPROFILE="${1}" + + echo "Your prefix is currently set to: ${STEAMPREFIX}" + echo "If this is not where you install your games," + echo "you will need to set it to the path where your" + echo "steamapps/common folder exists." + + echo "" + echo "Some common defaults: " + echo "1: /var/games/SteamLibrary/steamapps/common - Default" + echo "2. ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common - flatpak default" + echo "3. ~/.steam/steam/steamapps/common - system package default" + echo "4. ~/.local/share/steam/steamapps/common - old system package default" + echo "5. I have changed it, enter a custom path" + + while true; do + read -r -p "Choice [1-5]: " ANS + case "$ANS" in + 1) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="/var|games/SteamLibrary/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 2) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 3) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.steam/steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 4) sed -i 's|STEAMPREFIX=.?$|STEAMPREFIX="~/.local/share/steam/steamapps/common"|g' "${SHELLPROFILE}"; break + ;; + 5) sed_steam_prefix; break + ;; + *) echo "Please select an option between 1 and 5" + ;; + esac + done + +} + +steam_prefix_config () { + export SHELLPROFILE="~/.${1}rc" + source "~/.${1}rc" + echo "The current STEAMPREFIX variable is set to ${STEAMPREFIX}" + echo -n "Do you wish to change this? [y/N]: " + read ANS + + case "$ANS" in + y* | Y* ) sed_prefix "${SHELLPROFILE}" + ;; + * ) echo "Installation complete" + ;; + esac + +} diff --git a/multiple_install_manager.sh b/src/scripts/sim/steamtricks_install_manager.sh similarity index 97% rename from multiple_install_manager.sh rename to src/scripts/sim/steamtricks_install_manager.sh index 46af9f8..b9f5349 100644 --- a/multiple_install_manager.sh +++ b/src/scripts/sim/steamtricks_install_manager.sh @@ -1,6 +1,6 @@ -# STEAMPREFIX is simply the path to where your steam games are installed. My library is in /var/games, but you may change it to your liking -export STEAMPREFIX="/var/games/SteamLibrary/steamapps/common" +#!/usr/bin/env bash +# STEAMPREFIX is simply the path to where your steam games are installed. My library is in /var/games, but you may change it to your liking # This function will change symbolic links from your steamapps/common folder to the install location of whichever game you wish. I use this # for managing stable and beta versions of Project Zomboid, but you can use them for any game diff --git a/src/steamtricks.conf b/src/steamtricks.conf new file mode 100644 index 0000000..8352e3c --- /dev/null +++ b/src/steamtricks.conf @@ -0,0 +1,3 @@ +ENABLE_STEAMTRICKS_CONFIG=1 +ENABLE_STEAMTRICKS_INSTALL_MANAGER=1 +ENABLE_STEAMTRICKS_SETUP=1 diff --git a/webinstall.sh b/webinstall.sh index 0ec5dc6..4e530f9 100644 --- a/webinstall.sh +++ b/webinstall.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash +install_steamtricks () { + curl | tar -xvC ~/.steamtricks + +} + SHELLNAME=$(echo $SHELL | awk -F '/' '{print $NF}') case "$SHELLNAME" in sh) echo "Shell not supported"; exit 1 ;; - bash | zsh) curl https://raw.githubusercontent.com/charwrangler404/steamtricks/refs/heads/main/multiple_install_manager.sh >> "${HOME}/.${SHELLNAME}rc"; echo "Installed to ${HOME}/.${SHELLNAME}rc" + bash | zsh | yash) install_steamtricks ;; *) echo "You will need to install this by manually adding it to either your /etc/profile for system-wide installation or to your shell's profile" ;;