Prechádzať zdrojové kódy

add experimental nvme support

Noah Vogt 2 rokov pred
rodič
commit
ab2db473cf
2 zmenil súbory, kde vykonal 12 pridanie a 10 odobranie
  1. 5 4
      arch.sh
  2. 7 6
      chroot.sh

+ 5 - 4
arch.sh

@@ -13,7 +13,7 @@ dialog --no-cancel --inputbox "Enter the hostname." 10 60 2>comp
 
 
 clear
 clear
 lsblk -d | sed 's/0 disk/0 disk\\n/;s/POINT/POINT\\n/'
 lsblk -d | sed 's/0 disk/0 disk\\n/;s/POINT/POINT\\n/'
-read -p "Press any key to continue"
+read -rp "Press any key to continue"
 
 
 dialog --no-cancel --inputbox "Enter the drive you want do install Arch on." 10 60 2>drive
 dialog --no-cancel --inputbox "Enter the drive you want do install Arch on." 10 60 2>drive
 
 
@@ -23,10 +23,11 @@ dialog --no-cancel --inputbox "Enter swapsize in gb (only type in numbers)." 10
 
 
 SIZE=$(cat swapsize)
 SIZE=$(cat swapsize)
 DRIVE=$(cat drive)
 DRIVE=$(cat drive)
+PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
 
 
 timedatectl set-ntp true
 timedatectl set-ntp true
 
 
-cat <<EOF | fdisk -W always /dev/${DRIVE}
+cat <<EOF | fdisk -W always /dev/"${DRIVE}"
 o
 o
 n
 n
 p
 p
@@ -47,11 +48,11 @@ EOF
 partprobe
 partprobe
 
 
 while true; do
 while true; do
-    cryptsetup luksFormat --type luks1 /dev/${DRIVE}2 && break
+    cryptsetup luksFormat --type luks1 /dev/"${DRIVE}${PVALUE}2" && break
 done
 done
 
 
 while true; do
 while true; do
-    cryptsetup open /dev/${DRIVE}2 cryptroot && break
+    cryptsetup open /dev/"${DRIVE}${PVALUE}2" cryptroot && break
 done
 done
 
 
 yes | mkfs.ext4 /dev/mapper/cryptroot
 yes | mkfs.ext4 /dev/mapper/cryptroot

+ 7 - 6
chroot.sh

@@ -1,15 +1,16 @@
 #!/bin/bash
 #!/bin/bash
 
 
-while true; do 
+while true; do
     passwd && break
     passwd && break
 done
 done
 
 
 TZuser=$(cat tzfinal.tmp)
 TZuser=$(cat tzfinal.tmp)
 DRIVE=$(cat drive)
 DRIVE=$(cat drive)
+PVALUE=$(echo "${DRIVE}" | grep "^nvme" | sed 's/.*[0-9]/p/')
 
 
 echo KEYMAP=de_CH-latin1 > /etc/vconsole.conf
 echo KEYMAP=de_CH-latin1 > /etc/vconsole.conf
 
 
-ln -sf /usr/share/zoneinfo/$TZuser /etc/localtime
+ln -sf /usr/share/zoneinfo/"$TZuser" /etc/localtime
 
 
 hwclock --systohc
 hwclock --systohc
 
 
@@ -22,7 +23,7 @@ systemctl enable NetworkManager
 
 
 dd bs=512 count=4 if=/dev/urandom of=/crypto_keyfile.bin
 dd bs=512 count=4 if=/dev/urandom of=/crypto_keyfile.bin
 while true; do
 while true; do
-    cryptsetup luksAddKey /dev/${DRIVE}2 /crypto_keyfile.bin && break
+    cryptsetup luksAddKey /dev/"${DRIVE}${PVALUE}2" /crypto_keyfile.bin && break
 done
 done
 chmod 000 /crypto_keyfile.bin
 chmod 000 /crypto_keyfile.bin
 
 
@@ -31,12 +32,12 @@ sed -i 's/block filesystems/block encrypt filesystems/' /etc/mkinitcpio.conf
 mkinitcpio -P
 mkinitcpio -P
 
 
 pacman --noconfirm --needed -S grub
 pacman --noconfirm --needed -S grub
-sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=\/dev\/${DRIVE}2:cryptroot\"/" /etc/default/grub
+sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"cryptdevice=\/dev\/${DRIVE}${PVALUE}2:cryptroot\"/" /etc/default/grub
 sed -i 's/#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/' /etc/default/grub
 sed -i 's/#GRUB_ENABLE_CRYPTODISK/GRUB_ENABLE_CRYPTODISK/' /etc/default/grub
 
 
-echo "swap /dev/${DRIVE}1 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> /etc/crypttab
+echo "swap /dev/${DRIVE}${PVALUE}1 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256" >> /etc/crypttab
 
 
-grub-install --target=i386-pc /dev/${DRIVE} --recheck
+grub-install --target=i386-pc /dev/"${DRIVE}" --recheck
 grub-mkconfig -o /boot/grub/grub.cfg
 grub-mkconfig -o /boot/grub/grub.cfg
 
 
 rm drive tzfinal.tmp
 rm drive tzfinal.tmp