systemd-boot: add entries menu and pacman hook

This commit is contained in:
MatMoul 2019-01-04 00:17:03 +01:00
parent bda92c348f
commit ea4ed5e757
2 changed files with 9 additions and 3 deletions

View file

@ -2,10 +2,10 @@
. ./lib
options=()
options+=("config" "/etc/mkinitcpio.conf")
options+=("Config" "/etc/mkinitcpio.conf")
options+=("mkinicpio" "")
defaultitem=""
defaultitem="Config"
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)
@ -15,7 +15,7 @@ fi
sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0
case $sel in
'config') editfile /etc/mkinitcpio.conf;;
'Config') editfile /etc/mkinitcpio.conf;;
'mkinicpio')
options=()
configs=$(ls /etc/mkinitcpio.d)

View file

@ -65,32 +65,38 @@ case $sel in
"${entrylist[@]}" \
3>&1 1>&2 2>&3)
if [ "$?" = "0" ]; then
endmsg="Nothing to do !"
clear
for itm in $sel; do
itm=${itm//\"/}
if [ -f /boot/amd-ucode.img ]; then
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
endmsg=""
echo "Add amd-ucode to $itm"
sed -i "/vmlinuz/a initrd /amd-ucode.img" /boot/loader/entries/$itm.conf
fi
else
if [ "$(cat /boot/loader/entries/$itm.conf | grep amd-ucode.img)" ]; then
endmsg=""
echo "Remove amd-ucode from $itm"
sed -i "/amd-ucode.img/d" /boot/loader/entries/$itm.conf
fi
fi
if [ -f /boot/intel-ucode.img ]; then
if [ ! "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
endmsg=""
echo "Add intel-ucode to $itm"
sed -i "/vmlinuz/a initrd /intel-ucode.img" /boot/loader/entries/$itm.conf
fi
else
if [ "$(cat /boot/loader/entries/$itm.conf | grep intel-ucode.img)" ]; then
endmsg=""
echo "Remove intel-ucode from $itm"
sed -i "/intel-ucode.img/d" /boot/loader/entries/$itm.conf
fi
fi
done
echo "$endmsg"
pressanykey
fi
;;