fuel-library/files/fuel-umm/umm-install.rh6
Peter Zhurba 8d138e0e0d Move umm from puppet to a package
Move umm related file from puppet to a package and change deploing process

Change-Id: I466d89158fab523981ea002e83933696284a11ac
Closes-bug:#1508274
2015-11-20 15:12:12 +00:00

31 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
[[ -f /boot/grub/grub.conf ]] && GRC=/boot/grub/grub.conf
[[ -f /etc/bashrc ]] && source /etc/bashrc
if [[ "$1" == "add" ]] ; then
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
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
else
rm -f /etc/init/rcS.override
[[ ! -z $GRC ]] && sed -e '/#UMM BEGIN/,/#UMM END/d' -i $GRC
fi
initctl reload-configuration