From 10572130c855e88a8fd44957096f00e5f5d21890 Mon Sep 17 00:00:00 2001 From: Beeranco <49772805+Beeranco@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:43:31 +0200 Subject: [PATCH] Update Installer.sh Added check for compatible Pi's Added check if Pi 4 but a 2GB or higher model enable mounting /tmp to RAM. If model is a Pi 4 1GB, 3B of 3B+ RAM mounting /tmp is disabled automaticly. Added check if Pi 4 but a 2GB or higher model set Log2Ram to 256MB of storage space in RAM. Otherwise keep it to it's default of 128MB. Added check if not a Pi 4 series set CPU power to performance so the older architectures can keep up. Otherwise set CPU power to conservative since the Pi 4's have a newer more effecient and powerfull architecture. --- Installer.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Installer.sh b/Installer.sh index 9b4cae0..20acc97 100644 --- a/Installer.sh +++ b/Installer.sh @@ -25,6 +25,13 @@ BRANCH=main $PKGI curl wget whiptail +##----------------------------## +# Check if Pi is compatible # +##----------------------------## + +wget $GIT/$REPO/$BRANCH/RasPi-Config/Requirements.sh -O /tmp/Requirements.sh +source /tmp/Requirements.sh + ##-----------## # Check OS # ##-----------## @@ -268,22 +275,32 @@ echo "" >> /boot/config.txt echo "#Reduce allocated GPU Memory since we're running headless" >> /boot/config.txt echo "gpu_mem=16" >> /boot/config.txt -echo "" >> /etc/fstab -echo "#Mounting /tmp folder to RAM so it reduces SD Card wear" >> /etc/fstab -echo "tmpfs /tmp tmpfs defaults,noatime,nosuid 0 0" >> /etc/fstab +if [[ $PI4 == "yes" ]] && [[ $UNSAFE == "no" ]]; then + echo "" >> /etc/fstab + echo "#Mounting /tmp folder to RAM so it reduces SD Card wear" >> /etc/fstab + echo "tmpfs /tmp tmpfs defaults,noatime,nosuid 0 0" >> /etc/fstab +fi 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 cd ~ -sed -i -e 's/SIZE=128M/SIZE=256M/g' /etc/log2ram.conf + +if [[ $UNSAFE == "no" ]]; then + sed -i -e 's/SIZE=128M/SIZE=256M/g' /etc/log2ram.conf +fi + sed -i -e 's/MAIL=true/MAIL=false/g' /etc/log2ram.conf journalctl --vacuum-size=32M systemctl restart systemd-journald rm -rf /var/log/* -sed -i -e 's/# CPU_DEFAULT_GOVERNOR="ondemand"/CPU_DEFAULT_GOVERNOR="conservative"/g' /etc/default/cpu_governor +if [[ $PI4 == "no" ]]; then + sed -i -e 's/# CPU_DEFAULT_GOVERNOR="ondemand"/CPU_DEFAULT_GOVERNOR="performance"/g' /etc/default/cpu_governor + else + sed -i -e 's/# CPU_DEFAULT_GOVERNOR="ondemand"/CPU_DEFAULT_GOVERNOR="conservative"/g' /etc/default/cpu_governor +fi ##--------------##