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/mkinitcpio.conf}" "($txtoptional)")
options+=("${txtedit//%1/mirrorlist}" "($txtoptional)")
options+=("${txtinstall//%1/grub}" "pacstrap grub (efibootmgr), grub-mkconfig")
options+=("${txtedit//%1/grub}" "($txtoptional)")
options+=("${txtinstall//%1/bootloader}" "grub-install")
options+=("$txtbootloader" "")
options+=("${txtenable//%1/dhcpcd}" "systemctl enable dhcpd")
options+=("archdi" "$txtarchdidesc")
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
nextitem="${txtgenerate//%1/mkinitcpio.conf}"
else
nextitem="${txtinstall//%1/grub}"
nextitem="$txtbootloader"
fi
fi
;;
@ -823,12 +821,12 @@ archmenu(){
if [ "$luksroot" = "1" ]; then
nextitem="${txtgenerate//%1/mkinitcpio.conf}"
else
nextitem="${txtinstall//%1/grub}"
nextitem="$txtbootloader"
fi
;;
"${txtgenerate//%1/mkinitcpio.conf}")
archgenmkinitcpio
nextitem="${txtinstall//%1/grub}"
nextitem="$txtbootloader"
;;
"${txtedit//%1/fstab}")
$EDITOR /mnt/etc/fstab
@ -846,21 +844,8 @@ archmenu(){
$EDITOR /mnt/etc/pacman.d/mirrorlist
nextitem="${txtedit//%1/mirrorlist}"
;;
"${txtinstall//%1/grub}")
archinstallgrub
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
"$txtbootloader")
archbootloadermenu
nextitem="${txtenable//%1/dhcpcd}"
;;
"${txtenable//%1/dhcpcd}")
@ -1065,7 +1050,61 @@ archgenmkinitcpiochroot(){
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
echo "pacstrap /mnt grub"
pacstrap /mnt grub
@ -1099,10 +1138,10 @@ archinstallgrub(){
fi
clear
archchroot installgrub
archchroot grubinstall
pressanykey
}
archinstallgrubchroot(){
archgrubinstallchroot(){
echo "mkdir /boot/grub"
echo "grub-mkconfig -o /boot/grub/grub.cfg"
mkdir /boot/grub
@ -1110,7 +1149,7 @@ archinstallgrubchroot(){
exit
}
archinstallbootloader(){
archgrubinstallbootloader(){
items=$(lsblk -d -p -n -l -o NAME -e 7,11)
options=()
for item in $items; do
@ -1141,34 +1180,34 @@ archinstallbootloader(){
if [ "$?" = "0" ]; then
clear
case $sel in
"BIOS") archchroot installbootloader $device;;
"EFI") archchroot installbootloaderefi $device;;
"BIOS+EFI") archchroot installbootloaderefiusb $device;;
"BIOS") archchroot grubbootloaderinstall $device;;
"EFI") archchroot grubbootloaderefiinstall $device;;
"BIOS+EFI") archchroot grubbootloaderefiusbinstall $device;;
esac
pressanykey
fi
else
clear
archchroot installbootloader $device
archchroot grubbootloaderinstall $device
pressanykey
fi
fi
}
archinstallbootloaderchroot(){
archgrubinstallbootloaderchroot(){
if [ ! "$1" = "none" ]; then
echo "grub-install --target=i386-pc --recheck $1"
grub-install --target=i386-pc --recheck $1
fi
exit
}
archinstallbootloaderefichroot(){
archgrubinstallbootloaderefichroot(){
if [ ! "$1" = "none" ]; then
echo "grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1"
grub-install --target=x86_64-efi --efi-directory=/boot --recheck $1
fi
exit
}
archinstallbootloaderefiusbchroot(){
archgrubinstallbootloaderefiusbchroot(){
if [ ! "$1" = "none" ]; then
echo "grub-install --target=i386-pc --recheck $1"
grub-install --target=i386-pc --recheck $1
@ -1178,6 +1217,9 @@ archinstallbootloaderefiusbchroot(){
exit
}
archenabledhcpcd(){
if (whiptail --backtitle "$apptitle" --title "${txtenable//%1/dhcpcd}" --yesno "${txtenable//%1/dhcpcd} ?" 0 0) then
clear
@ -1322,7 +1364,6 @@ loadstrings(){
txtinstallmenu="Install Menu"
txtarchinstallmenu="Arch Install Menu"
txtrungrubmakeconfig="Run grub-mkconfig ?"
txteditmirrorlist="Edit mirrorlist"
txtinstallarchlinux="Install Arch Linux"
@ -1336,6 +1377,15 @@ loadstrings(){
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"
txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1"
@ -1344,14 +1394,8 @@ loadstrings(){
txtinstall="Install %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."
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"
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"
@ -1391,10 +1435,10 @@ if [ "$chroot" = "1" ]; then
'settimelocal') archsettimelocalchroot;;
'genmkinitcpio') archgenmkinitcpiochroot;;
'enabledhcpcd') archenabledhcpcdchroot;;
'installgrub') archinstallgrubchroot;;
'installbootloader') archinstallbootloaderchroot $args;;
'installbootloaderefi') archinstallbootloaderefichroot $args;;
'installbootloaderefiusb') archinstallbootloaderefiusbchroot $args;;
'grubinstall') archgrubinstallchroot;;
'grubbootloaderinstall') archgrubinstallbootloaderchroot $args;;
'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot $args;;
'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot $args;;
'archdiinstallandlaunch') archdiinstallandlaunchchroot;;
'archdiinstall') archdiinstallchroot;;
'archdilaunch') archdilaunchchroot;;

View file

@ -6,10 +6,10 @@
# notes : misc text...
locale=en_US.UTF-8
#font=
txtexit="Exit"
txtback="Back"
txtignore="Ignore"
@ -71,6 +71,14 @@ txtsetrootpassword="Set root password"
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"
txtrecommandeasyinst="Recommanded for easy install"
txtset="Set %1"
@ -79,16 +87,10 @@ txtedit="Edit %1"
txtinstall="Install %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."
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"
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"
txtarchdiinstall="Install 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 ?"
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"
txtrecommandeasyinst="Recommandé pour installation rapide"
txtset="Définir %1"
@ -79,14 +87,8 @@ txtedit="Editer %1"
txtinstall="Installer %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."
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"
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"