obosdi-pkg/config/boot/initcpio/menu

46 lines
1 KiB
Text
Raw Normal View History

2019-01-02 16:13:16 -07:00
#!/bin/bash
. ./lib
options=()
options+=("Config" "/etc/mkinitcpio.conf")
2019-01-02 16:13:16 -07:00
options+=("mkinicpio" "")
defaultitem="Config"
2019-01-02 16:13:16 -07:00
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;;
2019-01-02 16:13:16 -07:00
'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