Update gentoo-kde.sh
This commit is contained in:
parent
f223fc47d7
commit
85776986da
@ -60,15 +60,12 @@ DISTCC_LISTEN="192.168.0.0/24"
|
||||
DISTCC_CORES="30"
|
||||
#Add Masked Packages to the Array
|
||||
MASKED_PACKAGES+=(media-video/ffmpeg www-client/vivaldi-snapshot net-im/element-desktop-bin games-util/game-device-udev-rules games-util/lutris games-util/steam-launcher net-im/telegram-desktop-bin)
|
||||
|
||||
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)
|
||||
BTRFS=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -2 | tail -1)
|
||||
}
|
||||
|
||||
partitionDetection
|
||||
|
||||
create-os-snapshots() {
|
||||
echo
|
||||
mkdir $2
|
||||
@ -80,31 +77,25 @@ create-os-snapshots() {
|
||||
echo
|
||||
time tar cvpzf $1/gentoo-$HOSTNAME-$DATE.tgz $NEW_TAR_EXCLUDES /
|
||||
}
|
||||
|
||||
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() {
|
||||
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
|
||||
@ -112,13 +103,11 @@ os-restore() {
|
||||
echo "[Restoring OS tarfile from $2]"
|
||||
echo
|
||||
tar xfvp $2 -C $TARGET/
|
||||
|
||||
if [ "$3" = "home" ]; then
|
||||
echo "[Restoring /home]"
|
||||
echo
|
||||
rsync -a --delete /home/ $TARGET/home/
|
||||
fi
|
||||
|
||||
cp -f gentoo-kde.sh $TARGET/
|
||||
fstab
|
||||
chmod +x $TARGET/gentoo-kde.sh
|
||||
@ -128,11 +117,9 @@ os-restore() {
|
||||
chown -R $USER:$USER $TARGET/home/$USER
|
||||
rm -f $TARGET/gentoo-kde.sh
|
||||
}
|
||||
|
||||
systemMounts() {
|
||||
echo
|
||||
echo "[Checking for BTRFS Partition]"
|
||||
|
||||
if [[ -e "$BTRFS" ]]; then
|
||||
echo "BTRFS device found"
|
||||
echo
|
||||
@ -146,12 +133,10 @@ systemMounts() {
|
||||
mkdir $TARGET/home
|
||||
mount -o subvol=@home $BTRFS $TARGET/home
|
||||
mkdir $TARGET/home/$USER
|
||||
|
||||
mkdir $TARGET/dev
|
||||
mkdir $TARGET/proc
|
||||
mkdir $TARGET/sys
|
||||
mkdir -p $TARGET/var/tmp/portage
|
||||
|
||||
mount -o rbind /dev $TARGET/dev
|
||||
mount -o rbind /dev/pts $TARGET/dev/pts
|
||||
mount -o rbind /proc $TARGET/proc
|
||||
@ -166,15 +151,12 @@ systemMounts() {
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
unmaskPackages() {
|
||||
echo "" >$TARGET/etc/portage/package.accept_keywords
|
||||
for i in "${MASKED_PACKAGES[@]}"; do
|
||||
echo "$i ~amd64" >>$TARGET/etc/portage/package.accept_keywords
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
distccConfigure() {
|
||||
if [ -z "$DISTCC_LISTEN" ]; then
|
||||
echo
|
||||
@ -208,7 +190,6 @@ distccConfigure() {
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
installCockpit() {
|
||||
COCKPIT_PACKAGES+=(app-admin/cockpit-navigator app-admin/cockpit app-crypt/sscg)
|
||||
for i in "${COCKPIT_PACKAGES[@]}"; do
|
||||
@ -218,27 +199,22 @@ installCockpit() {
|
||||
eselect repository enable gig
|
||||
emerge --sync inode64-overlay
|
||||
emerge --sync gig
|
||||
|
||||
emerge $COCKPIT_PACKAGES --autounmask-write
|
||||
etc-update -q --automode -5
|
||||
emerge $COCKPIT_PACKAGES
|
||||
}
|
||||
|
||||
installNvidia() {
|
||||
ACCEPT_KEYWORDS="~amd64" emerge x11-drivers/nvidia-drivers nvidia-cuda-toolkit www-apps/jellyfin net-im/coturn --autounmask-write
|
||||
etc-update -q --automode -5
|
||||
ACCEPT_KEYWORDS="~amd64" emerge x11-drivers/nvidia-drivers nvidia-cuda-toolkit www-apps/jellyfin net-im/coturn
|
||||
}
|
||||
|
||||
configurePortage() {
|
||||
|
||||
sed -i "s/-O2/-march=$CPU_TYPE -O2/i" $TARGET/etc/portage/make.conf
|
||||
echo 'ACCEPT_KEYWORDS="amd64"' >>$TARGET/etc/portage/make.conf
|
||||
echo "FEATURES=\"$FEATURES\"" >>$TARGET/etc/portage/make.conf
|
||||
echo "EMERGE_DEFAULT_OPTS=\"$EMERGE_DEFAULT_OPTS\"" >>$TARGET/etc/portage/make.conf
|
||||
echo "L10N=\"en en-US\"" >>$TARGET/etc/portage/make.conf
|
||||
mkdir -p $TARGET/var/tmp/portage
|
||||
|
||||
if [ -f "./repos.conf" ]; then
|
||||
echo
|
||||
echo "Found Local Gentoo Repo"
|
||||
@ -250,18 +226,13 @@ configurePortage() {
|
||||
echo
|
||||
echo
|
||||
fi
|
||||
|
||||
chroot $TARGET /usr/bin/emerge --sync
|
||||
|
||||
echo
|
||||
echo "Configuring Binary Package GPG keys"
|
||||
echo
|
||||
chroot $TARGET /usr/bin/getuto
|
||||
|
||||
distccConfigure
|
||||
|
||||
`` echo "USE=\"$USE_FLAGS\"" >>$TARGET/etc/portage/make.conf
|
||||
|
||||
if [ -z "$DISTCC_LISTEN" ]; then
|
||||
echo
|
||||
echo "Not using DistCC"
|
||||
@ -274,7 +245,6 @@ configurePortage() {
|
||||
MAKEOPTS="-j30 -l$(cat /proc/cpuinfo | grep -i processor | grep -vi 'model' | wc -l)"
|
||||
echo "MAKEOPTS=\"$MAKEOPTS\"" >>$TARGET/etc/portage/make.conf
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
@ -284,20 +254,16 @@ configurePortage() {
|
||||
echo
|
||||
GENTOO_PROFILE=$(chroot $TARGET /usr/bin/eselect profile list | grep -i desktop | grep -Evi 'gnome' | grep systemd | grep -i merged | head -1 | cut -d '[' -f2 | cut -d ']' -f1)
|
||||
chroot $TARGET /usr/bin/eselect profile set $GENTOO_PROFILE
|
||||
|
||||
mkdir -p $TARGET/etc/portage/package.license
|
||||
echo "*/* *" >$TARGET/etc/portage/package.license/license
|
||||
rm -rf $TARGET/etc/portage/package.accept_keywords
|
||||
mkdir -p $TARGET/etc/portage/package.mask
|
||||
echo "dev-lang/rust" >$TARGET/etc/portage/package.mask/rust
|
||||
}
|
||||
|
||||
buildGentoo() {
|
||||
|
||||
echo "[Install Base System]"
|
||||
echo
|
||||
echo
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
@ -308,10 +274,7 @@ buildGentoo() {
|
||||
chroot $TARGET etc-update -q --automode -5
|
||||
chroot $TARGET /usr/bin/emerge --update --deep --newuse @world
|
||||
locale
|
||||
|
||||
chroot $TARGET /usr/sbin/systemd-machine-id-setup
|
||||
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
@ -321,9 +284,7 @@ buildGentoo() {
|
||||
chroot $TARGET /usr/bin/emerge -uDN dracut gentoo-kernel-bin sys-kernel/linux-firmware --autounmask-write
|
||||
chroot $TARGET etc-update -q --automode -5
|
||||
chroot $TARGET /usr/bin/emerge -uDN dracut gentoo-kernel-bin sys-kernel/linux-firmware
|
||||
|
||||
unmaskPackages
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
@ -332,7 +293,6 @@ buildGentoo() {
|
||||
echo
|
||||
cp -f gentoo-kde.sh $TARGET/usr/bin/gentoo-kde.sh
|
||||
chroot $TARGET /usr/bin/bash /usr/bin/gentoo-kde.sh install-packages
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
@ -340,13 +300,11 @@ buildGentoo() {
|
||||
echo
|
||||
echo
|
||||
chroot $TARGET /usr/bin/bash /usr/bin/gentoo-kde.sh bootloader $1 $ROOT_NAME $BTRFS
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "[Configuring Accounts and post-setup tasks]"
|
||||
echo
|
||||
echo
|
||||
|
||||
echo 'bash /usr/bin/gentoo-kde.sh accounts' >>$TARGET/setup.sh
|
||||
echo 'bash /usr/bin/gentoo-kde.sh desktop' >>$TARGET/setup.sh
|
||||
echo 'bash /usr/bin/gentoo-kde.sh btrfs-tweaks' >>$TARGET/setup.sh
|
||||
@ -356,13 +314,11 @@ buildGentoo() {
|
||||
chroot $TARGET /setup.sh
|
||||
rm -f $TARGET/setup.sh
|
||||
}
|
||||
|
||||
installPackages(){
|
||||
/usr/bin/emerge -uDN $PACKAGES --autounmask-write
|
||||
/usr/sbin/etc-update -q --automode -5
|
||||
/usr/bin/emerge -uDN $PACKAGES
|
||||
}
|
||||
|
||||
snapshots() {
|
||||
echo
|
||||
echo "Creating Snapshots....."
|
||||
@ -370,12 +326,10 @@ snapshots() {
|
||||
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-*
|
||||
}
|
||||
|
||||
btrfs_filesytem() {
|
||||
btrfs sub create $TARGET/@$ROOT_NAME
|
||||
btrfs sub create $TARGET/@.snapshots
|
||||
@ -388,24 +342,19 @@ btrfs_filesytem() {
|
||||
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
|
||||
|
||||
#Required for Audio to work
|
||||
systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service
|
||||
systemctl --user enable --now pipewire.service
|
||||
}
|
||||
|
||||
desktop() {
|
||||
services
|
||||
}
|
||||
|
||||
installSteam() {
|
||||
eselect repository enable steam-overlay
|
||||
emerge --sync steam-overlay
|
||||
@ -414,14 +363,12 @@ installSteam() {
|
||||
emerge -uDN @world
|
||||
emerge -uDN games-util/steam-launcher app-emulation/wine-vanilla games-util/lutris
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
fstab() {
|
||||
mkdir $TARGET/etc
|
||||
echo "UUID=$(/sbin/blkid -s UUID -o value ${EFI}) /efi vfat umask=0077 0 1" >>$TARGET/etc/fstab
|
||||
@ -434,7 +381,6 @@ 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
|
||||
}
|
||||
|
||||
accounts() {
|
||||
echo
|
||||
echo "Set Password for $USER"
|
||||
@ -454,15 +400,12 @@ accounts() {
|
||||
echo "root:$ROOT_PASSWORD" | chpasswd
|
||||
/usr/bin/hostnamectl set-hostname $ROOT_NAME
|
||||
}
|
||||
|
||||
btrfs-tweaks() {
|
||||
DISABLE_COW=("/var/lib/docker" "/volumes" "/var/lib/mysql" "/var/lib/libvirt")
|
||||
|
||||
for i in "${DISABLE_COW[@]}"; do
|
||||
chattr -R +C $i
|
||||
done
|
||||
}
|
||||
|
||||
initialize-disk() {
|
||||
SWAP_SIZE=$(expr $(cat /proc/meminfo | head -1 | cut -d ':' -f2 | sed 's/ //g' | sed 's/kB//') / 1000 / 1000)
|
||||
SWAP_SIZE_END="$(expr $SWAP_SIZE + $ROOT_PARTITION_SIZE)"
|
||||
@ -484,11 +427,9 @@ initialize-disk() {
|
||||
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
|
||||
@ -503,7 +444,6 @@ show-help() {
|
||||
echo "./gentoo-kde.sh btrfs-tweaks"
|
||||
echo
|
||||
}
|
||||
|
||||
tweaks() {
|
||||
clear
|
||||
echo
|
||||
@ -539,7 +479,6 @@ tweaks() {
|
||||
tweaks
|
||||
fi
|
||||
}
|
||||
|
||||
download-setup() {
|
||||
clear
|
||||
echo "[Choose Deployment Type]"
|
||||
@ -555,7 +494,6 @@ download-setup() {
|
||||
else
|
||||
wget -O /tmp/stage3.tar.xz "$STAGE3_URL"
|
||||
fi
|
||||
|
||||
if [ -f "$STAGE3_FILE" ]; then
|
||||
echo
|
||||
echo
|
||||
@ -573,7 +511,6 @@ download-setup() {
|
||||
cp -f gentoo-kde.sh $TARGET/usr/bin/
|
||||
fi
|
||||
}
|
||||
|
||||
menu() {
|
||||
clear
|
||||
echo
|
||||
@ -589,7 +526,6 @@ menu() {
|
||||
echo "[8] Initialize Disk"
|
||||
echo
|
||||
read -p 'Your Choice: ' choice
|
||||
|
||||
if [[ $choice = 1 ]]; then
|
||||
set-devices
|
||||
read -p "Press enter key to Continue"
|
||||
@ -631,7 +567,6 @@ menu() {
|
||||
FILE_SCAN=$(ls $restore_directory/gentoo-$HOSTNAME-* | tail -1)
|
||||
read -p 'Restore Home Directory? : ' -e -i 'n' home_restore
|
||||
read -p 'Backup file name to restore: ' -e -i "$FILE_SCAN" backup_name
|
||||
|
||||
if [[ $home_restore = *n* ]]; then
|
||||
os-restore "$HARD_DISK" "$backup_name" "none" "$restore_directory" "$BTRFS"
|
||||
else
|
||||
@ -652,7 +587,6 @@ menu() {
|
||||
menu
|
||||
fi
|
||||
}
|
||||
|
||||
set-devices() {
|
||||
if [ -f "/tmp/disk" ]; then
|
||||
HARD_DISK=$(cat /tmp/disk | head -1)
|
||||
@ -674,7 +608,6 @@ set-devices() {
|
||||
i="n"
|
||||
fi
|
||||
done
|
||||
|
||||
read -p 'BTRFS Root Volume name: ' -e -i "gentoo" root_name
|
||||
HARD_DISK=$device
|
||||
ROOT_NAME=$root_name
|
||||
@ -683,7 +616,6 @@ set-devices() {
|
||||
fi
|
||||
partitionDetection
|
||||
}
|
||||
|
||||
bootloader() {
|
||||
echo
|
||||
echo "Configuring Bootloader......."
|
||||
@ -696,7 +628,6 @@ bootloader() {
|
||||
ROOT_NAME=$1
|
||||
BTRFS=$2
|
||||
LOADER_FILE="/efi/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
||||
|
||||
echo "MachineID=$MACHINE_ID"
|
||||
echo "KERNEL IS $KERNEL"
|
||||
echo "Root_Name=$ROOT_NAME"
|
||||
@ -712,10 +643,8 @@ bootloader() {
|
||||
echo "machine-id $MACHINE_ID" >>$LOADER_FILE
|
||||
echo "linux /$MACHINE_ID/$KERNEL_VERSION/linux" >>$LOADER_FILE
|
||||
echo "initrd /$MACHINE_ID/$KERNEL_VERSION/initrd" >>$LOADER_FILE
|
||||
|
||||
bootctl install
|
||||
}
|
||||
|
||||
compile-kernel() {
|
||||
cd /usr/src
|
||||
eselect kernel set 1
|
||||
@ -725,12 +654,10 @@ compile-kernel() {
|
||||
else
|
||||
make allyesconfig
|
||||
fi
|
||||
|
||||
time make -j30 CC="distcc gcc"
|
||||
time make -j30 CC="distcc gcc" modules_install
|
||||
time make install
|
||||
}
|
||||
|
||||
if [ "$1" = "desktop" ]; then
|
||||
desktop
|
||||
elif [ "$1" = "tar" ]; then
|
||||
@ -763,4 +690,4 @@ elif [ "$1" = "help" ]; then
|
||||
show-help
|
||||
else
|
||||
menu
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user