Update 'Installer.sh'

Changed Alpine version to 3.18
Renamed Check OS to Pre-Check,
now including dialog for static IP.
Added Log2Ram for Debian installs.
Added IP var to display when setup is finished.
Changed repo for Unattended-Upgrades.
This commit is contained in:
b.waal 2023-09-24 18:55:35 +02:00
parent 46924deb99
commit 7d8329c344

View File

@ -12,21 +12,28 @@ PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y"
###DEBIAN###
###ALPINE###
VER=3.17
VER=3.18
###ALPINE###
REPO=Pi-Hole
BRANCH=main
GIT=https://git.ictcorpnet.com/b.waal/$REPO/raw
##-----------##
# Check OS #
##-----------##
##------------##
# Pre-Check #
##------------##
wget $GIT/$BRANCH/Config/OScheck.sh -O /tmp/OScheck.sh
source /tmp/OScheck.sh
if (whiptail --title "Pi Automation" --yesno "Is this device configured with a static IP?." 8 78); then
echo ""
else
whiptail --title "Pi Automation" --msgbox "Configure a static IP first!" 8 78
clear
exit
fi
##----------##
# Menu #
@ -65,18 +72,25 @@ if (whiptail --title "Setup" --yesno "Install UFW?" 8 78); then
else
UFW=false
fi
if [[ $dist == "Debian" ]]; then
if (whiptail --title "Setup" --yesno "Unattended-Upgrades" 8 78); then
UNATTENDED=true
else
UNATTENDED=false
fi
fi
if (whiptail --title "Setup" --yesno "Disable IPv6?" 8 78); then
IPv6=false
else
IPv6=true
fi
if [[ $dist == "Debian" ]]; then
if (whiptail --title "Setup" --yesno "Install Log2Ram" 8 78); then
L2R=true
else
L2R=false
fi
fi
if [[ $dist == "Debian" ]]; then
if (whiptail --title "Setup" --yesno "Install Unattended-Upgrades?" 8 78); then
UNATTENDED=true
else
UNATTENDED=false
fi
fi
##-----------##
@ -98,6 +112,14 @@ fi
# Pre-Config #
##--------------##
if [[ $dist == "Alpine" ]]; then
IP=`hostname -i` && IP=$(echo $IP | cut -d' ' -f2,3)
fi
if [[ $dist == "Debian" ]]; then
IP=`hostname -I` && IP=$(echo $IP | cut -d' ' -f2,3)
fi
mkdir -p /etc/pihole
wget $GIT/$BRANCH/Config/Pihole/pihole-FTL.conf -O /etc/pihole/pihole-FTL.conf
wget $GIT/$BRANCH/Config/Pihole/setupVars.conf -O /etc/pihole/setupVars.conf
@ -146,6 +168,9 @@ if [[ $dist == "Debian" ]]; then
if [[ $UFW == "true" ]]; then
echo "ufw" >> /tmp/install.list
fi
if [[ $L2R == "true" ]]; then
echo "rsync tar" >> /tmp/install.list
fi
if [[ $UNATTENDED == "true" ]]; then
echo "unattended-upgrades apt-listchanges" >> /tmp/install.list
fi
@ -201,8 +226,22 @@ if [[ $UFW == "true" ]]; then
fi
if [[ $UNATTENDED == "true" ]]; then
wget https://git.ictcorpnet.com/b.waal/PiAutomation/raw/branch/main/Unattended-Security-Updates/20auto-upgrades -O /etc/apt/apt.conf.d/20auto-upgrades
wget https://git.ictcorpnet.com/b.waal/PiAutomation/raw/branch/main/Unattended-Security-Updates/50debian-unattended-upgrades -O /etc/apt/apt.conf.d/50unattended-upgrades
wget https://git.ictcorpnet.com/b.waal/Unattended-Upgrades/raw/branch/main/20auto-upgrades -O /etc/apt/apt.conf.d/20auto-upgrades
wget https://git.ictcorpnet.com/b.waal/Unattended-Upgrades/raw/branch/main/50debian-unattended-upgrades -O /etc/apt/apt.conf.d/50unattended-upgrades
fi
if [[ $L2R == "true" ]]; then
curl -L https://github.com/azlux/log2ram/archive/master.tar.gz -o /tmp/log2ram.tar.gz
tar zxfv /tmp/log2ram.tar.gz -C /tmp/
cd /tmp/log2ram-master/
chmod +x install.sh && sudo ./install.sh
systemctl daemon-reload
cd ~
sed -i -e 's/MAIL=true/MAIL=false/g' /etc/log2ram.conf
journalctl --vacuum-size=32M
systemctl restart systemd-journald
rm -rf /var/log/journal
fi
@ -210,5 +249,5 @@ fi
# Finishing #
##-------------##
whiptail --title "Done!" --msgbox "Pihole is now available on http://LXC.IP.ADDRESS.HERE/admin\n\nPress OK to continue." 10 78
whiptail --title "Done!" --msgbox "Pi-Hole is now available on http://$IP/admin\n\nPress OK to continue." 10 78
exit