take a snapshot before upgrading
[fbsd-stable-mgmt.git] / update_stage0.sh
index 31edbce9a77de1551d279bd30b630334ee1c3a33..76f3a61c0989deecacb5d0611365b64ddb46d052 100755 (executable)
@@ -12,22 +12,22 @@ usage() {
 parse() {
        RED='\033[0;31m'
        NC='\033[0m' # No Color
-       while getopts "cuj:" option 
+       while getopts "cnj:" option
        do
                case ${option} in
                        c)
                                CLEANING=1
                                ;;
-                       u)
+                       n)
                                UPDATE=1
                                ;;
                        j)
-                               case ${OPTARG} in 
-                               (*[!0-9]*|'') 
+                               case ${OPTARG} in
+                               (*[!0-9]*|'')
                                        echo -e "${RED}number expected for jobs${NC}; default value used."
                                        ;;
-                               (*) 
-                                       jarg=${OPTARG} 
+                               (*)
+                                       jarg=${OPTARG}
                                        ;;
                                esac
                                ;;
@@ -37,30 +37,24 @@ parse() {
 
 
 jarg=`sysctl -n hw.ncpu`
-
-
 usrsrc=${USRSRC:-/usr/src}
 
-if [ $? -ne 0 ] 
-then 
-       usage 
-else
-       parse ${*} 
-fi
+parse ${*}
 
-if [ ${UPDATE:=-0} -eq 1 ]; then 
-       echo "updating ..." 
-       svnlite update ${usrsrc}
+if [ ${UPDATE:=-0} -eq 0 ]; then
+       echo "updating ..."
+       git -C ${usrsrc} pull --rebase
        [ ${?} == 1 ] && exit 1
 fi
 
 
-if [ ${CLEANING:=-0} -eq 1 ]; then 
+if [ ${CLEANING:=-0} -eq 1 ]; then
        echo Cleaning
        chflags -R noschg /usr/obj/* && sync && rm -rf /usr/obj && sync
 fi
 
 echo building process on ${jarg} jobs
-make -C ${usrsrc} -j${jarg} buildworld && make -C ${usrsrc} -j${jarg} kernel KERNCONF=PEPINS \
+make -j${jarg} -C ${usrsrc} buildworld && make -j${jarg} -C ${usrsrc} kernel \
        && echo "Reboot the system."
 
+