Add child menu for bootloaders

This commit is contained in:
MatMoul 2018-12-30 20:46:28 +01:00
parent 8cf7a43b9b
commit f4ed753fbb
3 changed files with 175 additions and 127 deletions

130
archfi
View file

@ -772,9 +772,7 @@ archmenu(){
options+=("${txtedit//%1/crypttab}" "($txtoptional)") options+=("${txtedit//%1/crypttab}" "($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 (efibootmgr), grub-mkconfig") options+=("$txtbootloader" "")
options+=("${txtedit//%1/grub}" "($txtoptional)")
options+=("${txtinstall//%1/bootloader}" "grub-install")
options+=("${txtenable//%1/dhcpcd}" "systemctl enable dhcpd") options+=("${txtenable//%1/dhcpcd}" "systemctl enable dhcpd")
options+=("archdi" "$txtarchdidesc") options+=("archdi" "$txtarchdidesc")
sel=$(whiptail --backtitle "$apptitle" --title "$txtarchinstallmenu" --menu "" --cancel-button "$txtback" --default-item "$nextitem" 0 0 0 \ sel=$(whiptail --backtitle "$apptitle" --title "$txtarchinstallmenu" --menu "" --cancel-button "$txtback" --default-item "$nextitem" 0 0 0 \
@ -814,7 +812,7 @@ archmenu(){
if [ "$luksroot" = "1" ]; then if [ "$luksroot" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf}" nextitem="${txtgenerate//%1/mkinitcpio.conf}"
else else
nextitem="${txtinstall//%1/grub}" nextitem="$txtbootloader"
fi fi
fi fi
;; ;;
@ -823,12 +821,12 @@ archmenu(){
if [ "$luksroot" = "1" ]; then if [ "$luksroot" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf}" nextitem="${txtgenerate//%1/mkinitcpio.conf}"
else else
nextitem="${txtinstall//%1/grub}" nextitem="$txtbootloader"
fi fi
;; ;;
"${txtgenerate//%1/mkinitcpio.conf}") "${txtgenerate//%1/mkinitcpio.conf}")
archgenmkinitcpio archgenmkinitcpio
nextitem="${txtinstall//%1/grub}" nextitem="$txtbootloader"
;; ;;
"${txtedit//%1/fstab}") "${txtedit//%1/fstab}")
$EDITOR /mnt/etc/fstab $EDITOR /mnt/etc/fstab
@ -846,21 +844,8 @@ archmenu(){
$EDITOR /mnt/etc/pacman.d/mirrorlist $EDITOR /mnt/etc/pacman.d/mirrorlist
nextitem="${txtedit//%1/mirrorlist}" nextitem="${txtedit//%1/mirrorlist}"
;; ;;
"${txtinstall//%1/grub}") "$txtbootloader")
archinstallgrub archbootloadermenu
nextitem="${txtinstall//%1/bootloader}"
;;
"${txtedit//%1/grub}")
$EDITOR /mnt/etc/default/grub
if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/grub}" --yesno "$txtrungrubmakeconfig" 0 0) then
clear
archchroot installgrub
pressanykey
fi
nextitem="${txtinstall//%1/bootloader}"
;;
"${txtinstall//%1/bootloader}")
archinstallbootloader
nextitem="${txtenable//%1/dhcpcd}" nextitem="${txtenable//%1/dhcpcd}"
;; ;;
"${txtenable//%1/dhcpcd}") "${txtenable//%1/dhcpcd}")
@ -1065,7 +1050,61 @@ archgenmkinitcpiochroot(){
exit exit
} }
archinstallgrub(){
archbootloadermenu(){
options=()
options+=("grub" "")
sel=$(whiptail --backtitle "$apptitle" --title "$txtbootloadermenu" --menu "" --cancel-button "$txtback" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"grub")
archbootloadergrubmenu
;;
esac
fi
}
archbootloadergrubmenu(){
if [ "$1" = "" ]; then
nextblitem="."
else
nextblitem=$1
fi
options=()
options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
options+=("${txtedit//%1/grub}" "($txtoptional)")
options+=("${txtinstall//%1/bootloader}" "grub-install")
sel=$(whiptail --backtitle "$apptitle" --title "$txtbootloadergrubmenu" --menu "" --cancel-button "$txtback" --default-item "$nextblitem" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
case $sel in
"${txtinstall//%1/grub}")
archgrubinstall
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtedit//%1/grub}")
$EDITOR /mnt/etc/default/grub
if (whiptail --backtitle "$apptitle" --title "${txtedit//%1/grub}" --yesno "$txtrungrubmakeconfig" 0 0) then
clear
archchroot grubinstall
pressanykey
fi
nextblitem="${txtinstall//%1/bootloader}"
;;
"${txtinstall//%1/bootloader}")
archgrubinstallbootloader
nextblitem="${txtinstall//%1/bootloader}"
;;
esac
archbootloadergrubmenu "$nextblitem"
fi
}
archgrubinstall(){
clear clear
echo "pacstrap /mnt grub" echo "pacstrap /mnt grub"
pacstrap /mnt grub pacstrap /mnt grub
@ -1099,10 +1138,10 @@ archinstallgrub(){
fi fi
clear clear
archchroot installgrub archchroot grubinstall
pressanykey pressanykey
} }
archinstallgrubchroot(){ archgrubinstallchroot(){
echo "mkdir /boot/grub" echo "mkdir /boot/grub"
echo "grub-mkconfig -o /boot/grub/grub.cfg" echo "grub-mkconfig -o /boot/grub/grub.cfg"
mkdir /boot/grub mkdir /boot/grub
@ -1110,7 +1149,7 @@ archinstallgrubchroot(){
exit exit
} }
archinstallbootloader(){ archgrubinstallbootloader(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11) items=$(lsblk -d -p -n -l -o NAME -e 7,11)
options=() options=()
for item in $items; do for item in $items; do
@ -1141,34 +1180,34 @@ archinstallbootloader(){
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
clear clear
case $sel in case $sel in
"BIOS") archchroot installbootloader $device;; "BIOS") archchroot grubbootloaderinstall $device;;
"EFI") archchroot installbootloaderefi $device;; "EFI") archchroot grubbootloaderefiinstall $device;;
"BIOS+EFI") archchroot installbootloaderefiusb $device;; "BIOS+EFI") archchroot grubbootloaderefiusbinstall $device;;
esac esac
pressanykey pressanykey
fi fi
else else
clear clear
archchroot installbootloader $device archchroot grubbootloaderinstall $device
pressanykey pressanykey
fi fi
fi fi
} }
archinstallbootloaderchroot(){ archgrubinstallbootloaderchroot(){
if [ ! "$1" = "none" ]; then if [ ! "$1" = "none" ]; then
echo "grub-install --target=i386-pc --recheck $1" echo "grub-install --target=i386-pc --recheck $1"
grub-install --target=i386-pc --recheck $1 grub-install --target=i386-pc --recheck $1
fi fi
exit exit
} }
archinstallbootloaderefichroot(){ archgrubinstallbootloaderefichroot(){
if [ ! "$1" = "none" ]; then if [ ! "$1" = "none" ]; then
echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1" echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1"
grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1 grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1
fi fi
exit exit
} }
archinstallbootloaderefiusbchroot(){ archgrubinstallbootloaderefiusbchroot(){
if [ ! "$1" = "none" ]; then if [ ! "$1" = "none" ]; then
echo "grub-install --target=i386-pc --recheck $1" echo "grub-install --target=i386-pc --recheck $1"
grub-install --target=i386-pc --recheck $1 grub-install --target=i386-pc --recheck $1
@ -1178,6 +1217,9 @@ archinstallbootloaderefiusbchroot(){
exit exit
} }
archenabledhcpcd(){ archenabledhcpcd(){
if (whiptail --backtitle "$apptitle" --title "${txtenable//%1/dhcpcd}" --yesno "${txtenable//%1/dhcpcd} ?" 0 0) then if (whiptail --backtitle "$apptitle" --title "${txtenable//%1/dhcpcd}" --yesno "${txtenable//%1/dhcpcd} ?" 0 0) then
clear clear
@ -1322,7 +1364,6 @@ loadstrings(){
txtinstallmenu="Install Menu" txtinstallmenu="Install Menu"
txtarchinstallmenu="Arch Install Menu" txtarchinstallmenu="Arch Install Menu"
txtrungrubmakeconfig="Run grub-mkconfig ?"
txteditmirrorlist="Edit mirrorlist" txteditmirrorlist="Edit mirrorlist"
txtinstallarchlinux="Install Arch Linux" txtinstallarchlinux="Install Arch Linux"
@ -1336,6 +1377,15 @@ loadstrings(){
txtuseutcclock="Use UTC hardware clock ?" txtuseutcclock="Use UTC hardware clock ?"
txtbootloader="Bootloader"
txtbootloadermenu="Choose your bootloader"
txtefibootmgr="efibootmgr is required for EFI computers."
txtbootloadergrubmenu="Grub Install Menu"
txtrungrubmakeconfig="Run grub-mkconfig ?"
txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
txtoptional="Optional" txtoptional="Optional"
txtrecommandeasyinst="Recommanded for easy install" txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1" txtset="Set %1"
@ -1344,14 +1394,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."
txtinstallosprober="os-prober is a good solution if you want to use mutli-boot.\nInstall os-prober ?"
txtefibootmgr="efibootmgr is required for EFI computers."
txtarchdidesc="Full desktop install script" txtarchdidesc="Full desktop install script"
txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?" txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
txtarchdiinstallandlaunch="Install and run archdi" txtarchdiinstallandlaunch="Install and run archdi"
@ -1391,10 +1435,10 @@ if [ "$chroot" = "1" ]; then
'settimelocal') archsettimelocalchroot;; 'settimelocal') archsettimelocalchroot;;
'genmkinitcpio') archgenmkinitcpiochroot;; 'genmkinitcpio') archgenmkinitcpiochroot;;
'enabledhcpcd') archenabledhcpcdchroot;; 'enabledhcpcd') archenabledhcpcdchroot;;
'installgrub') archinstallgrubchroot;; 'grubinstall') archgrubinstallchroot;;
'installbootloader') archinstallbootloaderchroot $args;; 'grubbootloaderinstall') archgrubinstallbootloaderchroot $args;;
'installbootloaderefi') archinstallbootloaderefichroot $args;; 'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot $args;;
'installbootloaderefiusb') archinstallbootloaderefiusbchroot $args;; 'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot $args;;
'archdiinstallandlaunch') archdiinstallandlaunchchroot;; 'archdiinstallandlaunch') archdiinstallandlaunchchroot;;
'archdiinstall') archdiinstallchroot;; 'archdiinstall') archdiinstallchroot;;
'archdilaunch') archdilaunchchroot;; 'archdilaunch') archdilaunchchroot;;

View file

@ -6,10 +6,10 @@
# notes : misc text... # notes : misc text...
locale=en_US.UTF-8 locale=en_US.UTF-8
#font= #font=
txtexit="Exit" txtexit="Exit"
txtback="Back" txtback="Back"
txtignore="Ignore" txtignore="Ignore"
@ -71,6 +71,14 @@ txtsetrootpassword="Set root password"
txtuseutcclock="Use UTC hardware clock ?" txtuseutcclock="Use UTC hardware clock ?"
txtbootloader="Bootloader"
txtbootloadermenu="Choose your bootloader"
txtefibootmgr="efibootmgr is required for EFI computers."
txtbootloadergrubmenu="Grub Install Menu"
txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?"
txtoptional="Optional" txtoptional="Optional"
txtrecommandeasyinst="Recommanded for easy install" txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1" txtset="Set %1"
@ -79,16 +87,10 @@ txtedit="Edit %1"
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."
txtinstallosprober="os-prober is a good solution if you want to use mutli-boot.\nInstall os-prober ?"
txtefibootmgr="efibootmgr is required for efi computer."
txtarchdidesc="Full desktop install script" txtarchdidesc="Full desktop install script"
txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install has two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?" txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?"
txtarchdiinstallandlaunch="Install and run archdi" txtarchdiinstallandlaunch="Install and run archdi"
txtarchdiinstall="Install archdi" txtarchdiinstall="Install archdi"
txtarchdilaunch="Launch archdi" txtarchdilaunch="Launch archdi"

View file

@ -71,6 +71,14 @@ txtsetrootpassword="Définir le mot de passe root"
txtuseutcclock="Utiliser une horloge matériel UTC ?" txtuseutcclock="Utiliser une horloge matériel UTC ?"
txtbootloader="Bootloader"
txtbootloadermenu="Choisissez votre bootloader"
txtefibootmgr="efibootmgr est requis pour un système EFI."
txtbootloadergrubmenu="Menu Installation Grub"
txtgrubluksdetected="Partition root cryptée !\n\nAjouter cryptdevice= to GRUB_CMDLINE_LINUX dans /etc/default/grub ?"
txtoptional="Optionnel" txtoptional="Optionnel"
txtrecommandeasyinst="Recommandé pour installation rapide" txtrecommandeasyinst="Recommandé pour installation rapide"
txtset="Définir %1" txtset="Définir %1"
@ -79,14 +87,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."
txtinstallosprober="Pour démarrer sur plusieurs systèmes.\nInstaller os-prober ?"
txtefibootmgr="efibootmgr est requis pour un système EFI."
txtarchdidesc="Installation d'un poste de travail" txtarchdidesc="Installation d'un poste de travail"
txtinstallarchdi="Arch Linux Desktop Install (archdi) est un second script peut vous aidez à installer un poste de travail complet.\n\nVous pouvez exécuter ou installer le script en choisissant dans le menu suivant.\n\nArch Linux Desktop Install possède 2 dépendences : wget et libnewt.\n\npacstrap wget libnewt ?" txtinstallarchdi="Arch Linux Desktop Install (archdi) est un second script peut vous aidez à installer un poste de travail complet.\n\nVous pouvez exécuter ou installer le script en choisissant dans le menu suivant.\n\nArch Linux Desktop Install possède 2 dépendences : wget et libnewt.\n\npacstrap wget libnewt ?"
txtarchdiinstallandlaunch="Installer et exécuter archdi" txtarchdiinstallandlaunch="Installer et exécuter archdi"