2019-01-02 16:13:16 -07:00
|
|
|
#!/bin/bash
|
|
|
|
. ./lib
|
|
|
|
|
|
|
|
options=()
|
2019-01-03 16:17:03 -07:00
|
|
|
options+=("Config" "/etc/mkinitcpio.conf")
|
2019-01-02 16:13:16 -07:00
|
|
|
options+=("mkinicpio" "")
|
|
|
|
|
2019-01-03 16:17:03 -07:00
|
|
|
defaultitem="Config"
|
2022-11-10 14:27:23 -07:00
|
|
|
sel=$(dialog --backtitle "$apptitle" --title "Initcpio Config Menu :" --default-item "$defaultitem" --cancel-button "Back" --menu "" 0 0 0 \
|
2019-01-02 16:13:16 -07:00
|
|
|
"${options[@]}" \
|
|
|
|
3>&1 1>&2 2>&3)
|
|
|
|
if [ ! "$?" = "0" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
|
|
|
|
|
|
|
case $sel in
|
2019-01-03 16:17:03 -07:00
|
|
|
'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
|
2022-11-10 14:27:23 -07:00
|
|
|
sel=$(dialog --backtitle "$apptitle" --title "Choose configs :" --cancel-button "Back" --checklist "" 0 0 0 \
|
2019-01-02 16:13:16 -07:00
|
|
|
"${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
|