diff options
-rwxr-xr-x | toru | 70 |
1 files changed, 39 insertions, 31 deletions
@@ -46,24 +46,24 @@ } -# Gets repo.db contents +# Gets repo.db contents (unordered) # $1 repo get_db_contents() { [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 - bsdtar -tf /var/lib/pacman/sync/$1.db | \ - cut -d'/' -f1 | \ - sort -V -u - } + bsdtar -tf /var/lib/pacman/sync/$1.db | cut -d'/' -f1 +} - extract_pkgname() { - echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" - } +# Get the pkgname +extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" +} - extract_fullpkgver() { - echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" - } +# Get the fullpkgver +extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" +} # Updates the database by finding all PKGBUILDS @@ -121,17 +121,19 @@ print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync # We've orderer the files! - needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) - old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + missing_packages=($(comm --nocheck-order -12 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) $quiet || msg "This packages are available to update" for _update in ${needed_updates[@]}; do pkg=$(extract_pkgname $_update) - $quiet && echo $pkg - $quiet || { - ver=$(extract_fullpkgver $_update) - oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) +# Only print pkgnames when in quiet mode (useful for scripts) + $quiet && echo $pkg + $quiet || { + ver=$(extract_fullpkgver $_update) + oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) msg2 "$pkg $oldver => $ver" } @@ -142,23 +144,29 @@ } +# Find all the packages that are missing from the repo dbs (aka not built) +missing() { + true +} + ## MAIN - commands=() - repos=() - quiet=false - force=false - while getopts 'hqfu' arg; do - case $arg in - h) usage; exit 0 ;; - q) quiet=true ;; - f) force=true ;; - u) commands+=(update);; - esac - - shift $((OPTIND-1)) - done +commands=() +repos=() +quiet=false +force=false +while getopts 'hqfum' arg; do + case $arg in + h) usage; exit 0 ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + m) commands+=(missing);; + esac + + shift $((OPTIND-1)) +done # This is the syncfile, stores the last date as content and mtime #lastsyncfile=${ABSROOT}/toru.lastsync |