Added App-Installer
This commit is contained in:
57
setup.sh
Executable file
57
setup.sh
Executable file
@@ -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
|
||||||
Reference in New Issue
Block a user