diff --git a/etc/gentoo-upgrade.conf b/etc/gentoo-upgrade.conf index 30bf5a3..34bcfc9 100644 --- a/etc/gentoo-upgrade.conf +++ b/etc/gentoo-upgrade.conf @@ -1,2 +1,4 @@ EGENCACHE=FALSE ECLEAN_DISTFILES=FALSE +RW_REMOUNT='/usr' +RO_REMOUNT='/usr' diff --git a/sbin/gentoo-upgrade.sh b/sbin/gentoo-upgrade.sh index 42c4975..4c32723 100755 --- a/sbin/gentoo-upgrade.sh +++ b/sbin/gentoo-upgrade.sh @@ -1,6 +1,6 @@ #!/bin/bash -STAGE=1 +STAGE=0 source /etc/make.conf [ -f /etc/gentoo-upgrade.conf ] && source /etc/gentoo-upgrade.conf @@ -44,6 +44,17 @@ function in_list() TRUE_LIST=(TRUE True true YES Yes yes 1) FALSE_LIST=(FALSE False false NO No no 0) +# Stage 0: remounting file systems ro->rw +if [ 0 -eq $STAGE ]; then + echo "======= STAGE $STAGE: remounting file systems ro->rw =======" + for fs in $RW_REMOUNT; do + mount -o remount,rw $fs + [ 0 -ne $? ] && echo "Stage $STAGE: mount -o remount,rw $fs failed ;-( =======" && exit $STAGE + done + + let STAGE++ +fi + # Stage 1: sync portage tree if [ 1 -eq $STAGE ]; then echo "======= STAGE $STAGE: sync portage tree =======" @@ -419,4 +430,15 @@ if [ 19 -eq $STAGE ]; then let STAGE++ fi +# Stage 20: remounting file systems rw->ro +if [ 20 -eq $STAGE ]; then + echo "======= STAGE $STAGE: remounting file systems rw->ro =======" + for fs in $RO_REMOUNT; do + mount -o remount,ro $fs + [ 0 -ne $? ] && echo "Stage $STAGE: mount -o remount,ro $fs failed ;-( =======" && exit $STAGE + done + + let STAGE++ +fi + exit 0