diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-06-27 16:41:39 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-06-27 16:41:39 -0500 |
commit | eb5cbeea0dc649d18ea4d6330c0787fc5a962b52 (patch) | |
tree | 1e18c56ee5a2f407e99095050692402bd5cb5c0f | |
parent | eba54d82f4e932ff2c3bf09fcc695085dc83bf19 (diff) |
fixes and tabs -> spaces
-rwxr-xr-x | aur | 4 | ||||
-rwxr-xr-x | fullpkg | 12 | ||||
-rwxr-xr-x | libremessages | 50 | ||||
-rwxr-xr-x | librerelease | 110 | ||||
-rwxr-xr-x | librerepkg | 2 | ||||
-rwxr-xr-x | librestage | 14 | ||||
-rw-r--r-- | libretools.conf | 3 | ||||
-rwxr-xr-x | mipsrelease | 12 | ||||
-rwxr-xr-x | prfullpkg | 12 | ||||
-rwxr-xr-x | prmipsrelease | 134 | ||||
-rwxr-xr-x | toru | 192 |
11 files changed, 272 insertions, 273 deletions
@@ -30,8 +30,8 @@ function usage { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; - *) usage; exit 1 ;; + h) usage; exit 0 ;; + *) usage; exit 1 ;; esac done @@ -59,12 +59,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/libremessages b/libremessages index c297f2d..d333f3f 100755 --- a/libremessages +++ b/libremessages @@ -28,49 +28,49 @@ export TEXTDOMAINDIR='/usr/share/locale' unset ALL_OFF BOLD BLUE GREEN RED YELLOW if tput setaf 0 &>/dev/null; then - ALL_OFF="$(tput sgr0)" - BOLD="$(tput bold)" - BLUE="${BOLD}$(tput setaf 4)" - GREEN="${BOLD}$(tput setaf 2)" - RED="${BOLD}$(tput setaf 1)" - YELLOW="${BOLD}$(tput setaf 3)" - PURPLE="${ALL_OFF}$(tput setaf 5)" + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + PURPLE="${ALL_OFF}$(tput setaf 5)" else - ALL_OFF="\033[1;0m" - BOLD="\033[1;1m" - BLUE="${BOLD}\033[1;34m" - GREEN="${BOLD}\033[1;32m" - RED="${BOLD}\033[1;31m" - YELLOW="${BOLD}\033[1;33m" - PURPLE="${BOLD}\033[1;30;40m" + ALL_OFF="\033[1;0m" + BOLD="\033[1;1m" + BLUE="${BOLD}\033[1;34m" + GREEN="${BOLD}\033[1;32m" + RED="${BOLD}\033[1;31m" + YELLOW="${BOLD}\033[1;33m" + PURPLE="${BOLD}\033[1;30;40m" fi stdnull() { - eval "$@ >/dev/null 2>&1" + eval "$@ >/dev/null 2>&1" } plain() { - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } msg() { - local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } msg2() { - local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } warning() { - local mesg=$1; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } error() { - local mesg=$1; shift - printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 } diff --git a/librerelease b/librerelease index 4e7c491..ed221c8 100755 --- a/librerelease +++ b/librerelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Librerelease # Uploads packages into [staging] @@ -21,67 +21,67 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see <http://www.gnu.org/licenses/>. -source /etc/libretools.conf -custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf + source /etc/libretools.conf + custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf -function usage { - echo "$(gettext "Usage: $0")" - echo - echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" - echo "$(gettext "to parabola server.")" - echo - echo "$(gettext "OPTIONS:")" - echo "$(gettext " -h this message.")" - echo "$(gettext " -l only list packages but not upload them.")" - echo "$(gettext " -c clean packages on $WORKDIR/staging.")" -} + function usage { + echo "$(gettext "Usage: $0")" + echo + echo "$(gettext "This script uploads packages on $WORKDIR/stagging")" + echo "$(gettext "to parabola server.")" + echo + echo "$(gettext "OPTIONS:")" + echo "$(gettext " -h this message.")" + echo "$(gettext " -l only list packages but not upload them.")" + echo "$(gettext " -c clean packages on $WORKDIR/staging.")" + } -function list_packages { - repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) - for _repo in ${repos[@]}; do - msg2 "$_repo" - find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" - done - unset repos -} + function list_packages { + repos=($(find "$WORKDIR/staging/" -mindepth 1 -type d \! -empty -printf '%f ' 2>/dev/null)) + for _repo in ${repos[@]}; do + msg2 "$_repo" + find ${WORKDIR}/staging/${_repo} -type f -printf "%f\n" + done + unset repos + } -function clean_non_packages { - find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete -} + function clean_non_packages { + find $WORKDIR/staging/ -type f \! -iname "*.pkg.tar.?z" -delete + } -function clean_packages { - find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete -} + function clean_packages { + find ${WORKDIR}/staging/ -iname "*.pkg.tar.?z" -delete + } -while getopts 'hlc' arg; do - case $arg in - h) usage; exit 0 ;; - l) list_packages; exit 0 ;; - c) clean_packages; exit $? ;; - esac -done + while getopts 'hlc' arg; do + case $arg in + h) usage; exit 0 ;; + l) list_packages; exit 0 ;; + c) clean_packages; exit $? ;; + esac + done -[[ -e $custom_config ]] && source $custom_config + [[ -e $custom_config ]] && source $custom_config -[[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" + [[ ! -z ${HOOKPRERELEASE} ]] && bash -c "${HOOKPRERELEASE}" -clean_non_packages -msg "Uploading packages..." -rsync --recursive \ - --copy-links \ - --hard-links \ - --partial \ - --prune-empty-dirs \ - --human-readable \ - --progress \ - -e "ssh " \ - ${WORKDIR}/staging \ - ${PARABOLAHOST}:${LIBREDESTDIR}/ || { - error "Sync failed, try again" - exit 1 -} + clean_non_packages + msg "Uploading packages..." + rsync --recursive \ + --copy-links \ + --hard-links \ + --partial \ + --prune-empty-dirs \ + --human-readable \ + --progress \ + -e "ssh " \ + ${WORKDIR}/staging \ + ${PARABOLAHOST}:${LIBREDESTDIR}/ || { + error "Sync failed, try again" + exit 1 + } -msg "Removing packages from local [staging]" -clean_packages + msg "Removing packages from local [staging]" + clean_packages -exit 0 + exit 0 @@ -43,7 +43,7 @@ usage() { while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done @@ -5,19 +5,19 @@ # Copyright 2010 Nicolás Reynolds # ---------- GNU General Public License 3 ---------- - + # This file is part of Parabola. - + # Parabola is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. - + # Parabola is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - + # You should have received a copy of the GNU General Public License # along with Parabola. If not, see <http://www.gnu.org/licenses/>. @@ -46,7 +46,7 @@ repos=$@ while getopts 'h' arg; do case $arg in - h) usage; exit 0 ;; + h) usage; exit 0 ;; esac done @@ -98,7 +98,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } || { ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { @@ -106,7 +106,7 @@ for _arch in ${ARCHES[@]}; do exit 1 } && { msg2 "${pkg} staged on [${_repo}]" - staged='y' + staged='y' } } done diff --git a/libretools.conf b/libretools.conf index d19e265..18284a0 100644 --- a/libretools.conf +++ b/libretools.conf @@ -46,7 +46,6 @@ HOOKLOCALRELEASE="mipsrelease" # Don't change unless you know what you're doing and you won't screw # anything ;) LIBREDESTDIR=/home/parabolavnx/parabolagnulinux.org/repo -LIBRESRCDIR=/home/parabolavnx/parabolagnulinux.org/repo/pkgbuilds ## ABSLibre ABSLIBREGIT=http://projects.parabolagnulinux.org/abslibre.git @@ -65,7 +64,7 @@ FULLBUILDCMD="sudo libremakepkg -cumL -M --noconfirm -M --nocheck" # Checks if vars aren't empty for VAR in CHROOTDIR CHROOT CHCOPY CACHEDIR PARABOLAHOST LIBREDESTDIR \ - LIBRESRCDIR BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ + BLACKLIST WORKDIR PATCHDIR REPOS ARCHES ABSLIBREGIT \ COMMITCMD DIFFTOOL FULLBUILDCMD; do [[ -z ${!VAR} ]] && { diff --git a/mipsrelease b/mipsrelease index 5228bd9..dae489c 100755 --- a/mipsrelease +++ b/mipsrelease @@ -22,12 +22,12 @@ usage() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } repo=$1; shift @@ -62,12 +62,12 @@ guess_repo() { # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi } # Usage: cleanup [ $(basename $PWD) ] from PKGBUILD dir diff --git a/prmipsrelease b/prmipsrelease index cd4d4ba..29da6e0 100755 --- a/prmipsrelease +++ b/prmipsrelease @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Lic: GPLv3+ # Author: Nicolas Reynolds <fauno@kiwwwi.com.ar> # Local release of mips64el packages + clean ABS sync @@ -7,94 +7,94 @@ # $1 repo # $2+ packages -source /etc/makepkg.conf -source /etc/libretools.conf -source /etc/libretools.d/prtools.conf + source /etc/makepkg.conf + source /etc/libretools.conf + source /etc/libretools.d/prtools.conf -usage() { - echo "$0 repo package1 [ package2 ... packageN ]" - echo - echo " release packages locally on ${PKGDEST}/stage3." - echo " and make a clean ABS sync " -} + usage() { + echo "$0 repo package1 [ package2 ... packageN ]" + echo + echo " release packages locally on ${PKGDEST}/stage3." + echo " and make a clean ABS sync " + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} - -repo=$1; shift -repo-add ${PKGDEST}/stage3.db.tar.gz $@ + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } + + repo=$1; shift + repo-add ${PKGDEST}/stage3.db.tar.gz $@ # Get all needed sources -source PKGBUILD -fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) -pkgbase=${pkgbase:-$pkgname[0]} + source PKGBUILD + fullver=$(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-$pkgname[0]} -msg "Adding packages to [stage3]..." -repo-add $@ -for name in ${pkgname[@]}; do - msg2 "${name} ${fullver}" - repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* -done + msg "Adding packages to [stage3]..." + repo-add $@ + for name in ${pkgname[@]}; do + msg2 "${name} ${fullver}" + repo-add ${PKGDEST}/stage3.db.tar.gz ${PKGDEST}/${name}-${fullver}-*.pkg.tar.* + done # Copy PKGBUILD and sources -msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" -dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" -mkdir -p ${dest_dir} >/dev/null -rm -rf ${dest_dir}/* #if package existed already there + msg "Adding clean source to $WORKDIR/abs/${CARCH}/$repo/$pkgbase" + dest_dir="$WORKDIR/abs/${CARCH}/$repo/$pkgbase" + mkdir -p ${dest_dir} >/dev/null + rm -rf ${dest_dir}/* #if package existed already there # Set target CARCH as it might be used within the PKGBUILD to select correct sources -eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") -export CARCH -source=($(. "PKGBUILD"; echo ${source[@]})) -cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" -for f in ${source[@]}; do - basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') - if [ -f "$basef" ]; then - cp --remove-destination "$basef" "${dest_dir}" - fi -done - -( . PKGBUILD - for i in 'changelog' 'install'; do - filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) - for file in $filelist; do - # evaluate any bash variables used - eval file=${file} - if [ -f "$file" ]; then - cp --remove-destination "$file" "${dest_dir}" - fi - done - done -) + eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") + export CARCH + source=($(. "PKGBUILD"; echo ${source[@]})) + cp --remove-destination "PKGBUILD" "${dest_dir}" || echo "copy 1" + for f in ${source[@]}; do + basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g') + if [ -f "$basef" ]; then + cp --remove-destination "$basef" "${dest_dir}" + fi + done + + ( . PKGBUILD + for i in 'changelog' 'install'; do + filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) + for file in $filelist; do + # evaluate any bash variables used + eval file=${file} + if [ -f "$file" ]; then + cp --remove-destination "$file" "${dest_dir}" + fi + done + done + ) # END add clean abs # Commit the changes - pushd "$dest_dir" >/dev/null + pushd "$dest_dir" >/dev/null - source "${dest_dir}/PKGBUILD" - epoch=${epoch:-0} - fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) - pkgbase=${pkgbase:-${pkgname[0]}} + source "${dest_dir}/PKGBUILD" + epoch=${epoch:-0} + fullver=$(get_full_version ${epoch} ${pkgver} ${pkgrel}) + pkgbase=${pkgbase:-${pkgname[0]}} - git add "${dest_dir}/." # add using .gitignore + git add "${dest_dir}/." # add using .gitignore - git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ - msg2 "${pkgbase} ${fullver} ${repo}" + git commit -m "${pkgbase}-${fullver} ${repo}" >/dev/null && \ + msg2 "${pkgbase} ${fullver} ${repo}" - popd >/dev/null + popd >/dev/null # END commit -exit $? + exit $? @@ -1,4 +1,4 @@ -#!/bin/bash + #!/bin/bash # Queries the ABS # License: GPL3 @@ -13,8 +13,8 @@ # * Possibility to hook up ABS dirs besides ABSROOT (low priority) # * Tell updates and non available binary packages (working on this) -source /etc/abs.conf -source /etc/libretools.conf + source /etc/abs.conf + source /etc/libretools.conf #[ ! -w / ] && { # error "This script must be run as root." @@ -23,53 +23,53 @@ source /etc/libretools.conf # Stores the lastsync date -lastsync() { - [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { - error "The sync date can't be saved. ${lastsyncfile} isn't writable." - return 1 - } + lastsync() { + [ -e ${lastsyncfile} -a ! -w ${lastsyncfile} ] && { + error "The sync date can't be saved. ${lastsyncfile} isn't writable." + return 1 + } - date +%s > ${lastsyncfile} - touch ${lastsyncfile} -} + date +%s > ${lastsyncfile} + touch ${lastsyncfile} + } ## # usage : get_full_version( $epoch, $pkgver, $pkgrel ) # return : full version spec, including epoch (if necessary), pkgver, pkgrel ## -get_full_version() { - if [[ $1 -eq 0 ]]; then - # zero epoch case, don't include it in version - echo $2-$3 - else - echo $1:$2-$3 - fi -} + get_full_version() { + if [[ $1 -eq 0 ]]; then + # zero epoch case, don't include it in version + echo $2-$3 + else + echo $1:$2-$3 + fi + } # Outputs an ordered package-fullpkgver array -print_package_array() { - echo "$@" | tr " " "\n" | sort -V -u -} + print_package_array() { + echo "$@" | tr " " "\n" | sort -V -u + } # Gets repo.db contents # $1 repo -get_db_contents() { - [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 + 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 | \ + sort -V -u + } -extract_pkgname() { - echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" -} + extract_pkgname() { + echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" + } -extract_fullpkgver() { - echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" -} + extract_fullpkgver() { + echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" + } # Updates the database by finding all PKGBUILDS @@ -78,103 +78,103 @@ extract_fullpkgver() { # * Get all packages already on package repos # * Compare them # Args: -update() { + update() { # The PKGBUILDs found - local pkgbuilds=() + local pkgbuilds=() # The list of pkgname-fullpkgver - local packages_to_sync=() - local packages_in_sync=() - local needed_updates=() - local old_versions=() + local packages_to_sync=() + local packages_in_sync=() + local needed_updates=() + local old_versions=() # Find all the PKGBUILDs newer than the last update # Update newer, otherwise everything - if [ $force ] || [ ! -e ${lastsyncfile} ]; then - $quiet || msg "Forcing upgrade" - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) - else - pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) - fi + if [ $force ] || [ ! -e ${lastsyncfile} ]; then + $quiet || msg "Forcing upgrade" + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD')) + else + pkgbuilds=($(find ${@} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) + fi # Inform how many PKGBUILDS were found and quit immediately if none - $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" - [ ${#pkgbuilds[*]} -eq 1 ] && { - $quiet || msg2 "There's nothing to be done. Phew!" - exit 0 - } + $quiet || msg "Found $((${#pkgbuilds[*]}-1)) packages to update" + [ ${#pkgbuilds[*]} -eq 1 ] && { + $quiet || msg2 "There's nothing to be done. Phew!" + exit 0 + } - for _pkgbuild in ${pkgbuilds[@]}; do + for _pkgbuild in ${pkgbuilds[@]}; do # The repo name is guessed # You *must* use repo/pkgbase structure - _pkgpath=$(dirname "${_pkgbuild}") - _pkgbase=$(basename "${_pkgpath}") - _pkgrepo=$(basename $(dirname "${_pkgpath}")) + _pkgpath=$(dirname "${_pkgbuild}") + _pkgbase=$(basename "${_pkgpath}") + _pkgrepo=$(basename $(dirname "${_pkgpath}")) - source ${_pkgbuild} + source ${_pkgbuild} - for _pkg in ${pkgname[@]}; do + for _pkg in ${pkgname[@]}; do # Fill the list of packages to find - packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) - done + packages_to_sync+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) + done - unset pkgbase pkgname pkgver pkgrel source epoch - done + unset pkgbase pkgname pkgver pkgrel source epoch + done # Get repo database contents - packages_in_sync=($(get_db_contents ${_pkgrepo})) - print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync - print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync + packages_in_sync=($(get_db_contents ${_pkgrepo})) + print_package_array "${packages_to_sync[@]}" > ${TMPDIR}/packages_to_sync + 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)) - $quiet || msg "This packages are available to update" - for _update in ${needed_updates[@]}; do - pkg=$(extract_pkgname $_update) + $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)) + $quiet && echo $pkg + $quiet || { + ver=$(extract_fullpkgver $_update) + oldver=$(extract_fullpkgver $(grep -w $pkg ${TMPDIR}/packages_in_sync)) - msg2 "$pkg $oldver => $ver" - } + msg2 "$pkg $oldver => $ver" + } - done + done # lastsync -} + } ## 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 'hqfu' arg; do + case $arg in + h) usage; exit 0 ;; + q) quiet=true ;; + f) force=true ;; + u) commands+=(update);; + esac + + shift $((OPTIND-1)) + done # This is the syncfile, stores the last date as content and mtime #lastsyncfile=${ABSROOT}/toru.lastsync -TMPDIR=$(mktemp -d) + TMPDIR=$(mktemp -d) -[[ -z ${TMPDIR} ]] && exit 1 + [[ -z ${TMPDIR} ]] && exit 1 -${commands[0]} ${@} + ${commands[0]} ${@} -rm -rf ${TMPDIR} + rm -rf ${TMPDIR} -exit $? + exit $? |