45 lines
1 KiB
Bash
45 lines
1 KiB
Bash
#!/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
|