From 7f70ec5befe713c48aaa0d876918cfd39d90b3af Mon Sep 17 00:00:00 2001 From: verita84 Date: Mon, 30 Oct 2023 01:21:46 +0000 Subject: [PATCH] Add gentoo.sh --- gentoo.sh | 602 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 602 insertions(+) create mode 100644 gentoo.sh diff --git a/gentoo.sh b/gentoo.sh new file mode 100644 index 0000000..59aa8dd --- /dev/null +++ b/gentoo.sh @@ -0,0 +1,602 @@ +#!/bin/bash +######################## +# What this script is: +# +# An automatic installer for Gentoo Stable with the following features: +# 1. BTRFS with Grub Snapshots +# 2. KDE Desktop +# 3. The ability to build a custom and deployable image onto any machine +# 4. Easily create a bootable USB drive +# 5. Automatic Partitioning +# +# INSTRUCTIONS +# +# For new disk installs, initialize the disk to setup partitions from the main menu. +# +# Before running the install, ensure that you have Internet access. +# +# Please be sure to change USER,USER_PASSWORD,DISK_PASSWORD, and ROOT_PASSWORD strings in this file +# +# To install a new OS to a disk, run gentoo.sh and choose option 1 from the main menu +# +######################## +#Configure this section +######################## +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +TARGET='/install' +mkdir $TARGET +###################################### +echo +HARD_DISK=$2 +###################################### +USER="verita84" +USER_PASSWORD="123456" +ROOT_PASSWORD="123456" +WIRELESS_PASSWORD='123456' +SSID='Tribble' +WIRELESS_INTERFACE='wlan0' +DISK_PASSWORD='123456' +COMPRESSION='compress=zstd:10' +FLATPAKS+=(io.exodus.Exodus us.zoom.Zoom app/com.valvesoftware.Steam/x86_64/stable app/net.lutris.Lutris) +SERVICES+=( cups pulseaudio.service pulseaudio.socket grub-btrfsd sddm NetworkManager dev-zram0.swap) +DESKTOP="KDE" +BROWSER="brave" +MAKEOPTS="-j12" +USE_FLAGS="zeroconf dbus daemon pulseaudio X -browser-integration desktop-portal minimal -gtk -gnome qt5 kde dvd alsa gui -wayland device-mapper efiemu themes truetype btrfs seccomp cgroup-hybrid geoclue -webengine boot browser keeshare network opengl" +TMPFS_SIZE="32G" +STAGE3="https://distfiles.gentoo.org/releases/amd64/autobuilds/20231022T164658Z/stage3-amd64-systemd-20231022T164658Z.tar.xz" +#Packages +BASE_PACKAGES=" plasma-meta net-analyzer/nmap x11-apps/xhost app-misc/screen net-im/element-desktop-bin app-portage/gentoolkit sys-fs/dosfstools app-admin/sudo sys-apps/systemd sys-boot/plymouth sys-apps/zram-generator x11-misc/sddm app-eselect/eselect-repository dev-vcs/git sys-boot/refind sys-block/parted sys-boot/grub sys-block/zram-init media-video/vlc app-office/calligra sys-process/btop net-vpn/wireguard-tools sys-apps/flatpak app-editors/vim app-vim/airline app-misc/neofetch net-misc/yt-dlp net-im/telegram-desktop net-misc/nextcloud-client app-containers/crun app-containers/podman app-office/calligra media-gfx/krita net-fs/samba sys-fs/btrfs-progs kde-apps/kdegraphics-meta app-admin/keepassxc net-print/cups " +#VIRTUALIZATION=" virt-manager qemu-system libvirt-daemon-system ovmf cockpit-machines" +PACKAGES="" +TAR_EXCLUDES="--exclude=/var/lib/flatpak --exclude=/opt/stable-diffusion-webui --exclude=/.snapshots --exclude=/snapshots --exclude=/var/backups --exclude=/volumes/* --exclude=/mnt/* --exclude=/var/tmp/* --exclude=/tmp/* --exclude=/raid/* --exclude=/root/* --exclude=/var/cache/apt/archives/* --exclude=/proc/* --exclude=/.snapshots/* --exclude=/var/lib/libvirt/* --exclude=/dev/* --exclude=/sys/* --exclude=/home/* --exclude=/var/lib/postgresql --exclude=/var/lib/containers --exclude=/opt/chatgpt " + +partitionDetection() { + #This is used for the installer to do script-based actions + EFI=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -1 | tail -1) + BOOT=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -2 | tail -1) + BTRFS=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -3 | tail -1) +} + +partitionDetection + +auto_login() { + mkdir -p $TARGET/etc/sddm.conf.d + echo "[Autologin]" >$TARGET/etc/sddm.conf.d/autologin + echo "User=$USER" >>$TARGET/etc/sddm.conf.d/autologin + echo "Session=plasma.desktop" >>$TARGET/etc/sddm.conf.d/autologin + echo "Relogin=false" >>$TARGET/etc/sddm.conf.d/autologin +} + +hibernate-setup() { + echo "[Sleep]" >/etc/systemd/sleep.conf + echo "AllowSuspend=yes" >>/etc/systemd/sleep.conf + echo "AllowHibernation=yes" >>/etc/systemd/sleep.conf + echo "AllowSuspendThenHibernate=yes" >>/etc/systemd/sleep.conf + echo "HibernateState=disk" >>/etc/systemd/sleep.conf + echo "HibernateMode=platform" >>/etc/systemd/sleep.conf + echo "HibernateDelaySec=1800" >>/etc/systemd/sleep.conf + echo "HandleLidSwitch=suspend-then-hibernate" >>/etc/systemd/logind.conf + echo "HandleLidSwitchExternalPower=suspend-then-hibernate" >>/etc/systemd/logind.conf + unlink /usr/lib/systemd/system/systemd-suspend.service + rm -f /usr/lib/systemd/system/systemd-suspend.service + ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /usr/lib/systemd/system/systemd-suspend.service +} + +create-os-snapshots() { + echo + mkdir $2 + DATE=$(date +%Y-%m-%d-%H) + echo "[Creating new OS snapshot to $1/gentoo-$DATE).tgz]" + echo + echo + NEW_TAR_EXCLUDES="$TAR_EXCLUDES --exclude=/minio --exclude=$TARGET/* --exclude=/var/lib/docker " + echo + time tar cvpzf $1/gentoo-$DATE.tgz $NEW_TAR_EXCLUDES / + chown $USER:$USER $1/$DATE.tgz +} + +homeBackup() { + echo + echo "[Copying USER data from /home to $TARGET/@home]" + echo + rsync -a --delete /home/ --exclude=.cache --exclude=.local/share/flatpak --exclude=.local/share/containers $TARGET/\@home/ +} + +os-backup() { + umount $TARGET + + + echo + echo "[Mounting.....]" + echo + mount -o $COMPRESSION $BTRFS $TARGET + + if [ "$1" = "home" ]; then + homeBackup + fi + create-os-snapshots "$2" "$3" + + ls $TARGET/ + umount $TARGET +} + +os-restore() { + partitions + rm -rf $TARGET/usr $TARGET/sbin $TARGET/lib32 $TARGET/libx32 $TARGET/lib $TARGET/vmlinuz* $TARGET/initrd* $TARGET/bin $TARGET/var $TARGET/root $TARGET/opt $TARGET/etc $TARGET/run + clear + echo "[Restoring OS tarfile from $4/$2.tgz]" + echo + tar xfvp $4/$2.tgz -C $TARGET/ + + if [ "$3" = "home" ]; then + echo "[Restoring /home]" + echo + rsync -a --delete /home/ $TARGET/home/ + fi + + fstab + cp -f gentoo.sh $TARGET/ + systemMounts + chmod +x $TARGET/gentoo.sh + chroot $TARGET /gentoo.sh bootloader $1 $2 $5 + chroot $TARGET /gentoo.sh btrfs-tweaks + chroot $TARGET /gentoo.sh accounts + chown -R $USER:$USER $TARGET/home/$USER + auto_login + rm -f $TARGET/gentoo.sh + unmount +} + +systemMounts() { + mount -o rbind /dev $TARGET/dev + mount -o rbind /dev/pts $TARGET/dev/pts + mount -o rbind /proc $TARGET/proc + mount -o rbind /sys $TARGET/sys + mount -t efivarfs none $TARGET/sys/firmware/efi/efivars + mount -t tmpfs -o size=$TMPFS_SIZE tmpfs $TARGET/var/tmp/portage +} + +install() { + partitions + if ! [ -f "$TARGET/bin/bash" ]; then + getInstallFiles + fi + + if [ -f "$TARGET/bin/bash" ]; then + systemMounts + buildGentoo + auto_login + setup_script "$1" + fi + #unmount +} + +getInstallFiles() { + cd /tmp + STAGE3_FILE="/tmp/$(ls /tmp/stage3-* | head -1 | cut -d '/' -f3)" + if [ -f "$STAGE3_FILE" ]; then + echo "Stage3 already here" + else + wget $STAGE3 + STAGE3_FILE="/tmp/$(ls /tmp/stage3-* | head -1 | cut -d '/' -f3)" + fi + + tar xfv $STAGE3_FILE -C $TARGET/ + sed -i 's/-O2/-march=native -O2/i' $TARGET/etc/portage/make.conf + echo "USE=\"$USE_FLAGS\"" >>$TARGET/etc/portage/make.conf + echo "MAKEOPTS=\"$MAKEOPTS\"" >>$TARGET/etc/portage/make.conf + echo 'EMERGE_DEFAULT_OPTS="--jobs 3"' >>$TARGET/etc/portage/make.conf + echo 'ACCEPT_KEYWORDS="~amd64"' >>$TARGET/etc/portage/make.conf + + cp -f /etc/resolv.conf $TARGET/etc/ + mkdir -p $TARGET/var/tmp/portage + +} + +buildGentoo() { +if [ ! -d "$TARGET/var/db/repos/gentoo/x11-misc" ] +then + chroot $TARGET /usr/bin/emerge --sync +fi + + chroot $TARGET /usr/bin/eselect $(/usr/bin/eselect profile list | grep -i plasma | grep systemd | head -1 | cut -d '[' -f2 | cut -d ']' -f1) + mkdir -p $TARGET/etc/portage/package.license + echo "*/* *" >$TARGET/etc/portage/package.license/license + rm -rf $TARGET/etc/portage/package.accept_keywords + echo "net-im/element-desktop-bin ~amd64" >$TARGET/etc/portage/package.accept_keywords + echo "media-video/vlc ~amd64" >>$TARGET/etc/portage/package.accept_keywords + echo "dev-qt/qtgui ~amd64" >>$TARGET/etc/portage/package.accept_keywords + chroot $TARGET /usr/bin/emerge --verbose --update --deep --newuse @world --autounmask-write + chroot $TARGET etc-update -q --automode -5 + #The line is a workaround per bug https://bugs.gentoo.org/832963 + chroot $TARGET /usr/bin/emerge --verbose --update --deep --newuse dev-qt/qtgui + chroot $TARGET /usr/bin/emerge --verbose --update --deep --newuse @world + locale + chroot $TARGET /usr/bin/emerge sys-kernel/gentoo-sources sys-kernel/dracut sys-kernel/genkernel + chroot $TARGET eselect kernel set 1 + chroot $TARGET genkernel --cachedir=/var/tmp/portage --tmpdir=/var/tmp/portage --install --no-clean all + chroot $TARGET /usr/bin/emerge $BASE_PACKAGES --autounmask-write + chroot $TARGET etc-update -q --automode -5 + chroot $TARGET /usr/bin/emerge $BASE_PACKAGES + +} + +snapshots() { + echo + echo "Creating Snapshots....." + echo + DATE=$(echo $(date +%Y-%m-%d-%H-%M-%S)) + btrfs sub snapshot / /.snapshots/root-${DATE} +} + +remove-snapshots() { + btrfs sub delete /.snapshots/* + rm -f /boot/loader/entries/root-* +} + +flatpaks() { + echo + echo "Installing Flatpaks......" + echo + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + for i in "${FLATPAKS[@]}"; do + echo $i + flatpak install --system $i -y + done +} + +grub-snapshots() { + cd /opt + git clone https://github.com/Antynea/grub-btrfs.git + cd /opt/grub-btrfs + make + make install + systemctl enable --now grub-btrfsd.service +} + +bootloader() { + if [ -z "$1" ]; then + echo + echo "Error: No Disk specified!" + echo + else + ROOT_NAME="$2" + plymouth-set-default-theme solar + echo "GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash mitigations=off\"" >/etc/default/grub + echo "GRUB_CMDLINE_LINUX=init=/usr/lib/systemd/systemd root=UUID=$(/sbin/blkid | grep $BTRFS | cut -d '"' -f2) rootflags=subvol=@${ROOT_NAME}" >>/etc/default/grub + echo "GRUB_ENABLE_CRYPTODISK=n" >>/etc/default/grub + echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub + echo "GRUB_TIMEOUT=1" >>/etc/default/grub + echo "GRUB_THEME=/boot/grub/themes/starfield/theme.txt" >>/etc/default/grub + grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=gentoo + dracut --hostonly --kver $(ls /lib/modules/) --force + grub-mkconfig -o /boot/grub/grub.cfg + refind-install + fi + +} + +function setup_script() { + cp -f gentoo.sh $TARGET/usr/bin/ + echo "bash /usr/bin/gentoo.sh bootloader $1 $ROOT_NAME $BTRFS" >>$TARGET/setup.sh + echo 'bash /usr/bin/gentoo.sh grub-snapshots' >>$TARGET/setup.sh + 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 + + chmod +x $TARGET/usr/bin/gentoo.sh + chmod +x $TARGET/setup.sh + chroot $TARGET /setup.sh + rm -f $TARGET/setup.sh +} + +btrfs_filesytem() { + btrfs sub create $TARGET/@$ROOT_NAME + btrfs sub create $TARGET/@.snapshots + btrfs sub create $TARGET/@libvirt + btrfs sub create $TARGET/@home + btrfs sub create $TARGET/@root + btrfs sub create $TARGET/@containers + btrfs sub create $TARGET/@flatpak + echo + echo "Binding BTRFS Root" + echo + umount $TARGET + mount -o $COMPRESSION,subvol=@$ROOT_NAME $BTRFS $TARGET +} + +services() { + echo '[zram0]' >/etc/systemd/zram-generator.conf + echo 'zram-size = ram * 2' >>/etc/systemd/zram-generator.conf + + for i in "${SERVICES[@]}"; do + systemctl enable --now $i + done +} + +desktop() { + installBrowser + services +} + +installBrave() { + eselect repository add brave-overlay git https://gitlab.com/jason.oliveira/brave-overlay.git + emerge --sync brave-overlay + emerge www-client/brave-bin::brave-overlay +} + +installBrowser() { + if [ "$BROWSER" = "brave" ]; then + installBrave + fi +} + +mounts() { + echo + echo "Mounting......." + mount $BTRFS $TARGET + btrfs_filesytem + mkdir -p $TARGET/boot + mount -t ext4 $BOOT $TARGET/boot + mkdir -p $TARGET/boot/efi + mount $EFI $TARGET/boot/efi + #CONFIGURE DATA DIRS (HOME) + mkdir $TARGET/home + mount -o subvol=@home $BTRFS $TARGET/home +} + +unmount() { + echo + echo "Unmounting....." + umount $TARGET/proc + umount $TARGET/dev + umount $TARGET/sys + umount $TARGET/boot + umount $TARGET/home + umount -lR $TARGET/* + umount -R $TARGET + umount -R $TARGET +} + +locale() { + echo "ln -sf /usr/share/zoneinfo/US/Mountain /etc/localtime" >>$TARGET/setup.sh + echo "hwclock --systohc" >>$TARGET/setup.sh + echo "en_US.UTF-8 UTF-8" >$TARGET/etc/locale.gen + echo "locale-gen" >>$TARGET/setup.sh +} + +partitions() { + echo + echo "Setting Up Partitions....." + + if [[ -e "$BTRFS" ]]; then + mounts + fstab + else + echo + echo "Aborting Install, $BTRFS not found!" + echo + echo + exit 1 + fi +} + +fstab() { + mkdir $TARGET/etc + echo "UUID=$(/sbin/blkid | grep ${BOOT} | cut -d '"' -f2) /boot ext4 defaults 0 1" >$TARGET/etc/fstab + echo "UUID=$(/sbin/blkid | grep ${EFI} | cut -d '"' -f4) /boot/efi vfat umask=0077 0 1" >>$TARGET/etc/fstab + echo "$BTRFS / btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab + echo "$BTRFS /.snapshots btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab + echo "$BTRFS /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@libvirt 0 1" >>$TARGET/etc/fstab + echo "$BTRFS /var/lib/flatpak btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@flatpak 0 1" >>$TARGET/etc/fstab + echo "tmpfs /var/log tmpfs defaults,dev,exec 0 0" >>$TARGET/etc/fstab + echo "tmpfs /tmp tmpfs defaults 0 0" >>$TARGET/etc/fstab + echo "tmpfs /var/tmp/portage tmpfs defaults,size=$TMPFS_SIZE 0 0" >>$TARGET/etc/fstab + echo "tmpfs /home/${USER}/.cache tmpfs rw,user,exec 0 0" >>$TARGET/etc/fstab + echo "tmpfs /home/${USER}/Downloads tmpfs rw,user,exec 0 0" >>$TARGET/etc/fstab + echo "$BTRFS /home btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@home 0 1" >>$TARGET/etc/fstab + echo "$BTRFS /root btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@root 0 1" >>$TARGET/etc/fstab + echo "$BTRFS /var/lib/containers btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@containers 0 1" >>$TARGET/etc/fstab +} + +accounts() { + echo + echo "Set Password for $USER" + useradd -m -s /bin/bash $USER + echo "$USER:$USER_PASSWORD" | chpasswd + gpasswd -a $USER wheel + gpasswd -a $USER network + gpasswd -a $USER video + gpasswd -a $USER libvirt + gpasswd -a $USER netdev + gpasswd -a $USER adm + echo "$USER ALL=(ALL) ALL" >/etc/sudoers + echo "root ALL=(ALL) ALL" >>/etc/sudoers + echo + echo "Setting ROOT Password:" + echo "root:$ROOT_PASSWORD" | chpasswd + /usr/bin/hostnamectl set-hostname $ROOT_NAME +} + +btrfs-tweaks() { + DISABLE_COW=("/var/lib/docker" "/var/lib/containers" "/volumes" "/var/lib/mysql" "/var/lib/libvirt") + + for i in "${DISABLE_COW[@]}"; do + chattr -R +C $i + done +} + +initialize-disk() { + parted /dev/$HARD_DISK mklabel gpt + parted -a optimal /dev/$HARD_DISK mkpart primary fat32 1MiB 200MiB + parted -a optimal /dev/$HARD_DISK mkpart primary ext3 200MiB 700MiB + parted -a optimal /dev/$HARD_DISK set 1 esp on + parted -a optimal /dev/$HARD_DISK mkpart P2 ext3 700MiB 98% + parted -a optimal /dev/$HARD_DISK mkpart P2 ext3 98% 100% + partitionDetection + echo + echo "Formatting....." + echo y | mkfs.btrfs $BTRFS --force + echo "Formatting $EFI" + echo + echo y | mkfs.vfat $EFI + echo "Formatting $BOOT" + echo y | mkfs.ext4 $BOOT + echo + echo "Initialize Complete. Please reboot your machine to avoid any issues" + echo +} + +wifi() { + iwctl --passphrase $WIRELESS_PASSWORD station $WIRELESS_INTERFACE connect $SSID +} + +show-help() { + clear + echo + echo "[gentoo.sh arguments]" + echo + echo "./gentoo.sh wifi" + echo "./gentoo.sh bootloader [disk] [ROOT_NAME] [ROOT_MAPPER_NAME]" + echo "./gentoo.sh initialize" + echo "./gentoo.sh tar [device name] [location]" + echo "./gentoo.sh snapshot" + echo "./gentoo.sh reomve-snapshot" + echo "./gentoo.sh btrfs-tweaks" + echo +} + +tweaks() { + clear + echo + echo "Gentoo Installer System Tweaks]" + echo + echo "[1] Reinstall Bootloader" + echo "[2] Chroot into existing OS" + echo + read -p 'Your Choice: ' choice + if [[ $choice = 1 ]]; then + set-devices + bootloader $HARD_DISK $ROOT_NAME $BTRFS + elif [[ $choice = 2 ]]; then + set-devices + partitions + systemMounts + /usr/sbin/chroot $TARGET /bin/bash + fi +} + +menu() { + clear + echo + echo "[Welcome to the Poster.place Gentoo Installer System]" + echo + echo "[1] Install" + echo "[2] Backup" + echo "[3] Restore" + echo "[4] Tools and Tweaks" + echo "[5] Initialize Disk" + echo + read -p 'Your Choice: ' choice + if [[ $choice = 1 ]]; then + clear + echo "[Install OS]" + echo + echo + set-devices + install "$HARD_DISK" + elif [[ $choice = 2 ]]; then + clear + echo "[Backup OS]" + echo + read -p 'Backup Home Directory? : ' -e -i 'n' home_backup + read -p 'OS Backup Directory Location : ' -e -i "/mnt" backup_directory + if [[ $home_backup = *n* ]]; then + os-backup "none" "$backup_directory" "$ROOT_NAME" + else + os-backup "home" "$backup_directory" "$ROOT_NAME" + fi + elif [[ $choice = 3 ]]; then + clear + echo "[Restore from Backup]" + echo + echo + set-devices + read -p 'Restore Directory Image Source: ' -e -i "/mnt" restore_directory + read -p 'Restore Home Directory? : ' -e -i 'n' home_restore + read -p 'Backup file name to restore: ' -e -i 'gentoo' backup_name + + if [[ $home_restore = *n* ]]; then + os-restore "$HARD_DISK" "$backup_name" "none" "$restore_directory" "$BTRFS" + else + os-restore "$HARD_DISK" "$backup_name" "home" "$restore_directory" "$BTRFS" + fi + elif [[ $choice = 4 ]]; then + tweaks + elif [[ $choice = 5 ]]; then + clear + echo "[Initialize Disk]" + echo + echo + set-devices + initialize-disk + else + menu + fi + +} + +set-devices() { + i=0 + while [ $i != "n" ]; do + clear + echo + echo "Disks and Partitions:" + echo + cat /proc/partitions + echo + 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 + if [[ ! -z $device ]]; then + i="n" + fi + done + + read -p 'BTRFS Root Volume name: ' -e -i "gentoo" root_name + HARD_DISK=$device + partitionDetection + ROOT_NAME=$root_name +} + +if [ "$1" = "desktop" ]; then + desktop +elif [ "$1" = "tar" ]; then + create-os-snapshots "null" "$3" "$2" +elif [ "$1" = "upgrade-system" ]; then + upgrade-system +elif [ "$1" = "wifi" ]; then + wifi +elif [ "$1" = "accounts" ]; then + accounts +elif [ "$1" = "hibernate" ]; then + hibernate-setup +elif [ "$1" = "flatpaks" ]; then + flatpaks +elif [ "$1" = "bootloader" ]; then + bootloader "$2" "$3" "$4" +elif [ "$1" = "snapshot" ]; then + snapshots +elif [ "$1" = "grub-snapshots" ]; then + grub-snapshots +elif [ "$1" = "btrfs-tweaks" ]; then + btrfs-tweaks +elif [ "$1" = "remove-snapshot" ]; then + remove-snapshots +elif [ "$1" = "help" ]; then + show-help +else + menu +fi