fix
This commit is contained in:
parent
fb7752c9ad
commit
9879409881
142
gentoo.sh
142
gentoo.sh
@ -36,11 +36,14 @@ USER="verita84"
|
|||||||
USER_PASSWORD="123456"
|
USER_PASSWORD="123456"
|
||||||
ROOT_PASSWORD="123456"
|
ROOT_PASSWORD="123456"
|
||||||
WIRELESS_PASSWORD='123456'
|
WIRELESS_PASSWORD='123456'
|
||||||
SSID='123456'
|
SSID='WIfi'
|
||||||
DISK_PASSWORD='123456'
|
|
||||||
AUTO_DECRYPT='False'
|
|
||||||
WIRELESS_INTERFACE='wlan0'
|
WIRELESS_INTERFACE='wlan0'
|
||||||
COMPRESSION='compress=zstd:10'
|
COMPRESSION='compress=zstd:10'
|
||||||
|
#Full Disk Encryption Settings
|
||||||
|
FULL_DISK_ENCRYPTION="True"
|
||||||
|
AUTO_DECRYPT='False'
|
||||||
|
DISK_PASSWORD='123456'
|
||||||
|
##############################
|
||||||
FLATPAKS+=()
|
FLATPAKS+=()
|
||||||
SERVICES+=(cronie libvirtd smartd cronie cups NetworkManager dev-zram0.swap)
|
SERVICES+=(cronie libvirtd smartd cronie cups NetworkManager dev-zram0.swap)
|
||||||
MAKEOPTS="-j$(cat /proc/cpuinfo | grep -i processor | grep -vi 'model' | wc -l)"
|
MAKEOPTS="-j$(cat /proc/cpuinfo | grep -i processor | grep -vi 'model' | wc -l)"
|
||||||
@ -70,8 +73,11 @@ partitionDetection() {
|
|||||||
EFI=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -1 | tail -1)
|
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)
|
BTRFS=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -2 | tail -1)
|
||||||
SWAP=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -3 | tail -1)
|
SWAP=$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -3 | tail -1)
|
||||||
ROOT_MAPPER_NAME="luks-$(/sbin/blkid -s UUID -o value $BTRFS)"
|
if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then
|
||||||
echo $ROOT_MAPPER_NAME
|
ROOT_MAPPER_NAME="/dev/mapper/luks-$(/sbin/blkid -s UUID -o value ${BTRFS})"
|
||||||
|
else
|
||||||
|
ROOT_MAPPER_NAME="$(blkid | grep $HARD_DISK | sort | cut -d ":" -f1 | head -2 | tail -1)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
partitionDetection
|
partitionDetection
|
||||||
@ -84,7 +90,6 @@ torConfig() {
|
|||||||
echo "AvoidDiskWrites 1" >>/etc/tor/torrc
|
echo "AvoidDiskWrites 1" >>/etc/tor/torrc
|
||||||
echo "HardwareAccel 1" >>/etc/tor/torrc
|
echo "HardwareAccel 1" >>/etc/tor/torrc
|
||||||
echo "NumCPUs 4" >>/etc/tor/torrc
|
echo "NumCPUs 4" >>/etc/tor/torrc
|
||||||
chown -R debian-tor:debian-tor /etc/tor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decryptBoot() {
|
decryptBoot() {
|
||||||
@ -143,13 +148,16 @@ homeBackup() {
|
|||||||
|
|
||||||
osBackup() {
|
osBackup() {
|
||||||
umount $TARGET
|
umount $TARGET
|
||||||
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $ROOT_MAPPER_NAME
|
|
||||||
|
|
||||||
if [[ -e "/dev/mapper/$ROOT_MAPPER_NAME" ]]; then
|
if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then
|
||||||
|
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $ROOT_MAPPER_NAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -e "$ROOT_MAPPER_NAME" ]]; then
|
||||||
echo
|
echo
|
||||||
echo "[Mounting.....]"
|
echo "[Mounting.....]"
|
||||||
echo
|
echo
|
||||||
mount -o $COMPRESSION /dev/mapper/$ROOT_MAPPER_NAME $TARGET
|
mount -o $COMPRESSION $ROOT_MAPPER_NAME $TARGET
|
||||||
|
|
||||||
if [[ -e "$TARGET/@$ROOT_NAME/usr/bin/bash" ]]; then
|
if [[ -e "$TARGET/@$ROOT_NAME/usr/bin/bash" ]]; then
|
||||||
if [ "$1" = "home" ]; then
|
if [ "$1" = "home" ]; then
|
||||||
@ -167,7 +175,7 @@ osBackup() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Aborting Install, /dev/mapper/$ROOT_MAPPER_NAME not found!"
|
echo "Aborting Install, $ROOT_MAPPER_NAME not found!"
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
@ -217,14 +225,14 @@ systemMounts() {
|
|||||||
echo
|
echo
|
||||||
echo "Mounting Boot,EFI,HOME"
|
echo "Mounting Boot,EFI,HOME"
|
||||||
echo
|
echo
|
||||||
mount /dev/mapper/$ROOT_MAPPER_NAME $TARGET
|
mount $ROOT_MAPPER_NAME $TARGET
|
||||||
mount $BTRFS $TARGET
|
mount $BTRFS $TARGET
|
||||||
btrfs_filesytem
|
btrfs_filesytem
|
||||||
mkdir -p $TARGET/boot/EFI
|
mkdir -p $TARGET/boot/EFI
|
||||||
mount $EFI $TARGET/boot
|
mount $EFI $TARGET/boot
|
||||||
#CONFIGURE DATA DIRS (HOME)
|
#CONFIGURE DATA DIRS (HOME)
|
||||||
mkdir $TARGET/home
|
mkdir $TARGET/home
|
||||||
mount -o subvol=@home /dev/mapper/$ROOT_MAPPER_NAME $TARGET/home
|
mount -o subvol=@home $ROOT_MAPPER_NAME $TARGET/home
|
||||||
mkdir $TARGET/home/$USER
|
mkdir $TARGET/home/$USER
|
||||||
|
|
||||||
mkdir $TARGET/run
|
mkdir $TARGET/run
|
||||||
@ -421,8 +429,15 @@ btrfsTweaks() {
|
|||||||
liveOSrestore() {
|
liveOSrestore() {
|
||||||
clear
|
clear
|
||||||
mkdir /tmp/live
|
mkdir /tmp/live
|
||||||
LIVE_OS_DM="/dev/mapper/$(mount | grep -i ' / ' | cut -d '/' -f4 | cut -d ' ' -f1)"
|
INSTALL_TYPE=$(mount | grep ' / ')
|
||||||
LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')"
|
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
|
partitions
|
||||||
systemMounts
|
systemMounts
|
||||||
clear
|
clear
|
||||||
@ -430,6 +445,7 @@ liveOSrestore() {
|
|||||||
echo "[Transferring Currenting Running OS from $LIVE_OS_DM to $HARD_DISK ]"
|
echo "[Transferring Currenting Running OS from $LIVE_OS_DM to $HARD_DISK ]"
|
||||||
echo
|
echo
|
||||||
mount $LIVE_OS_DM /tmp/live
|
mount $LIVE_OS_DM /tmp/live
|
||||||
|
|
||||||
cd /tmp/live/$LIVE_OS_SUBVOL
|
cd /tmp/live/$LIVE_OS_SUBVOL
|
||||||
rsync -a --delete . --exclude=home/* --exclude=.snapshots/* --exclude=sys/* --exclude=dev/* --exclude=proc/* --exclude=run/* $TARGET/
|
rsync -a --delete . --exclude=home/* --exclude=.snapshots/* --exclude=sys/* --exclude=dev/* --exclude=proc/* --exclude=run/* $TARGET/
|
||||||
fstab
|
fstab
|
||||||
@ -489,7 +505,8 @@ btrfs_filesytem() {
|
|||||||
echo "Binding BTRFS Root"
|
echo "Binding BTRFS Root"
|
||||||
echo
|
echo
|
||||||
umount $TARGET
|
umount $TARGET
|
||||||
mount -o $COMPRESSION,subvol=@$ROOT_NAME /dev/mapper/$ROOT_MAPPER_NAME $TARGET
|
echo mount -o $COMPRESSION,subvol=@$ROOT_NAME $ROOT_MAPPER_NAME $TARGET
|
||||||
|
mount -o $COMPRESSION,subvol=@$ROOT_NAME $ROOT_MAPPER_NAME $TARGET
|
||||||
}
|
}
|
||||||
|
|
||||||
userTweaks() {
|
userTweaks() {
|
||||||
@ -567,19 +584,18 @@ locale() {
|
|||||||
|
|
||||||
fstab() {
|
fstab() {
|
||||||
mkdir $TARGET/etc
|
mkdir $TARGET/etc
|
||||||
echo "Debug $ROOT_MAPPER_NAME"
|
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value $EFI) /boot vfat defaults,fmask=0077,dmask=0077 0 1" >$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $EFI) /boot vfat defaults,fmask=0077,dmask=0077 0 1" >$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) / btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) / btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /.snapshots btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /.snapshots btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@libvirt 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@libvirt 0 1" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /var/lib/flatpak btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@flatpak 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /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 /var/log tmpfs defaults,dev,exec 0 0" >>$TARGET/etc/fstab
|
||||||
echo "tmpfs /tmp tmpfs defaults 0 0" >>$TARGET/etc/fstab
|
echo "tmpfs /tmp tmpfs defaults 0 0" >>$TARGET/etc/fstab
|
||||||
echo "tmpfs /home/${USER}/.cache tmpfs rw,user,exec 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 "tmpfs /home/${USER}/Downloads tmpfs rw,user,exec 0 0" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /home btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@home 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /home btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@home 0 1" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /root btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@root 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /root btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@root 0 1" >>$TARGET/etc/fstab
|
||||||
echo "UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/$ROOT_MAPPER_NAME) /var/lib/containers btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@containers 0 1" >>$TARGET/etc/fstab
|
echo "UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) /var/lib/containers btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@containers 0 1" >>$TARGET/etc/fstab
|
||||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
if [[ $SWAP_CHOICE = *y* ]]; then
|
||||||
echo "$SWAP none swap 0 0" >>$TARGET/etc/fstab
|
echo "$SWAP none swap 0 0" >>$TARGET/etc/fstab
|
||||||
fi
|
fi
|
||||||
@ -630,11 +646,15 @@ initializeDisk() {
|
|||||||
parted -a optimal /dev/$HARD_DISK mkpart P2 ext3 2024MiB 100%
|
parted -a optimal /dev/$HARD_DISK mkpart P2 ext3 2024MiB 100%
|
||||||
fi
|
fi
|
||||||
partitionDetection
|
partitionDetection
|
||||||
printf "$DISK_PASSWORD\n$DISK_PASSWORD" | cryptsetup luksFormat ${BTRFS}
|
if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then
|
||||||
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $ROOT_MAPPER_NAME
|
printf "$DISK_PASSWORD\n$DISK_PASSWORD" | cryptsetup luksFormat ${BTRFS}
|
||||||
|
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $(echo $ROOT_MAPPER_NAME | sed 's/\/dev\/mapper\///')
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Formatting....."
|
echo "Formatting....."
|
||||||
echo y | mkfs.btrfs /dev/mapper/$ROOT_MAPPER_NAME -f
|
echo "mkfs.btrfs $ROOT_MAPPER_NAME -f"
|
||||||
|
echo y | mkfs.btrfs $ROOT_MAPPER_NAME -f
|
||||||
echo
|
echo
|
||||||
echo "Formatting $EFI"
|
echo "Formatting $EFI"
|
||||||
echo
|
echo
|
||||||
@ -646,6 +666,7 @@ initializeDisk() {
|
|||||||
echo "Initialize Complete. Please reboot your machine to avoid any issues"
|
echo "Initialize Complete. Please reboot your machine to avoid any issues"
|
||||||
echo
|
echo
|
||||||
cryptsetup close $ROOT_MAPPER_NAME
|
cryptsetup close $ROOT_MAPPER_NAME
|
||||||
|
rm -f /tmp/disk
|
||||||
}
|
}
|
||||||
|
|
||||||
wifi() {
|
wifi() {
|
||||||
@ -822,6 +843,7 @@ menu() {
|
|||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
setDevices
|
setDevices
|
||||||
|
partitionDetection
|
||||||
initializeDisk
|
initializeDisk
|
||||||
read -p "Press enter key to Continue"
|
read -p "Press enter key to Continue"
|
||||||
menu
|
menu
|
||||||
@ -833,13 +855,15 @@ menu() {
|
|||||||
partitions() {
|
partitions() {
|
||||||
echo
|
echo
|
||||||
echo "Setting Up Partitions....."
|
echo "Setting Up Partitions....."
|
||||||
echo printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $ROOT_MAPPER_NAME
|
if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then
|
||||||
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $ROOT_MAPPER_NAME
|
printf "$DISK_PASSWORD" | cryptsetup open ${BTRFS} $(echo $ROOT_MAPPER_NAME | sed 's/\/dev\/mapper\///')
|
||||||
if [[ -e "/dev/mapper/$ROOT_MAPPER_NAME" ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ -e "$ROOT_MAPPER_NAME" ]]; then
|
||||||
fstab
|
fstab
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "Aborting Install, /dev/mapper/$ROOT_MAPPER_NAME not found!"
|
echo "Aborting Install, $ROOT_MAPPER_NAME not found!"
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
@ -851,6 +875,16 @@ setDevices() {
|
|||||||
HARD_DISK=$(cat /tmp/disk | head -1)
|
HARD_DISK=$(cat /tmp/disk | head -1)
|
||||||
ROOT_NAME=$(cat /tmp/disk | tail -3 | head -1)
|
ROOT_NAME=$(cat /tmp/disk | tail -3 | head -1)
|
||||||
SWAP_CHOICE=$(cat /tmp/disk | tail -1 | head -1)
|
SWAP_CHOICE=$(cat /tmp/disk | tail -1 | head -1)
|
||||||
|
partitionDetection
|
||||||
|
echo
|
||||||
|
echo "Configuration Settings:"
|
||||||
|
echo
|
||||||
|
echo "Disk: $HARD_DISK"
|
||||||
|
echo "Root Name: $ROOT_NAME"
|
||||||
|
echo "Root Mapper Name: $ROOT_MAPPER_NAME"
|
||||||
|
echo "Swap Choice: $SWAP_CHOICE"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
else
|
else
|
||||||
i=0
|
i=0
|
||||||
while [ $i != "n" ]; do
|
while [ $i != "n" ]; do
|
||||||
@ -909,19 +943,25 @@ bootloader() {
|
|||||||
LOADER_FILE="/boot/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
LOADER_FILE="/boot/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
|
||||||
PREVIOUS_LOADER_FILE="/boot/loader/entries/previous.conf"
|
PREVIOUS_LOADER_FILE="/boot/loader/entries/previous.conf"
|
||||||
clear
|
clear
|
||||||
|
KERNEL_COMMAND_LINE="mitigations=off root=UUID=$(/sbin/blkid -s UUID -o value $ROOT_MAPPER_NAME) rootflags=subvol=@$ROOT_NAME rw "
|
||||||
|
rm -f /etc/crypttab
|
||||||
|
echo >/etc/dracut.conf
|
||||||
|
|
||||||
echo 'add_dracutmodules+=" crypt dm rootfs-block "' >/etc/dracut.conf
|
|
||||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
if [[ $SWAP_CHOICE = *y* ]]; then
|
||||||
echo "kernel_cmdline+=\" resume=UUID=$(/sbin/blkid -s UUID -o value ${SWAP}) mitigations=off rd.luks.key=/boot/keyfile.key:UUID=$(/sbin/blkid -s UUID -o value ${EFI}) rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@$ROOT_NAME rw \"" >>/etc/dracut.conf
|
KERNEL_COMMAND_LINE="$KERNEL_COMMAND_LINE: resume=UUID=$(/sbin/blkid -s UUID -o value $SWAP) "
|
||||||
else
|
|
||||||
echo "kernel_cmdline+=\" mitigations=off rd.luks.key=/boot/keyfile.key:UUID=$(/sbin/blkid -s UUID -o value ${EFI}) rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@$ROOT_NAME rw \"" >>/etc/dracut.conf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$AUTO_DECRYPT" == "True" ]; then
|
if [[ $FULL_DISK_ENCRYPTION = *True* ]]; then
|
||||||
echo "$ROOT_MAPPER_NAME UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) none" >/etc/crypttab
|
KERNEL_COMMAND_LINE="$KERNEL_COMMAND_LINE: rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS})"
|
||||||
decryptBoot "${BTRFS}"
|
echo "add_dracutmodules+=\" crypt dm rootfs-block \"" >/etc/dracut.conf
|
||||||
else
|
echo "kernel_cmdline+=\" $KERNEL_COMMAND_LINE \" " >>/etc/dracut.conf
|
||||||
echo "$ROOT_MAPPER_NAME UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) none luks" >/etc/crypttab
|
|
||||||
|
if [ "$AUTO_DECRYPT" == "True" ]; then
|
||||||
|
echo "$(echo $ROOT_MAPPER_NAME | sed 's/\/dev\/mapper\///') UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) none" >/etc/crypttab
|
||||||
|
decryptBoot "${BTRFS}"
|
||||||
|
else
|
||||||
|
echo "$(echo $ROOT_MAPPER_NAME | sed 's/\/dev\/mapper\///') UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) none luks" >/etc/crypttab
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /boot/$MACHINE_ID/$KERNEL_VERSION
|
mkdir -p /boot/$MACHINE_ID/$KERNEL_VERSION
|
||||||
@ -937,31 +977,19 @@ bootloader() {
|
|||||||
echo "default $MACHINE_ID" >/boot/loader/loader.conf
|
echo "default $MACHINE_ID" >/boot/loader/loader.conf
|
||||||
echo "timeout 1" >>/boot/loader/loader.conf
|
echo "timeout 1" >>/boot/loader/loader.conf
|
||||||
|
|
||||||
#Generate Previous Boot Entry
|
|
||||||
echo "title Previous" >$PREVIOUS_LOADER_FILE
|
|
||||||
echo "version $KERNEL_VERSION" >>$PREVIOUS_LOADER_FILE
|
|
||||||
|
|
||||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
|
||||||
echo "options resume=UUID=$(/sbin/blkid -s UUID -o value ${SWAP}) mitigations=off rd.luks.key=/boot/keyfile.key:UUID=$(/sbin/blkid -s UUID -o value ${EFI}) rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@.snapshots/previous rw " >>$PREVIOUS_LOADER_FILE
|
|
||||||
else
|
|
||||||
echo "options mitigations=off rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@previous rw " >>$PREVIOUS_LOADER_FILE
|
|
||||||
fi
|
|
||||||
echo "machine-id $MACHINE_ID" >>$PREVIOUS_LOADER_FILE
|
|
||||||
echo "linux /$KERNEL" >>$PREVIOUS_LOADER_FILE
|
|
||||||
echo "initrd /$MACHINE_ID/$KERNEL_VERSION/initrd" >>$PREVIOUS_LOADER_FILE
|
|
||||||
|
|
||||||
#Generate Main Boot Entry
|
#Generate Main Boot Entry
|
||||||
echo "title Current" >$LOADER_FILE
|
echo "title Current" >$LOADER_FILE
|
||||||
echo "version $KERNEL_VERSION" >>$LOADER_FILE
|
echo "version $KERNEL_VERSION" >>$LOADER_FILE
|
||||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
echo "options $KERNEL_COMMAND_LINE " >>$LOADER_FILE
|
||||||
echo "options resume=UUID=$(/sbin/blkid -s UUID -o value ${SWAP}) mitigations=off rd.luks.key=/boot/keyfile.key:UUID=$(/sbin/blkid -s UUID -o value ${EFI}) rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@${ROOT_NAME} rw " >>$LOADER_FILE
|
|
||||||
else
|
|
||||||
echo "options mitigations=off rd.luks.uuid=$(/sbin/blkid -s UUID -o value ${BTRFS}) rd.luks.key=/boot/keyfile.key:UUID=$(/sbin/blkid -s UUID -o value ${EFI}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@${ROOT_NAME} rw " >>$LOADER_FILE
|
|
||||||
fi
|
|
||||||
echo "machine-id $MACHINE_ID" >>$LOADER_FILE
|
echo "machine-id $MACHINE_ID" >>$LOADER_FILE
|
||||||
echo "linux /$KERNEL" >>$LOADER_FILE
|
echo "linux /$KERNEL" >>$LOADER_FILE
|
||||||
echo "initrd /$MACHINE_ID/$KERNEL_VERSION/initrd" >>$LOADER_FILE
|
echo "initrd /$MACHINE_ID/$KERNEL_VERSION/initrd" >>$LOADER_FILE
|
||||||
|
|
||||||
|
#Generate Previous Boot Entry
|
||||||
|
cp -f $LOADER_FILE $PREVIOUS_LOADER_FILE
|
||||||
|
sed -i "s/@${ROOT_NAME}/@previous/" $PREVIOUS_LOADER_FILE
|
||||||
bootctl set-default $MACHINE_ID-$KERNEL_VERSION.conf
|
bootctl set-default $MACHINE_ID-$KERNEL_VERSION.conf
|
||||||
|
|
||||||
#bootctl list
|
#bootctl list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user