From 8c8d47d104d2a437bcd3b387c6a1de8f0d1540c5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 8 Dec 2024 17:05:55 -0700 Subject: [PATCH] fix --- gentoo.sh | 57 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/gentoo.sh b/gentoo.sh index b6548eb..a84c2d0 100644 --- a/gentoo.sh +++ b/gentoo.sh @@ -39,7 +39,7 @@ SSID='123456' WIRELESS_INTERFACE='wlan0' COMPRESSION='compress=zstd:10' #Full Disk Encryption Settings -FULL_DISK_ENCRYPTION="True" +FULL_DISK_ENCRYPTION="False" AUTO_DECRYPT='False' DISK_PASSWORD='123456' ############################## @@ -64,7 +64,7 @@ CPU_TYPE="x86-64" BUILD_SERVER="n" BUILD_SERVER_ADDRESS="192.168.0.55" BUILD_PATH="/raid/@os" -RSYNC_EXCLUDES="--exclude=/var/tmp/* --exclude=/tmp/* --exclude=/var/lib/libvirt/* --exclude=/var/db/repos --exclude=/var/cache --exclude=/var/notmpfs --exclude=/var/lib/docker --exclude=/var/db/repos/* --exclude=/var/lib/systemd/coredump/* --exclude=/var/cache/* --exclude=/home/$USER* --exclude=/.snapshots/* --exclude=/sys/* --exclude=/dev/* --exclude=/home/$USER/* --exclude=/proc/* --exclude=/run/*" +RSYNC_EXCLUDES="--exclude=/var/lib/monero --exclude=/var/lib/strfry --exclude=/var/lib/radicale --exclude=/var/lib/pleroma --exclude=/var/lib/akkoma --exclude=/var/lib/jellyfin --exclude=/var/lib/gitea --exclude=/var/lib/postgresql --exclude=/snapshots --exclude=/backup --exclude=/raid --exclude=/var/tmp/* --exclude=/tmp/* --exclude=/var/lib/libvirt/* --exclude=/var/db/repos --exclude=/var/cache --exclude=/var/notmpfs --exclude=/var/lib/docker --exclude=/var/db/repos/* --exclude=/var/lib/systemd/coredump/* --exclude=/var/cache/* --exclude=/home/$USER* --exclude=/.snapshots/* --exclude=/sys/* --exclude=/dev/* --exclude=/home/$USER/* --exclude=/proc/* --exclude=/run/*" #Add Masked Packages to the Array MASKED_PACKAGES+=(media-video/obs-studio net-misc/nyx net-libs/stem sys-libs/libudev-compat dev-libs/nss dev-libs/libappindicator media-video/ffmpeg games-util/game-device-udev-rules games-util/steam-launcher net-im/telegram-desktop-bin) @@ -165,7 +165,7 @@ systemMounts() { mount -t tmpfs -o size=$TMPFS_SIZE tmpfs $TARGET/var/tmp/portage else echo - echo "Aborting Install, $BTRFS not found!" + echo "System Mounts: Aborting Install, $BTRFS not found!" echo echo exit 1 @@ -294,6 +294,7 @@ buildGentoo() { echo echo cp -f /tmp/disk $TARGET/tmp/ + cp -f /tmp/enc $TARGET/tmp/ chroot $TARGET /usr/bin/bash /usr/bin/gentoo.sh bootloader echo @@ -305,7 +306,7 @@ buildGentoo() { echo 'bash /usr/bin/gentoo.sh accounts' >>$TARGET/setup.sh echo 'bash /usr/bin/gentoo.sh desktop' >>$TARGET/setup.sh echo 'bash /usr/bin/gentoo.sh btrfs-tweaks' >>$TARGET/setup.sh - echo 'bash /usr/bin/gentoo.sh hibernate' >>$TARGET/setup.sh + #echo 'bash /usr/bin/gentoo.sh hibernate' >>$TARGET/setup.sh autoLogin chmod +x $TARGET/usr/bin/gentoo.sh chmod +x $TARGET/setup.sh @@ -369,6 +370,7 @@ liveOSrestore() { #mount $EFI /tmp/live/$LIVE_OS_SUBVOL/boot if [[ $BUILD_SERVER = *y* ]]; then + read -p 'BTRFS Backup Volume Name: ' -e -i "/raid/@$HOSTNAME" BUILD_PATH rsync -av --delete -e ssh root@$BUILD_SERVER_ADDRESS:/$BUILD_PATH/ $RSYNC_EXCLUDES $TARGET/ else rsync -av --delete / $RSYNC_EXCLUDES $TARGET/ @@ -378,18 +380,19 @@ liveOSrestore() { fstab cp -f $SCRIPT/gentoo.sh $TARGET/usr/bin/ cp -f /tmp/disk $TARGET/tmp/ + cp -f /tmp/enc $TARGET/tmp/ echo "bash /usr/bin/gentoo.sh bootloader" >$TARGET/setup.sh echo 'bash /usr/bin/gentoo.sh accounts' >>$TARGET/setup.sh echo 'bash /usr/bin/gentoo.sh btrfs-tweaks' >>$TARGET/setup.sh - echo 'bash /usr/bin/gentoo.sh hibernate' >>$TARGET/setup.sh + #echo 'bash /usr/bin/gentoo.sh hibernate' >>$TARGET/setup.sh echo "chown -R $USER:$USER /home/$USER" >>$TARGET/setup.sh chmod +x $TARGET/usr/bin/gentoo.sh chmod +x $TARGET/setup.sh chroot $TARGET bash /setup.sh rm -f $TARGET/setup.sh - read -p 'Would you like to run your UserTweaks: ' -e -i 'y' user_tweaks + read -p 'Would you like to run your UserTweaks: ' -e -i 'n' user_tweaks autoLogin @@ -405,21 +408,12 @@ liveOSrestore() { } backupOS() { + clear mkdir /tmp/live - #INSTALL_TYPE=$(mount | grep ' / ') - #if [[ $INSTALL_TYPE = *mapper* ]]; then - # LIVE_OS_DM="/dev/mapper/$(mount | grep -i ' / ' | cut -d '/' -f4 | cut -d ' ' -f1)" - # LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')" - #else - # LIVE_OS_DM="$(mount | grep ' / ' | cut -d ' ' -f1)" - # LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')" - #fi - partitions systemMounts clear - #mount $LIVE_OS_DM /tmp/live - #cd /tmp/live/$LIVE_OS_SUBVOL + read -p 'BTRFS Backup Volume Name: ' -e -i "/raid/@$HOSTNAME" BUILD_PATH rsync -av -e ssh --delete / $RSYNC_EXCLUDES root@$BUILD_SERVER_ADDRESS:$BUILD_PATH/ rsync -av -e ssh --delete /boot/ root@$BUILD_SERVER_ADDRESS:$BUILD_PATH/boot/ umount /tmp/live @@ -807,16 +801,18 @@ partitions() { echo "Setting Up Partitions....." if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $(echo $ROOT_MAPPER_NAME | sed 's/\/dev\/mapper\///') - fi - if [[ -e "$ROOT_MAPPER_NAME" ]]; then - fstab + if [[ -e "$ROOT_MAPPER_NAME" ]]; then + fstab + else + echo + echo "Partitions: Aborting Install, $ROOT_MAPPER_NAME not found!" + echo + echo + exit 1 + fi else - echo - echo "Aborting Install, $ROOT_MAPPER_NAME not found!" - echo - echo - exit 1 + echo "Encryption Disabled. Going forward" fi } @@ -825,6 +821,9 @@ setDevices() { HARD_DISK=$(cat /tmp/disk | head -1) ROOT_NAME=$(cat /tmp/disk | tail -3 | head -1) SWAP_CHOICE=$(cat /tmp/disk | tail -1 | head -1) + if [ -f "/tmp/enc" ]; then + FULL_DISK_ENCRYPTION="True" + fi partitionDetection echo echo "Configuration Settings:" @@ -847,20 +846,24 @@ setDevices() { echo "Erase the line and press enter to skip to the next detected disk" echo i=$(expr $i + 1) - read -p 'Disk Device to Use: ' -e -i $(lsblk | grep -i disk | grep -Evi 'swap' | cut -d ' ' -f1 | head -$i | tail -1) device + read -p 'Disk Device to Use: ' -e -i $(lsblk | grep -i disk | grep -Evi 'swap|zram|dm-0' | cut -d ' ' -f1 | head -$i | tail -1) device if [[ ! -z $device ]]; then i="n" fi done - + read -p 'Is the Disk Encrypted? : ' -e -i "y" encrypted read -p 'BTRFS Root Volume name: ' -e -i "gentoo" root_name read -p 'LUKS Device Mapper Name: ' -e -i "root" device_mapper_name read -p 'Swap Partition for hibernation? (y/n): ' -e -i "y" SWAP_CHOICE + HARD_DISK=$device echo $HARD_DISK >/tmp/disk echo $root_name >>/tmp/disk echo $device_mapper_name >>/tmp/disk echo $SWAP_CHOICE >>/tmp/disk + if [[ $encrypted = *y* ]]; then + echo "encryption" > /tmp/enc + fi setDevices fi partitionDetection