Add luks support

This commit is contained in:
MatMoul 2015-08-22 22:30:25 +02:00
parent efaef97f66
commit 0998b342e9
2 changed files with 21 additions and 6 deletions

22
archfi
View file

@ -546,10 +546,10 @@ formatdevice(){
xfs) mkfs.xfs -f $2;; xfs) mkfs.xfs -f $2;;
jfs) mkfs.jfs -f $2;; jfs) mkfs.jfs -f $2;;
luks) luks)
echo "Create luks device :" # string echo "$txtcreateluksdevice"
cryptsetup luksFormat $2 cryptsetup luksFormat $2
echo "" echo ""
echo "Open luks device :" # string echo "$txtopenluksdevice"
cryptsetup luksOpen $2 $1 cryptsetup luksOpen $2 $1
pressanykey pressanykey
formatdevice $1 /dev/mapper/$1 noluks formatdevice $1 /dev/mapper/$1 noluks
@ -565,7 +565,7 @@ formatdevice(){
crypttab="\n$1 UUID=$(cryptsetup luksUUID $2) none" crypttab="\n$1 UUID=$(cryptsetup luksUUID $2) none"
fi fi
echo "" echo ""
echo "luks device created !" # string echo "$txtluksdevicecreated"
;; ;;
esac esac
echo "" echo ""
@ -676,6 +676,7 @@ archmenu(){
options+=("${txtgenerate//%1/mkinitcpio.conf}" "(encrypt hooks)") options+=("${txtgenerate//%1/mkinitcpio.conf}" "(encrypt hooks)")
fi fi
options+=("${txtedit//%1/fstab}" "($txtoptional)") options+=("${txtedit//%1/fstab}" "($txtoptional)")
options+=("${txtedit//%1/cryptotab}" "($txtoptional)")
options+=("${txtedit//%1/mkinitcpio.conf}" "($txtoptional)") options+=("${txtedit//%1/mkinitcpio.conf}" "($txtoptional)")
options+=("${txtedit//%1/mirrorlist}" "($txtoptional)") options+=("${txtedit//%1/mirrorlist}" "($txtoptional)")
options+=("${txtinstall//%1/grub}" "pacstrap grub (os-prober), grub-mkconfig") options+=("${txtinstall//%1/grub}" "pacstrap grub (os-prober), grub-mkconfig")
@ -736,6 +737,10 @@ archmenu(){
nano /mnt/etc/fstab nano /mnt/etc/fstab
nextitem="${txtedit//%1/fstab}" nextitem="${txtedit//%1/fstab}"
;; ;;
"${txtedit//%1/cryptotab}")
nano /mnt/etc/cryptotab
nextitem="${txtedit//%1/cryptotab}"
;;
"${txtedit//%1/mkinitcpio.conf}") "${txtedit//%1/mkinitcpio.conf}")
archeditmkinitcpio archeditmkinitcpio
nextitem="${txtedit//%1/mkinitcpio.conf}" nextitem="${txtedit//%1/mkinitcpio.conf}"
@ -902,11 +907,13 @@ archgenfstab(){
} }
archgencryptotab(){ archgencryptotab(){
#learn archgenfstab
clear clear
echo -e "$crypttab" >> /mnt/etc/crypttab echo -e "$crypttab" >> /mnt/etc/crypttab
} }
archgenmkinitcpio(){ archgenmkinitcpio(){
#learn archgenfstab
clear clear
sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf sed -i "s/block filesystems/block encrypt filesystems/g" /mnt/etc/mkinitcpio.conf
archchroot genmkinitcpio archchroot genmkinitcpio
@ -949,14 +956,12 @@ archinstallgrub(){
fi fi
if [ "$luksroot" = "1" ]; then if [ "$luksroot" = "1" ]; then
if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/grub}" --yesno "luks root detected ! Add to grub.cfg" 0 0) then # string if (whiptail --backtitle "$apptitle" --title "${txtinstall//%1/grub}" --yesno "$txtgrubluksdetected" 0 0) then
clear clear
sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/$luksrootuuid:root\" /mnt/etc/default/grub sed -i /GRUB_CMDLINE_LINUX=/c\GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/$luksrootuuid:root\" /mnt/etc/default/grub
fi fi
fi fi
clear clear
archchroot installgrub archchroot installgrub
} }
@ -1148,6 +1153,9 @@ loadstrings(){
txtselectpartformat="Select partition format for %1 :" txtselectpartformat="Select partition format for %1 :"
txtformatingpart="Formatting partition %1 as" txtformatingpart="Formatting partition %1 as"
txtcreateluksdevice="Create luks device :"
txtopenluksdevice="Open luks device :"
txtluksdevicecreated="luks device created !"
txtinstallmenu="Install Menu" txtinstallmenu="Install Menu"
@ -1173,6 +1181,8 @@ loadstrings(){
txtinstall="Install %1" txtinstall="Install %1"
txtenable="Enable %1" txtenable="Enable %1"
txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
txtpressanykey="Press any key to continue." txtpressanykey="Press any key to continue."

View file

@ -40,6 +40,9 @@ txtformatdeviceconfirm="Attention, toutes les données sur les partitions sélec
txtselectpartformat="Sélectionnez le format de la parition %1 :" txtselectpartformat="Sélectionnez le format de la parition %1 :"
txtformatingpart="Formatting partition %1 as" txtformatingpart="Formatting partition %1 as"
txtcreateluksdevice="Creatation de la partition luks :"
txtopenluksdevice="Ouverture de la partition luks :"
txtluksdevicecreated="La partition luks à été crée !"
txtinstallmenu="Menu Installation" txtinstallmenu="Menu Installation"
@ -65,6 +68,8 @@ txtedit="Editer %1"
txtinstall="Installer %1" txtinstall="Installer %1"
txtenable="Activer %1" txtenable="Activer %1"
txtgrubluksdetected="Partition root cryptée !\n\nAjouter cryptdevice= to GRUB_CMDLINE_LINUX dans /etc/default/grub ?"
txtpressanykey="Appuyez sur une touche pour continuer." txtpressanykey="Appuyez sur une touche pour continuer."