systemd-boot: add entries menu and pacman hook
This commit is contained in:
parent
bda92c348f
commit
ea4ed5e757
2 changed files with 9 additions and 3 deletions
|
@ -2,10 +2,10 @@
|
||||||
. ./lib
|
. ./lib
|
||||||
|
|
||||||
options=()
|
options=()
|
||||||
options+=("config" "/etc/mkinitcpio.conf")
|
options+=("Config" "/etc/mkinitcpio.conf")
|
||||||
options+=("mkinicpio" "")
|
options+=("mkinicpio" "")
|
||||||
|
|
||||||
defaultitem=""
|
defaultitem="Config"
|
||||||
sel=$(whiptail --backtitle "$apptitle" --title "Initcpio Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
|
sel=$(whiptail --backtitle "$apptitle" --title "Initcpio Config Menu :" --menu "" --default-item "$defaultitem" --cancel-button "Back" 0 0 0 \
|
||||||
"${options[@]}" \
|
"${options[@]}" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
@ -15,7 +15,7 @@ fi
|
||||||
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
|
||||||
|
|
||||||
case $sel in
|
case $sel in
|
||||||
'config') editfile /etc/mkinitcpio.conf;;
|
'Config') editfile /etc/mkinitcpio.conf;;
|
||||||
'mkinicpio')
|
'mkinicpio')
|
||||||
options=()
|
options=()
|
||||||
configs=$(ls /etc/mkinitcpio.d)
|
configs=$(ls /etc/mkinitcpio.d)
|
||||||
|
|
|
@ -65,32 +65,38 @@ case $sel in
|
||||||
"${entrylist[@]}" \
|
"${entrylist[@]}" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
|
endmsg="Nothing to do !"
|
||||||
clear
|
clear
|
||||||
for itm in $sel; do
|
for itm in $sel; do
|
||||||
itm=${itm//\"/}
|
itm=${itm//\"/}
|
||||||
if [ -f /boot/amd-ucode.img ]; then
|
if [ -f /boot/amd-ucode.img ]; then
|
||||||
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
|
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
|
||||||
|
endmsg=""
|
||||||
echo "Add amd-ucode to $itm"
|
echo "Add amd-ucode to $itm"
|
||||||
sed -i "/vmlinuz/a initrd /amd-ucode.img" /boot/loader/entries/$itm.conf
|
sed -i "/vmlinuz/a initrd /amd-ucode.img" /boot/loader/entries/$itm.conf
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
|
if [ "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
|
||||||
|
endmsg=""
|
||||||
echo "Remove amd-ucode from $itm"
|
echo "Remove amd-ucode from $itm"
|
||||||
sed -i "/amd-ucode.img/d" /boot/loader/entries/$itm.conf
|
sed -i "/amd-ucode.img/d" /boot/loader/entries/$itm.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f /boot/intel-ucode.img ]; then
|
if [ -f /boot/intel-ucode.img ]; then
|
||||||
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
|
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
|
||||||
|
endmsg=""
|
||||||
echo "Add intel-ucode to $itm"
|
echo "Add intel-ucode to $itm"
|
||||||
sed -i "/vmlinuz/a initrd /intel-ucode.img" /boot/loader/entries/$itm.conf
|
sed -i "/vmlinuz/a initrd /intel-ucode.img" /boot/loader/entries/$itm.conf
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
|
if [ "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
|
||||||
|
endmsg=""
|
||||||
echo "Remove intel-ucode from $itm"
|
echo "Remove intel-ucode from $itm"
|
||||||
sed -i "/intel-ucode.img/d" /boot/loader/entries/$itm.conf
|
sed -i "/intel-ucode.img/d" /boot/loader/entries/$itm.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo "$endmsg"
|
||||||
pressanykey
|
pressanykey
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue