From 2ac236219debae51605d12b24c555b208c851c1b Mon Sep 17 00:00:00 2001 From: taicrafter Date: Sun, 10 May 2026 18:42:18 +0200 Subject: [PATCH] Added App-Installer --- setup.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 setup.sh diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..f413d91 --- /dev/null +++ b/setup.sh @@ -0,0 +1,57 @@ +#!/bin/bash +URI="https://git.scypher.org/taicrafter/helperScripts/raw/branch/main/" +function _promptBool(){ + while true; do + read -r -p "$1 [y/n]: " res < /dev/tty + if [[ "$res" == "Y" || "$res" == "y" ]]; then + return 0; + elif [[ "$res" == "N" || "$res" == "n" ]]; then + return 1; + fi + done +} +function detectOS(){ + if [ -f /etc/debian_version ]; then + OS_TYPE="deb" + elif [ -f /etc/arch-release ]; then + OS_TYPE="arch" + else + echo "Unable to detect OS..." + if _promptBool "Manually set to Debian?"; then + OS_TYPE="deb" + elif _promptBool "Manually set to Arch?"; then + OS_TYPE="arch" + else + echo "Failed OS-Detection"; + exit 1 + fi + fi + echo "Detected OS-Type: $OS_TYPE" + export OS_TYPE +} +function AppInstaller(){ + #Get App-List for OS + if _promptBool "Use Source: $URI?"; then + echo "Downloading App List..." + APPS=$(curl -fsSL "$URI/$OS_TYPE/apps.txt"); + COUNT=$(echo "$APPS" | wc -l); + #TODO Handle 404 or 0 Installers + echo "Found $COUNT Installers..." + TMP_FILE=$(mktemp) + while IFS= read -r APPNAME; do + #Handle Install + if _promptBool "Install $APPNAME?"; then + echo "Downloading Installer: $URI/$OS_TYPE/$APPNAME.sh" + curl -fsSL "$URI/$OS_TYPE/$APPNAME.sh" -o "$TMP_FILE" + bash "$TMP_FILE" + fi + done <<< "$APPS" + else + echo "Aborted App-Installer!" + fi +} +#Main +detectOS +if _promptBool "Run App-Installer?"; then + AppInstaller +fi \ No newline at end of file