f
This commit is contained in:
parent
56b0de085b
commit
739c244ec0
41
gentoo.sh
41
gentoo.sh
@ -71,6 +71,7 @@ partitionDetection() {
|
||||
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)
|
||||
ROOT_MAPPER_NAME="luks-$(/sbin/blkid -s UUID -o value $BTRFS)"
|
||||
echo $ROOT_MAPPER_NAME
|
||||
}
|
||||
|
||||
partitionDetection
|
||||
@ -104,7 +105,12 @@ decryptBoot() {
|
||||
echo "Adding new key......"
|
||||
echo
|
||||
printf "$DISK_PASSWORD" | cryptsetup luksAddKey $1 /boot/$KEYFILE
|
||||
sed -i "s/none/\/boot\/$KEYFILE/" /etc/crypttab
|
||||
echo "install_items+=/boot/$KEYFILE" >>/etc/dracut.conf
|
||||
echo "install_items+=/boot/unlock.sh" >>/etc/dracut.conf
|
||||
sed -i "s/none/\/boot\/$KEYFILE,keyscript=\/boot\/unlock.sh/" /etc/crypttab
|
||||
echo "#!/bin/bash" > /boot/unlock.sh
|
||||
echo "cryptsetup open UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) --key-file=/boot/$KEYFILE $ROOT_MAPPER_NAME" >> /boot/unlock.sh
|
||||
chmod +x /boot/unlock.sh
|
||||
}
|
||||
|
||||
autoLogin() {
|
||||
@ -562,18 +568,19 @@ locale() {
|
||||
|
||||
fstab() {
|
||||
mkdir $TARGET/etc
|
||||
echo "UUID=$(/sbin/blkid -s UUID -o value ${EFI}) /boot vfat defaults,fmask=0077,dmask=0077 0 1" >$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME / btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@$ROOT_NAME 0 1" >>$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME /.snapshots btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@.snapshots 0 1" >>$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME /var/lib/libvirt btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@libvirt 0 1" >>$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME /var/lib/flatpak btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@flatpak 0 1" >>$TARGET/etc/fstab
|
||||
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 /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 /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 /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 /dev/mapper/$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 /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}/Downloads tmpfs rw,user,exec 0 0" >>$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME /home btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@home 0 1" >>$TARGET/etc/fstab
|
||||
echo "/dev/mapper/$ROOT_MAPPER_NAME /root btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@root 0 1" >>$TARGET/etc/fstab
|
||||
echo "/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 /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 /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 /dev/mapper/$ROOT_MAPPER_NAME) /var/lib/containers btrfs noatime,nodiratime,autodefrag,$COMPRESSION,subvol=@containers 0 1" >>$TARGET/etc/fstab
|
||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
||||
echo "$SWAP none swap 0 0" >>$TARGET/etc/fstab
|
||||
fi
|
||||
@ -907,21 +914,17 @@ bootloader() {
|
||||
|
||||
echo 'add_dracutmodules+=" crypt dm rootfs-block "' >/etc/dracut.conf
|
||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
||||
echo "kernel_cmdline+=\" resume=UUID=$(/sbin/blkid -s UUID -o value ${SWAP}) 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=@$ROOT_NAME rw \"" >>/etc/dracut.conf
|
||||
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
|
||||
else
|
||||
echo "kernel_cmdline+=\" 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=@$ROOT_NAME rw \"" >>/etc/dracut.conf
|
||||
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
|
||||
|
||||
if [ "$AUTO_DECRYPT" == "True" ]; then
|
||||
echo "install_items+=/boot/keyfile.key /boot/unlock.sh" >>/etc/dracut.conf
|
||||
#echo "install_items+=/boot/unlock.sh" >>/etc/dracut.conf
|
||||
#echo "#!/bin/bash" >/boot/unlock.sh
|
||||
#echo "cryptsetup open UUID=$(/sbin/blkid -s UUID -o value ${BTRFS}) --key-file /boot/keyfile.key $ROOT_MAPPER_NAME " >>/boot/unlock.sh
|
||||
#chmod +x /boot/unlock.sh
|
||||
decryptBoot "${BTRFS}"
|
||||
fi
|
||||
|
||||
mkdir -p /boot/$MACHINE_ID/$KERNEL_VERSION
|
||||
plymouth-set-default-theme solar
|
||||
dracut --regenerate-all -f
|
||||
|
||||
echo "MachineID=$MACHINE_ID"
|
||||
@ -938,7 +941,7 @@ bootloader() {
|
||||
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.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
|
||||
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
|
||||
@ -950,9 +953,9 @@ bootloader() {
|
||||
echo "title Current" >$LOADER_FILE
|
||||
echo "version $KERNEL_VERSION" >>$LOADER_FILE
|
||||
if [[ $SWAP_CHOICE = *y* ]]; then
|
||||
echo "options resume=UUID=$(/sbin/blkid -s UUID -o value ${SWAP}) 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=@${ROOT_NAME} rw " >>$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}) root=UUID=$(/sbin/blkid -s UUID -o value /dev/mapper/${ROOT_MAPPER_NAME}) rootflags=subvol=@${ROOT_NAME} rw " >>$LOADER_FILE
|
||||
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 "linux /$KERNEL" >>$LOADER_FILE
|
||||
|
Loading…
Reference in New Issue
Block a user