fix: remove SteamOS prompt in favor of automatic detection (#87)

This commit is contained in:
v4n
2025-09-16 15:05:08 +03:00
committed by GitHub
parent 84cbc80eb2
commit 96163fc7d9
+16 -9
View File
@@ -61,22 +61,29 @@ if [[ -x "$(command -v h2mm)" ]]; then
fi fi
fi fi
# if steam deck, set destination path to ~/.local/bin # if steam os, set destination path to ~/.local/bin
log PROMPT "Are you installing on a Steam Deck? (y/N): " steamos=false
IFS= read -e response_sd
if [[ "$response_sd" == "y" || "$response_sd" == "Y" ]]; then if [[ -f "/etc/os-release" ]]; then
# steam deck if grep -q "ID=steamos" /etc/os-release; then
steamos=true
fi
fi
if [[ $steamos == true ]]; then
# steam os
DESTINATION_PATH="$HOME/.local/bin" DESTINATION_PATH="$HOME/.local/bin"
log INFO "Detected SteamOS, setting installation path to ${ORANGE}$DESTINATION_PATH${NC}."
mkdir -p "$DESTINATION_PATH" mkdir -p "$DESTINATION_PATH"
# check if ~/.local/bin is in PATH # check if ~/.local/bin is in PATH
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
# add ~/.local/bin to PATH # add ~/.local/bin to PATH
log INFO "Installing the script on a Steam Deck means adding $DESTINATION_PATH to your \$PATH." log INFO "Installing the script on SteamOS means adding ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH."
log INFO "If you're using a different shell than bash (the default), you may need to add it manually." log INFO "If you're using a different shell than bash (the default), you may need to add it manually."
log PROMPT "Do you want to add $DESTINATION_PATH to your \$PATH in ~/.bashrc? (Y/n): " log PROMPT "Do you want to automatically add ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc? (Y/n): "
IFS= read -e response IFS= read -e response
if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then if [[ "$response" == "y" || "$response" = "Y" || -z "$response" ]]; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc" echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> "$HOME/.bashrc"
@@ -85,11 +92,11 @@ if [[ "$response_sd" == "y" || "$response_sd" == "Y" ]]; then
source "$HOME/.bashrc" source "$HOME/.bashrc"
export PATH="$HOME/.local/bin:$PATH" # fallback kinda in case sourcing fails export PATH="$HOME/.local/bin:$PATH" # fallback kinda in case sourcing fails
log INFO "Added $DESTINATION_PATH to your \$PATH in ~/.bashrc." log INFO "Added ${ORANGE}$DESTINATION_PATH${NC} to your \$PATH in ~/.bashrc."
fi fi
fi fi
else else
# not steam deck # not steam os
# set another path if needed # set another path if needed
log PROMPT "Install the script to ${ORANGE}$DESTINATION_PATH${NC} or specify another path (must be included in \$PATH)? (Y/path): " log PROMPT "Install the script to ${ORANGE}$DESTINATION_PATH${NC} or specify another path (must be included in \$PATH)? (Y/path): "
IFS= read -e response IFS= read -e response