Fix: remounting

This commit is contained in:
Kolan Sh 2012-10-31 21:15:31 +04:00
parent 6a45ebe2a9
commit b74322b19e
2 changed files with 22 additions and 4 deletions

View File

@ -6,6 +6,15 @@ kernel_regex=`kernel-config list | grep \* | cut -d" " -f6 | sed 's~[0-9]*\.[0-
new_kernel=`kernel-config list | cut -d" " -f6 | grep ^$kernel_regex$ | sort -V | tail -n1`
[ "" == "$new_kernel" ] && echo "Couldn't find appropriate new kernel version ;-(" && exit -1
# remounting file systems ro->rw
for fs in $RW_REMOUNT; do
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
echo "remounting $fs -> rw"
mount -o remount,rw $fs
[ 0 -ne $? ] && echo "mount -o remount,rw $fs failed ;-( =======" && exit -1
fi
done
kernel-config set $new_kernel
[ 0 -ne $? ] && echo "kernel-config set $new_kernel failed ;-(" && exit -1
@ -20,5 +29,14 @@ if [ ! -f "$vmlinuz_file" ]; then
[ 0 -ne $? ] && echo "kernel-rebuild.sh failed" && exit -1
fi
# remounting file systems rw->ro
for fs in $RO_REMOUNT; do
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
echo "remounting $fs -> ro"
mount -o remount,ro $fs
[ 0 -ne $? ] && echo "mount -o remount,ro $fs failed ;-( =======" && exit -1
fi
done
exit 0

View File

@ -31,7 +31,7 @@ CONFIG_FILE=/proc/config.gz
# remounting file systems ro->rw
for fs in $RW_REMOUNT; do
if [[ "$fs" =~ "^/+usr/*$" || "$fs" =~ "^/+boot/*$" ]]; then
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
echo "remounting $fs -> rw"
mount -o remount,rw $fs
[ 0 -ne $? ] && echo "mount -o remount,rw $fs failed ;-( =======" && exit -1
@ -84,10 +84,10 @@ cd $pwdtmp
# remounting file systems rw->ro
for fs in $RO_REMOUNT; do
if [[ "$fs" =~ "^/+usr/*$" || "$fs" =~ "^/+boot/*$" ]]; then
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
echo "remounting $fs -> ro"
mount -o remount,ro $fs
[ 0 -ne $? ] && echo "mount -o remount,ro $fs failed ;-( =======" && exit -1
mount -f -o remount,ro $fs
[ 0 -ne $? ] && echo "mount -f -o remount,ro $fs failed ;-( =======" && exit -1
fi
done