From de714d18e6b0cc212ec9e205798bf914c5bbc325 Mon Sep 17 00:00:00 2001 From: Rodolfo Date: Thu, 27 Jun 2024 13:08:47 +0800 Subject: [PATCH] Set up script structure --- debian-assets/debian-bash-pkgs.txt | 3 ++ scripts/system-setup/git-setup.sh | 3 ++ scripts/system-setup/sources-setup.sh | 29 +++++++++++++++++ scripts/system-setup/sudo-setup.sh | 3 ++ system-setup.sh | 45 +++++++++++---------------- 5 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 debian-assets/debian-bash-pkgs.txt create mode 100755 scripts/system-setup/git-setup.sh create mode 100755 scripts/system-setup/sources-setup.sh create mode 100755 scripts/system-setup/sudo-setup.sh diff --git a/debian-assets/debian-bash-pkgs.txt b/debian-assets/debian-bash-pkgs.txt new file mode 100644 index 0000000..9dbe380 --- /dev/null +++ b/debian-assets/debian-bash-pkgs.txt @@ -0,0 +1,3 @@ +fzf +7zip +batcat diff --git a/scripts/system-setup/git-setup.sh b/scripts/system-setup/git-setup.sh new file mode 100755 index 0000000..e5f897c --- /dev/null +++ b/scripts/system-setup/git-setup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "git-setup" diff --git a/scripts/system-setup/sources-setup.sh b/scripts/system-setup/sources-setup.sh new file mode 100755 index 0000000..a484985 --- /dev/null +++ b/scripts/system-setup/sources-setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +APT_CMD=$(which apt-get) +PACMAN_CMD=$(which pacman) + +if [[ ! -z $APT_CMD ]]; then + + echo "System Identified: Debian" + echo "apt-get update && apt-get -y upgrade" + + while true;do + read -rp "Would you like to use Debian Unstable? (y/n): " answer + answer="${answer,,}" + if [[ "$answer" = "y" ]]; then + echo "Change apt sources" + echo "cp -v ./debian-assets/debian-sid-sources.list /etc/sources.list" + echo "apt-get update && apt-get -y dist-upgrade" + break + elif [[ "$answer" = "n" ]]; then + echo "Proceeding with Debian Stable" + break + else + echo "Invalid Input. Please enter 'y' or 'n'." + fi + done + +elif [[ ! -z $PACMAN_CMD ]]; then + echo "Arch" +fi diff --git a/scripts/system-setup/sudo-setup.sh b/scripts/system-setup/sudo-setup.sh new file mode 100755 index 0000000..c191751 --- /dev/null +++ b/scripts/system-setup/sudo-setup.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "sudo setup" diff --git a/system-setup.sh b/system-setup.sh index 86daf39..8c64207 100755 --- a/system-setup.sh +++ b/system-setup.sh @@ -1,34 +1,25 @@ #!/bin/bash +# Parent installer for all System Setup Scripts. + APT_CMD=$(which apt-get) PACMAN_CMD=$(which pacman) -if [[ ! -z $APT_CMD ]]; then - +if [[ -z $APT_CMD ]]; then + system=Debian echo "System Identified: Debian" - # Make sure System is Updated - echo "apt-get update && apt-get upgrade -Y" - #apt update && apt upgrade -Y - - # Setup apt sources - while true;do - read -rp "Would you like to use Debian Unstable? (y/n): " answer - answer="${answer,,}" - if [[ "$answer" = "y" ]]; then - echo "Change apt sources" - echo "cp -v ./debian-assets/debian-sid-sources.list /etc/sources.list" - echo "apt-get update && apt-get upgrade -Y" - break - elif [[ "$answer" = "n" ]]; then - echo "Proceeding with Debian Stable" - break - else - echo "Invalid Input. Please enter 'y' or 'n'." - fi - done - - # Start System Setup - -elif [[ ! -z $PACMAN_CMD ]]; then - echo "Arch" +elif [[ -z $PACMAN_CMD ]]; then + system=Arch + echo "System Identified: Arch" +else + echo "System Misconfigured" + break fi + +systemsetup="./scripts/" + +bash $systemsetup/sources-setup.sh $system +bash $systemsetup/sudo-setup.sh $system +bash $systemsetup/git-setup.sh $system + +echo "done"