X-Git-Url: http://popeye.lapinbilly.eu/git/?p=fbsd-stable-mgmt.git;a=blobdiff_plain;f=update_stage0.sh;h=76f3a61c0989deecacb5d0611365b64ddb46d052;hp=2a299b585a93910c75248a2fa02bfc549202a223;hb=HEAD;hpb=a334edfe5246e8c012e02fac0db3b8b0e0ecfa23 diff --git a/update_stage0.sh b/update_stage0.sh index 2a299b5..76f3a61 100755 --- a/update_stage0.sh +++ b/update_stage0.sh @@ -2,6 +2,7 @@ usage() { echo 'Usage: ...' + echo '-c clean obj' echo '-u svn update' echo '-j jobs to be handled' echo 'default to ' ${jarg} @@ -11,19 +12,22 @@ usage() { parse() { RED='\033[0;31m' NC='\033[0m' # No Color - while getopts "uj:" option + while getopts "cnj:" option do case ${option} in - u) - update="1" + c) + CLEANING=1 + ;; + 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 ;; @@ -33,22 +37,24 @@ parse() { jarg=`sysctl -n hw.ncpu` +usrsrc=${USRSRC:-/usr/src} +parse ${*} -if [ $? -ne 0 ] -then - usage -else - parse ${*} +if [ ${UPDATE:=-0} -eq 0 ]; then + echo "updating ..." + git -C ${usrsrc} pull --rebase + [ ${?} == 1 ] && exit 1 fi -[ ${update} ] && svn update /usr/src -echo Cleaning -chflags -R noschg /usr/obj/* && rm -rf /usr/obj +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 -cd /usr/src && \ -make -j${jarg} buildworld && make -j${jarg} kernel KERNCONF=PEPINS && \ -echo "Reboot the system." +make -j${jarg} -C ${usrsrc} buildworld && make -j${jarg} -C ${usrsrc} kernel \ + && echo "Reboot the system."