Add menu entry for grub

Closes-bug: #1432515

Change-Id: Ibdab2b1719761757c8adc91873628b49fcf64d69
This commit is contained in:
Peter Zhurba 2015-03-15 21:09:37 +02:00 committed by Bogdan Dobrelya
parent 553cb0cffa
commit c6fbc06834
2 changed files with 30 additions and 1 deletions

View File

@ -2,4 +2,25 @@
sed -e '/post-stop script/,/end script/!d' \
-e '/post-stop script/a\ \ \ \ \ [ -f /usr/lib/umm/umm_svc ] && /usr/lib/umm/umm_svc' \
/etc/init/rcS.conf >/etc/init/rcS.override
/etc/init/rcS.conf >/etc/init/rcS.override
[ -f /boot/grub/grub.conf ] && GRC=/boot/grub/grub.conf
if [ ! -z "$GRC" ]; then
sed -e '/#UMM BEGIN/,/#UMM END/d' -i $GRC
eval $(sed -n -e '/default=/ p' $GRC)
ST='-e 1,/^title/d'
until [ "$default" == "0" ] ; do
ST="$ST -e 1,/^title/d"
default=$(($default - 1))
done;
echo "#UMM BEGIN" >/tmp/mm-gr
echo "title Unified Mintenance mode (UMM)" >>/tmp/mm-gr
sed $ST -e 's/\(^\s*kernel .*\)/\1 umm/' -e '/^title/,$ d' $GRC>>/tmp/mm-gr
echo "#UMM END" >>/tmp/mm-gr
cat /tmp/mm-gr >>$GRC
rm /tmp/mm-gr
fi

View File

@ -24,3 +24,11 @@ script
initctl emit umm
end script
EOF
cat >/etc/grub.d/55_umm << "EOF"
if [ -f /etc/grub.d/10_linux ] ; then
/etc/grub.d/10_linux | sed -n -e '/menuentry.*{/,/}/p' | sed -e "s/menuentry\s*'[^']*' /menuentry 'Unified maintenance mode (UMM) '/" -e 's/\(^\s*linux\s.*\)/\1 umm/' -e '/}/,$d'; echo '}'
fi
EOF
update-grub