#!/usr/bin/bash ####################################################################### #Script Name: docker_setup_deb.sh #Version: 1.6 #Description: Wrapper for installing Docker server #Last Modify Date: 03102021 #Author:Brent Dacus #Email:brent[at]thedacus[dot]net ####################################################################### # Banner # ####################################################################### export COLUMNS=100 dasetup_banner() { cat <<"eot" ad88888ba d8" "8b ,d DdadPPYba, Y8, 88 HH 8b ,;PGGPYb:, ,dPPYba, `Y8aaaaa, ,adPPYba, MM88MMM 88 88 8b,dPPYba, a8 44 8" "8 88 `"""""8b, a8P_____88 88 88 88 88P' "8a 8b 55 88 88 88 `8b 8PP""""""" 88 88 88 88 d8 D8 aa "8a, ,a8" 88 Y8a a8P "8b, ,aa 88, "8a, ,a88 88b, ,a8" TTTYbbd8"' `"YbbdP" 'YbboooC' "Y88888P" `"Ybbd8"' "Y888 `"YbbdP'Y8 88`YbbdP"' 88 88 eot cat <<"eot" Author: Brent Dacus eot } ####################################################################### # Variables # ####################################################################### cur_hostname="$(hostname)" serverip="$(hostname -I | awk '{print $1}')" serverip6="$(hostname -I | awk '{print $2}')" servername="$(hostname -s)" svrdomainname="$(hostname -d)" hstdomainname=delainhosting.com #os=$(uname) #vn=$(uname -v | tr -dc '0-9.' | cut -d \. -f1) cpu_cores=1 cpu_cores="$(cat /proc/cpuinfo | grep -F 'model name' | wc -l)" logfile=/root/install.log builddir=~/dkrsetupbuild/ aptargs="-y" export DA_EMAIL="tech@delainhosting.com" ####################################################################### # User Variables # ####################################################################### rootemail="tech@delainhosting.com" kc_key="JOfCWN9tFkOYi1sl" bshrc="/root/.bashrc" ####################################################################### # Main Util Functions # ####################################################################### mkdir -p ~/dkrsetupbuild/ trap '' 2 # ignore ctrl+c ##set PS3 prompt## PS3="Number selection? " linebreak() { printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - } random_pass() { #No special characters yet, because they'd cause problems with regexes and PEAR::DB to split the DNS string correctly in roundcube config.inc.php rpc=${1:-$(perl -le 'print int rand(7) + 10')} tr -cd 'a-za-z0-9' /dev/null | head -c${rpc} # perl generates a random integer between 10 and 16 } doreboot() { printf "Need to reboot? (y/n)? " read -r yn yn=${yn:-n} case $yn in [Yy]*) reboot ;; [Nn]*) ;; esac } cycleswap() { printf "Cycling Swapfile.\n" swapoff -a sleep 10 swapon -a } ####################################################################### # Add Admin User # ####################################################################### addadminuser() { printf "Installing Standard packages.\n" printf "Please Wait.\n" apt-get install ${aptargs} curl nano btop >/dev/null bshrvals=("alias fbc='fail2ban-client status '" "export EDITOR='nano'") printf 'Adding values in to %s.\n Please wait.\n' "$bshrc" for bshrval in "${bshrvals[@]}"; do if grep -q "$bshrval" ${bshrc}; then printf '%s exists.\n Skipping.\n' "$bshrval" else printf '%s does not exist\n' "$bshrval" printf '#added by DH.\n' >>${bshrc} printf '%s\n' "$bshrval" >>${bshrc} fi done grep -q daconf /root/.bashrc # if not then create it if [ $? -ne 0 ]; then printf 'Bash shell profile not set up. adding...\n' cat <<"eol" >>/root/.bashrc export EDITOR='nano' export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias mysqladmin='mysqladmin --defaults-extra-file=/usr/local/directadmin/conf/my.cnf' alias mysqldump='mysqldump --defaults-extra-file=/usr/local/directadmin/conf/my.cnf' alias mysql='mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf' alias lh='history |grep ' alias search='find / -name ' alias doserver='curl -o docker_setup_deb.sh -L https://files.delaintech.com/docker_setup_deb.sh && bash docker_setup_deb.sh' eol printf "Print Profile File.\n" cat /root/.bashrc printf "Done.\n" else printf "Profile already setup. See Below.\n" cat /root/.bashrc fi } ####################################################################### # Turn on IPV6 # ####################################################################### setipv6() { printf "Do we need to turn on IPV6? REBOOT REQUIRED (y/n)? " read -r yn yn=${yn:-n} case $yn in [Yy]*) sed -i "/net.ipv6.conf.all.disable_ipv6.*/d" /etc/sysctl.conf sysctl -q -p echo 0 >/proc/sys/net/ipv6/conf/all/disable_ipv6 ${da} set ipv6 1 doreboot systemctl restart directadmin ;; [Nn]*) ;; esac } ####################################################################### # Set Timezone # ####################################################################### settimezone() { printf "What TimeZone are you in? [America/Chicago]: " read -r tmzone tmzone=${tmzone:-America/Chicago} grep -E "^$tmzone" /etc/timezone >/dev/null if [ $? -eq 0 ]; then printf "%s found\n" "$tmzone" else timedatectl set-timezone "$tmzone" printf "We set timezone as:\n" timedatectl printf "Done.\n" fi } ####################################################################### # Add Hosts file # ####################################################################### creathostfile() { # does the Host already exist? grep -q ${hstdomainname} /etc/hosts # if not then create it if [ $? -ne 0 ]; then printf 'Hostfile not found. adding...\n' cat <<"eol" >>/etc/hosts 209.126.81.64 apollo.delainhosting.com apollo 209.145.52.110 athena.delainhosting.com athena 144.91.108.77 thor.delainhosting.com thor 116.202.102.0 saturn.delainhosting.com saturn eol printf "Print Host File.\n" cat /etc/hosts printf "Done.\n" else printf "Hostfile exsits.\nSee Below.\n" cat /etc/hosts fi } ####################################################################### # Set Server Hostname # ####################################################################### creathostname() { setipv6 # does the Host already exist? unset new_hostname printf "Please enter a Hostname to add: " read -r new_hostname grep -q "$new_hostname" /etc/hosts >/dev/null if [ $? -ne 0 ]; then printf 'Hostname not found. adding...\n' printf "Changing hostname %s from to %s...\n" "$cur_hostname" "$new_hostname" hostnamectl set-hostname "$new_hostname" serverip="$(hostname -I | awk '{print $1}')" serverip6="$(hostname -I | awk '{print $2}')" servername="$(hostname -s)" echo "${serverip} ${new_hostname} ${servername}" >>/etc/hosts echo "${serverip6} ${new_hostname} ${servername}" >>/etc/hosts printf "Print Host File.\n" cat /etc/hosts printf "\nDone.\n" else printf "Hostname exsits.\nAll good.\n" fi } ####################################################################### # Remove Hostnames # ####################################################################### removehosts() { printf "Here is the Host file.\n" cat /etc/hosts printf "\nWhat is the server name or ip to remove? " read -r removehosts sed -i.bkp '/'$removehosts'/d ' /etc/hosts printf "Print Host.\n" cat /etc/hosts printf "\nDone.\n" while true; do printf "Continue removing? (y/n)?" read -r yn yn=${yn:-n} case $yn in [Yy]*) removehosts break ;; [Nn]*) break ;; esac done } ####################################################################### # Add External Hosts # ####################################################################### addhosts() { # does the Host already exist? unset serverip add_hostname servername printf "Enter Hostname to add:[ IP FDQN Hostname ]: " read -r serverip add_hostname servername grep -q "$add_hostname" /etc/hosts # if not then create it if [ $? -ne 0 ]; then printf 'Hostname not found. adding...\n' printf "${serverip} ${add_hostname} ${servername}" | tee -a /etc/hosts printf "Print Host File.\n" cat /etc/hosts printf "Done.\n" else printf "Hostname exsits.\nAll good.\n" fi while true; do printf "Continue adding? (y/n)?" read -r yn yn=${yn:-n} case $yn in [Yy]*) creathostentry break ;; [Nn]*) break ;; esac done } ####################################################################### # Add Swapfile # ####################################################################### creatswapfile() { printf 'Enter Swapfile size in GB: ' read -r swapsize swapsize=${swapsize:-2} printf "You choose %s GB for swap.\n" "$swapsize" # does the swap file already exist? cp /etc/fstab /etc/fstab.bak # if not then create it grep -q "swap" /etc/fstab if [ $? -ne 0 ]; then printf 'Swap file not found.\nCreating Swap file.\n' fallocate -l ${swapsize}G /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile printf "/swapfile none swap defaults 0 0" | tee -a /etc/fstab printf "\nDone\nSwap should be active.\nIf not reboot.\n" else printf 'Swap file found.\nNo changes made.\n' fi } ####################################################################### # Update OS on Server # ####################################################################### serverupdate() { printf "Debian Cleaning and Updating.\n" apt-get ${aptargs} autoremove apt-get autoclean apt-get ${aptargs} update apt-get ${aptargs} upgrade apt-get ${aptargs} dist-upgrade printf "Done.\n" } ####################################################################### # Install Standard Packages # ####################################################################### installpreq() { #DA Standard packages apt-get install ${aptargs} apt-transport-https ca-certificates curl gnupg lsb-release #DH Added Standard packages apt-get install ${aptargs} git btop sysstat screen inotify-tools ipset pigz tuned pcregrep rsync jq zip unzip libwww-perl pflogsumm linebreak printf "Email set to %s.\n" "$DA_EMAIL" #printf "Nameservers set to %s and %s.\n" "$DA_NS1" "$DA_NS2" echo ${DA_EMAIL} >/root/.forward printf "Email forward set to %s.\n" "$DA_EMAIL" linebreak tuned-adm profile virtual-host printf "Done.\n" } ####################################################################### # Install Docker # ####################################################################### installdocker() { if [ ! -f "/etc/apt/keyrings/docker.gpg" ]; then printf "No problem, let's get Docker installed first...\nThis could take a minute...\nor two... or thirty...\nPlease wait ...\n" cd /root || return mkdir -m 0755 -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null serverupdate apt-get install ${aptargs} docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin printf "Test Docker is installed.\n" docker run hello-world printf "Test Docker Compose is installed.\n" docker compose version systemctl enable docker systemctl enable containerd systemctl start docker systemctl start containerd else printf "Docker already installed.\n" fi } ####################################################################### # Harden Server # ####################################################################### hardenserver() { printf "Do we need to Secure sshd? (y/n)? " read -r yn yn=${yn:-n} case $yn in [Yy]*) cursshport="$(grep -m1 -E "Port .*" /etc/ssh/sshd_config)" printf "Enter SSH port to change to: " read -r sshport sshport=${sshport:-14} printf "Set to Port: %s\n" "$sshport" printf "Securing the server, please wait...\n" sed -i -e "s/$cursshport/Port ${sshport}/g" /etc/ssh/sshd_config sed -i -e 's/.*UseDNS .*/UseDNS no/g' /etc/ssh/sshd_config sed -i -e 's/#AddressFamily any/AddressFamily inet/g' /etc/ssh/sshd_config sed -i -e 's/#LoginGraceTime 2m/LoginGraceTime 2m/g' /etc/ssh/sshd_config sed -i -e 's/#MaxAuthTries 6/MaxAuthTries 5/g' /etc/ssh/sshd_config sed -i -e 's/#MaxStartups 10:30:100/MaxStartups 10:30:100/g' /etc/ssh/sshd_config sed -i -e 's/.*PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config sed -i -e 's/.*PasswordAuthentication .*/PasswordAuthentication no/g' /etc/ssh/sshd_config sed -i -e 's/#ClientAliveInterval .*/ClientAliveInterval 120/g' /etc/ssh/sshd_config sed -i -e 's/#ClientAliveCountMax .*/ClientAliveCountMax 15/g' /etc/ssh/sshd_config sed -i -e 's/.*UseBlacklist no/UseBlacklist yes/g' /etc/ssh/sshd_config # remove or disable services systemctl restart sshd ;; [Nn]*) ;; esac if [[ $(systemctl is-active rpcbind) = active ]]; then printf "rpcbind found.\nRemoving.\n" systemctl stop rpcbind systemctl disable rpcbind printf "Removal complete.\n" else printf "RPCbind not found.\nNo changes made.\n" fi if [[ $(systemctl is-active firewalld) = active ]]; then printf "Firewalld found.\nRemoving.\n" systemctl unmask --now firewalld systemctl disable firewalld apt-get ${aptargs} remove firewalld printf "Removal complete.\n" else printf "Firewalld not found.\nNo changes made.\n" fi printf "Do we need to intall Maldetect? (y/n)? " read -r yn yn=${yn:-n} case $yn in [Yy]*) installmaldetect ;; [Nn]*) ;; esac printf "Do we need to intall Fail2Ban? (y/n)? " read -r yn yn=${yn:-n} case $yn in [Yy]*) installf2b ;; [Nn]*) ;; esac } ####################################################################### # Install Firewall # ####################################################################### installfirewall() { printf "Securing the server, please wait...\n" if [ -f /usr/local/csf/bin/csftest.pl ]; then printf "csf is installed skipping." else cd $builddir rm -fv csf.tgz wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf ./install.sh fi # check perl modules perl /usr/local/csf/bin/csftest.pl cat >/etc/csf/csf.allow </etc/csf/csf.blocklists <>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/jail.local -P /etc/fail2ban/ >>${logfile} #wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/paths-overrides.local -P /etc/fail2ban/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/abuseipdb.conf -P /etc/fail2ban/action.d/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/wordpress.conf -P /etc/fail2ban/filter.d/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/wordpress-xmlrpc.conf -P /etc/fail2ban/filter.d/ >>${logfile} sed -i -e "s|comment=Fail2ban Reports Abuse.|comment=Fail2ban at $servername Reports Abuse.|g" /etc/fail2ban/action.d/abuseipdb.conf sed -i -e "s|mode = .*|mode = aggressive|g" /etc/fail2ban/filter.d/exim.conf systemctl restart fail2ban systemctl status fail2ban else printf "Fail2Ban Installing.\nAlso turning off BFM in DA.\n" apt-get install ${aptargs} fail2ban geoip-bin geoip-database python3-pyinotify systemctl enable fail2ban systemctl start fail2ban sed -i -e "s|dbpurgeage = .*|dbpurgeage = 1296000|g" /etc/fail2ban/fail2ban.conf wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/jail.local -P /etc/fail2ban/ >>${logfile} #wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/paths-overrides.local -P /etc/fail2ban/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/abuseipdb.conf -P /etc/fail2ban/action.d/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/wordpress.conf -P /etc/fail2ban/filter.d/ >>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/f2b/ufw/wordpress-xmlrpc.conf -P /etc/fail2ban/filter.d/ >>${logfile} sed -i -e "s|comment=Fail2ban Reports Abuse.|comment=Fail2ban at $servername Reports Abuse.|g" /etc/fail2ban/action.d/abuseipdb.conf sed -i -e "s|mode = .*|mode = aggressive|g" /etc/fail2ban/filter.d/exim.conf systemctl restart fail2ban fi bshrvals=("alias fbc='fail2ban-client status '") printf 'Adding values in to %s.\n Please wait.\n' "$bshrc" for bshrval in "${bshrvals[@]}"; do if grep -q "$bshrval" ${bshrc}; then printf '%s exists.\n Skipping.\n' "$bshrval" else printf '%s does not exist\n' "$bshrval" printf '#added by DH.\n' >>${bshrc} printf '%s\n' "$bshrval" >>${bshrc} fi done } ####################################################################### # Install Mysqltuner # ####################################################################### installmysqltuner() { cd /usr/bin || exit wget https://mysqltuner.pl/ -O mysqltuner wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv chmod +x mysqltuner } ####################################################################### # Install Maldetect # ####################################################################### installmaldetect() { cd $builddir || return wget https://www.rfxn.com/downloads/maldetect-current.tar.gz tar -xzf maldetect-*.tar.gz rm -rf maldetect-*.tar.gz cd maldetect* || return sh install.sh wget https://files.delaintech.com/conf.maldet -O conf.maldet \cp -f conf.maldet /usr/local/maldetect/ maldet -u } ####################################################################### # Install KernelCare # ####################################################################### installkernelcare() { #Is Linux Kernel Compatible? printf "Linux Kernel Compatible?\n" comp="$(curl -s -L https://kernelcare.com/checker | python3)" #What install KernelCare if [ "$comp" = "COMPATIBLE" ]; then printf "Yes..System Kernel Compatible.\nContinue on....\n" curl -s -L https://kernelcare.com/installer | bash printf "Kernel Care installed.\n" printf 'Enter KernelCare license key: ' read -r kckey kc_key=${kckey:-JOfCWN9tFkOYi1sl} /usr/bin/kcarectl --register $kc_key /usr/bin/kcarectl --update else printf "System runs on unsupported kernel. Not installed...\n" fi } ####################################################################### # Install Mail # ####################################################################### installmail() { printf "Installing MailCow.\n" cd /opt || return pwd printf "Cloning Mailcow Git Repo.\n" git clone https://github.com/mailcow/mailcow-dockerized cd mailcow-dockerized || return printf "Set config for Mailcow.\n" ./generate_config.sh printf "Running docker compose for Mailcow.\n" docker compose pull docker compose up -d printf "Mailcow is intalled.\n" } ####################################################################### # Main Configure Section # ####################################################################### ####################################################################### # Configure DNS # ####################################################################### confnamed() { #sed -i -e "s|.*listen-on-v6[[:blank:]]*.{ any; };||g" /etc/bind/named.conf.options sed -i -e "s|.*allow-transfer[[:blank:]]*.{ none; };||g" /etc/bind/named.conf.options cd ${dascptdir} || exit ./dnssec.sh install grep -q "recursion no;" /etc/bind/named.conf.options if [ $? -ne 0 ]; then cp /etc/bind/named.conf.options /etc/bind/named.conf.options.bak sed -i.bkp '/dnssec-validation yes;/a\ listen-on { '$serverip'; };\ listen-on-v6 { '$serverip6'; };\ dnssec-enable yes;\ dnssec-lookaside auto;\ bindkeys-file "/etc/bind/named.iscdlv.key";\ recursion no;\ notify yes;\ allow-transfer { 209.145.52.110; 144.91.108.77; };\ also-notify { 209.145.52.110; 144.91.108.77; };\ version "Not Found";\ ' /etc/bind/named.conf.options fi apt-get remove resolvconf echo 'make_resolv_conf() { :; }' >/etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone printf "Setup Resolver configuration.\n" grep -q "9.9.9.9" /etc/resolv.conf if [ $? -ne 0 ]; then cat >/etc/resolv.conf <>${logfile} wget -rnH --cut-dirs=2 https://files.delaintech.com/deb/proftpd/proftpd.conf -P ${cbblddir}/custom/proftpd/conf >>${logfile} chmod 755 custom/proftpd/configure.proftpd wget -rnH --cut-dirs=2 https://files.delaintech.com/deb/proftpd/proftpd.sftp.conf -P /etc >>${logfile} sed -i -e "s|||g" /etc/proftpd.sftp.conf printf "Setting up Proftp.\n" systemctl enable proftpd systemctl restart proftpd printf "Done.\n" } ####################################################################### # Check Server Satus # ####################################################################### serverstatus() { printf "Checking Directadmin." systemctl status docker --no-pager printf "done" } ####################################################################### # Backup Server # ####################################################################### backupall() { wget -rnH --cut-dirs=1 https://files.delaintech.com/deb/all_backups_post.sh -P ${dadir}/scripts/custom chmod 755 ${dascptdir}/custom/all_backups_post.sh wget -rnH https://files.delaintech.com/backup.conf -P ${datadmdir} wget -rnH https://files.delaintech.com/backup_crons.list -P ${datadmdir} printf "Install Rclone for file backup.(yn)" read -r yn yn=${yn:-n} case $yn in [Yy]*) printf 'Installing Rclone for file backup.\n' apt-get install ${aptargs} rclone mkdir -p /var/log/rclone touch /var/log/rclone/aws.log printf "Setup Rclone.\n" rclone config ;; [Nn]*) ;; esac printf 'Running Server file backup.\n' if [ -d /sys_backup ] && [ -d /admin_backups ]; then chmod 755 /admin_backups chmod 755 /sys_backup chown admin:admin /admin_backups chown admin:admin /sys_backup cd / tar -cvpzf /sys_backup/backup.tar.gz \ --exclude=/sys_backup/backup.tar.gz \ --exclude=/home/admin/admin_backup \ --exclude=/admin_backups \ --exclude=/root/.c* \ /home/admin/hb* \ /usr/local/directadmin/conf \ /usr/local/directadmin/scripts/custom \ /usr/local/directadmin/custombuild/custom \ /usr/local/directadmin/data/templates/custom \ /usr/local/directadmin/data/templates/mx \ /usr/local/directadmin/data/admin/packages/ \ /usr/local/directadmin/data/admin/packages.list \ /usr/local/directadmin/data/users/admin/packages/ \ /usr/local/directadmin/data/users/admin/packages.list \ /usr/local/directadmin/data/admin/backup* \ /sys_backup/mysql_backups \ /etc \ /root printf "Server Backup done.\n" else >/home/admin/hb_templates_c/hostbillqueue.log rm -Rf /home/admin/admin_backup mkdir /admin_backups mkdir /sys_backup chmod 755 /admin_backups chmod 755 /sys_backup chown admin:admin /admin_backups cd / tar -cvpzf /sys_backup/backup.tar.gz \ --exclude=/sys_backup/backup.tar.gz \ --exclude=/home/admin/admin_backup \ --exclude=/admin_backups \ --exclude=/root/.c* \ --exclude=/sys_backup/backup.tar.gz \ --exclude=/admin_backups \ --exclude=/root/.c* \ /home/admin/hb* \ /usr/local/directadmin/conf \ /usr/local/directadmin/scripts/custom \ /usr/local/directadmin/custombuild/custom \ /usr/local/directadmin/data/templates/custom \ /usr/local/directadmin/data/templates/mx \ /usr/local/directadmin/data/admin/packages/ \ /usr/local/directadmin/data/admin/packages.list \ /usr/local/directadmin/data/users/admin/packages/ \ /usr/local/directadmin/data/users/admin/packages.list \ /usr/local/directadmin/data/admin/backup* \ /sys_backup/mysql_backups \ /etc \ /root printf "Server Backup done.\n" fi /usr/local/directadmin/scripts/custom/all_backups_post.sh } ####################################################################### # Main Menu of Script # ####################################################################### clear dasetup_banner linebreak #Check that user is root. if [ $EUID = "0" ]; then printf "We are root. Continue on....\n" else printf "This script must be run as root\n" exit 1 fi #What Distro are you on? printf "Distro are you on??\n" 2>&1 OS_VER=$(sed 's/\..*//' /etc/debian_version) if [ "$OS_VER" = 11 ]; then printf "This appears to be Debian version %s which is Good!!\n" "$OS_VER" elif [ "$OS_VER" = 12 ]; then printf "This appears to be Debian version %s which is Great!!\n" "$OS_VER" else [ "$OS_VER" != 12 ] printf "System runs on unsupported Linux. Exiting...\n" exit fi #Menus Starts here linebreak printf "${YELLOW}" cat <&2 ;; esac done done if [ -d "$builddir" ]; then rm -rf $builddir fi mkdir $builddir if [ "$run" ]; then ${run} exit fi printf "Cleaning up build files, please wait...\n" cd ~ || exit rm -rf $builddir