Files
StateGrid/other_shell/chkernel
Qin Bo 2235771f09 Initial commit
Signed-off-by: Qin Bo <bqin@linx-info.com>
2014-02-19 09:07:55 +08:00

16 lines
487 B
Bash

#!/bin/bash
Boot_CONFIG=/boot/grub/grub.conf
ROOT=$(cat /boot/grub/grub.conf |grep -v ^# |grep title | nl -b a -v 0 | grep -w with | awk '{print $1}')
NOROOT=$(cat /boot/grub/grub.conf |grep -v ^# | grep title | nl -b a -v 0 | grep -w without | awk '{print $1}')
if [ "$1" = "root" ];then
sed -i "/default/s@[0-9]@${ROOT}@" $Boot_CONFIG
elif [ "$1" = "noroot" ];then
sed -i "/default/s@[0-9]@${NOROOT}@" $Boot_CONFIG
else
echo "Usage:[root | noroot]"
exit 1
fi