Add boot config menu

This commit is contained in:
MatMoul 2019-01-03 00:13:16 +01:00
parent 08412e0674
commit 9746f26135
3 changed files with 96 additions and 0 deletions

27
config/boot/grub/menu Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
. ./lib
options=()
options+=("config" "/etc/default/grub")
options+=("grub-mkconfig" "")
defaultitem=""
sel=$(whiptail --backtitle "$apptitle" --title "Grub Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
'config') editfile /etc/default/grub;;
'grub-mkconfig')
clear
echo "grub-mkconfig -o /boot/grub/grub.cfg"
grub-mkconfig -o /boot/grub/grub.cfg
pressanykey
;;
esac
exit 0

45
config/boot/initcpio/menu Normal file
View file

@ -0,0 +1,45 @@
#!/bin/bash
. ./lib
options=()
options+=("config" "/etc/mkinitcpio.conf")
options+=("mkinicpio" "")
defaultitem=""
sel=$(whiptail --backtitle "$apptitle" --title "Initcpio Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
'config') editfile /etc/mkinitcpio.conf;;
'mkinicpio')
options=()
configs=$(ls /etc/mkinitcpio.d)
for itm in $configs; do
options+=("${itm::-7}" "" on)
done
sel=$(whiptail --backtitle "$apptitle" --title "Choose configs :" --checklist "" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
clear
for itm in $sel; do
case $itm in
*)
itm=$(sed "s/\"//g" <<<"$itm")
echo "mkinitcpio -p $itm"
mkinitcpio -p $itm
;;
esac
done
pressanykey
;;
esac
exit 0

24
config/boot/menu Normal file
View file

@ -0,0 +1,24 @@
#!/bin/bash
. ./lib
options=()
options+=("initcpio" "")
if [ -f /boot/grub/grub.cfg ]; then
options+=("grub" "")
fi
defaultitem=""
sel=$(whiptail --backtitle "$apptitle" --title "Boot Configuration :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
"${options[@]}" \
3>&1 1>&2 2>&3)
if [ ! "$?" = "0" ]; then
exit 1
fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
'initcpio') menu config/boot/initcpio/menu;;
'grub') menu config/boot/grub/menu;;
esac
exit 0