diff --git a/gentoo.sh b/gentoo.sh index 1fa17ee..c55a8d3 100644 --- a/gentoo.sh +++ b/gentoo.sh @@ -48,7 +48,7 @@ SERVICES+=(cronie libvirtd smartd cronie cups NetworkManager zram_swap.service) MAKEOPTS="-j$(cat /proc/cpuinfo | grep -i processor | grep -vi 'model' | wc -l)" ROOT_PARTITION_SIZE="30GB" FEATURES="-pid-sandbox getbinpkg -binpkg-request-signature" -EMERGE_DEFAULT_OPTS=" --getbinpkg " +EMERGE_DEFAULT_OPTS="--jobs 5 --getbinpkg " #USEFLAG CONFIGURATION USE_FLAGS=" systemd-boot -webengine jumbo-build hwaccel -telemetry dist-kernel postscript webchannel qml -gpm plasma luks cryptsetup kernel-install boot proprietary-codecs kernel-install gles2 pulseaudio vpx bluray libaom libdrm libilbc libplacebo libsoxr libv4l libxml2 lv2 openh264 encode iconv ladspa libass libcaca mp3 openal opus theora v4l vorbis xvid x264 gstreamer wayland alsa X sound-server screencast systemd firmware btrfs policykit networkmanager zlib pipewire minizip network " VIDEO_CARDS="amdgpu radeon radeonsi" @@ -61,7 +61,10 @@ DESKTOP_APPS=" firefox-bin kde-apps/kcalc kde-apps/ark kde-frameworks/karchive n PACKAGES="$BASE_PACKAGES $DESKTOP_APPS" TMPFS_SIZE="32G" CPU_TYPE="x86-64" - +BUILD_SERVER="n" +BUILD_SERVER_ADDRESS="192.168.0.55" +BUILD_PATH="/raid/@gentoo" +RSYNC_EXCLUDES="--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=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) @@ -339,6 +342,7 @@ btrfsTweaks() { done } + liveOSrestore() { clear mkdir /tmp/live @@ -361,15 +365,18 @@ liveOSrestore() { mount $LIVE_OS_DM /tmp/live cd /tmp/live/$LIVE_OS_SUBVOL - rsync -a --delete . --exclude=/var/cache --exclude=/var/notmpfs --exclude=/var/lib/docker --exclude=/var/db/repos/* --exclude=/var/lib/systemd/coredump/* --exclude=/var/cache/* --exclude=home/* --exclude=.snapshots/* --exclude=sys/* --exclude=dev/* --exclude=proc/* --exclude=run/* $TARGET/ + + if [[ $BUILD_SERVER = *y* ]]; then + rsync -av --delete -e ssh root@$BUILD_SERVER_ADDRESS:/$BUILD_PATH/ $RSYNC_EXCLUDES . + else + rsync -av --delete . $RSYNC_EXCLUDES $TARGET/ + rsync -av --delete /boot/ $TARGET/boot/ + fi + fstab cp -f $SCRIPT/gentoo.sh $TARGET/usr/bin/ - echo "[Copying Boot Files ]" - echo - rm -f $TARGET/boot/* - rsync -av --delete /boot/ $TARGET/boot/ - cp -f /tmp/disk $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 @@ -396,6 +403,27 @@ liveOSrestore() { #unmount } +backupOS() { + 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 + 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 +} + flatpaks() { echo echo "Installing Flatpaks......" @@ -426,14 +454,18 @@ btrfs_filesytem() { userTweaks() { mkdir -p $TARGET/home/$USER/Documents/keys/keepass mkdir -p $TARGET/home/$USER/dotfiles + mkdir -p $TARGET/home/$USER/.ssh mkdir -p $TARGET/home/$USER/server mkdir -p $TARGET/home/$USER/.config/Exodus - mkdir -p $TARGET/home/$USER/.mozilla + #mkdir -p $TARGET/home/$USER/.mozilla + mkdir -p $TARGET/home/$USER/.config/chromium mkdir -p $TARGET/home/$USER/.local/share/fonts cp -f /home/$USER/.bash* $TARGET/home/$USER/ - rsync -av --delete /home/$USER/.mozilla/ $TARGET/home/$USER/.mozilla/ + #rsync -av --delete /home/$USER/.mozilla/ $TARGET/home/$USER/.mozilla/ + rsync -av --delete /home/$USER/.ssh/ $TARGET/home/$USER/.ssh/ + rsync -av --delete /home/$USER/.config/chromium/ $TARGET/home/$USER/.config/.chromium/ rsync -av --delete /home/$USER/server/ $TARGET/home/$USER/server/ rsync -av --delete /home/$USER/.local/share/fonts/ $TARGET/home/$USER/.local/share/fonts/ rsync -av --delete /home/$USER/.config/Exodus/ $TARGET/home/$USER/.config/Exodus/ @@ -690,8 +722,9 @@ menu() { echo "[3] Install System" echo "[4] Automatic Install" echo "[5] Backup/Restore Live OS to/from removable media" - echo "[6] Tools and Tweaks" - echo "[7] Initialize Disk" + echo "[6] Backup OS to Build Server" + echo "[7] Tools and Tweaks" + echo "[8] Initialize Disk" echo read -p 'Your Choice: ' choice @@ -716,11 +749,18 @@ menu() { elif [[ $choice = 5 ]]; then clear setDevices - setDevices + read -p 'Are you restoring from a build server? ' -e -i "n" QUESTION_BUILD_SERVER + if [[ $QUESTION_BUILD_SERVER = *y* ]]; then + BUILD_SERVER="y" + fi liveOSrestore "$HARD_DISK" $ROOT_MAPPER_NAME "none" "none" "$ROOT_NAME" elif [[ $choice = 6 ]]; then - tweaks + clear + setDevices + backupOS elif [[ $choice = 7 ]]; then + tweaks + elif [[ $choice = 8 ]]; then clear echo "[Initialize Disk]" echo