]> git.wh0rd.org Git - home.git/commitdiff
gentoo-sync: add an option for syncing, and do world update based on slot
authorMike Frysinger <vapier@gentoo.org>
Fri, 10 Jan 2014 16:52:14 +0000 (11:52 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 10 Jan 2014 16:52:14 +0000 (11:52 -0500)
.bin/gentoo-sync

index cbe144a79c2e92a8ce77943d3972f2c689c6126e..347713d2f952d52f028b705b2185e5e5e10baba3 100755 (executable)
@@ -6,6 +6,7 @@ logdir="/var/log"
 sync_log="${logdir}/rsync.log"
 up_log="${logdir}/emerge-updates.log"
 
+GS_SYNC=true
 GS_RSYNC=false
 GS_EUPDATEDB=true
 GS_FETCH=false
@@ -34,14 +35,17 @@ if ${GS_RSYNC} ; then
        exec rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} ${SYNC}/ ${PORTDIR}/ >& "${sync_log}"
 fi
 
-emerge --sync -q
-date
-${GS_EUPDATEDB} && $(type -P eupdatedb)
-date
-${GS_LAYMAN} && l=$(type -P layman) && ${l} -S -q
-date
-${GS_FETCH} && emerge world -Duf
-#q -qr
+if ${GS_SYNC} ; then
+       emerge --sync -q
+       date
+       ${GS_EUPDATEDB} && $(type -P eupdatedb)
+       date
+       ${GS_LAYMAN} && l=$(type -P layman) && ${l} -S -q
+       date
+       ${GS_FETCH} && emerge world -Duf
+       #q -qr
+fi
+
 date
 ) >& ${sync_log}
 
@@ -49,8 +53,21 @@ if ${GS_UPWORLD} ; then
        (
        eval $(portageq envvar -v PORTDIR)
        cd "${PORTDIR}"
-       good_pkgs=$(ls -d `qlist -IC`)
+       bad_pkgs=()
+       good_pkgs=()
+       for p in `qlist -ICS` ; do
+               if [[ -d ${p%:*} ]] ; then
+                       good_pkgs+=( ${p} )
+               else
+                       bad_pkgs+=( ${p} )
+               fi
+       done
+       if [[ ${#bad_pkgs[@]} -gt 0 ]] ; then
+               echo 'These packages no longer exist:'
+               printf '\t%s\n' "${bad_pkgs[@]}"
+               echo
+       fi
        echo 'emerge -u1 --keep-going $(awk '\''$2 ~ /\// {print $2}'\'' '${up_log}')'
-       emerge ${good_pkgs} -upq --cols
+       emerge ${good_pkgs[*]} -upq --cols
        ) >& ${up_log}
 fi