diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/abslibre-tools/librestage | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index e84c486..528a0be 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -28,15 +28,15 @@ load_files libretools check_vars libretools ARCHES WORKDIR || exit 1 if [ -w / ]; then - error "This script should be run as regular user" - exit 1 + error "This script should be run as regular user" + exit 1 fi # End Config usage() { - cat <<EOU + cat <<EOU LibreStage Copyright (C) 2011 Nicolás Reynolds This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it @@ -53,19 +53,19 @@ EOU repos=$@ while getopts 'h' arg; do - case $arg in - h) usage; exit 0 ;; - esac + case $arg in + h) usage; exit 0 ;; + esac done if [ ${#repos} -eq 0 ]; then - usage - exit 1; + usage + exit 1; fi [[ ! -e ./PKGBUILD ]] && { - error "PKGBUILD not found" - exit 1 + error "PKGBUILD not found" + exit 1 } # Source the needed files @@ -82,56 +82,56 @@ PKGEXT=".pkg.tar.?z" staged=false # Copies the packages to the specified repos inside staging for _arch in "${ARCHES[@]}"; do - for pkg in "${pkgname[@]}"; do - - pkgpath=$(find ${PKGDEST}/ -type f \ - -name "${pkg}-$(get_full_version "${pkg}")-${_arch}${PKGEXT}") - - [[ -z ${pkgpath} ]] && continue - - pkgfile=$(basename ${pkgpath}) - -# TODO refactor this - if [ -e "${pkgpath}" ]; then - msg "Found ${pkgfile}" - - canonical="" - for _repo in ${repos[@]}; do - - if [ ! -d "${WORKDIR}/staging/${_repo}" ]; then - warning "[${_repo}] didn't exist, creating..." - mkdir -p "${WORKDIR}/staging/${_repo}" - fi - - if [ -z "$canonical" ]; then - canonical="${WORKDIR}/staging/${_repo}/${pkgfile}" - - cp "${pkgpath}" "${WORKDIR}/staging/${_repo}/" || { - error "Can't put ${pkgfile} on [staging]" - exit 1 - } && { - msg2 "${pkg} staged on [${_repo}]" - staged=true - } - - else - ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { - error "Can't put ${pkgfile} on [staging]" - exit 1 - } && { - msg2 "${pkg} staged on [${_repo}]" - staged=true - } - - fi - done - fi - done + for pkg in "${pkgname[@]}"; do + + pkgpath=$(find ${PKGDEST}/ -type f \ + -name "${pkg}-$(get_full_version "${pkg}")-${_arch}${PKGEXT}") + + [[ -z ${pkgpath} ]] && continue + + pkgfile=$(basename ${pkgpath}) + + # TODO refactor this + if [ -e "${pkgpath}" ]; then + msg "Found ${pkgfile}" + + canonical="" + for _repo in ${repos[@]}; do + + if [ ! -d "${WORKDIR}/staging/${_repo}" ]; then + warning "[${_repo}] didn't exist, creating..." + mkdir -p "${WORKDIR}/staging/${_repo}" + fi + + if [ -z "$canonical" ]; then + canonical="${WORKDIR}/staging/${_repo}/${pkgfile}" + + cp "${pkgpath}" "${WORKDIR}/staging/${_repo}/" || { + error "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + msg2 "${pkg} staged on [${_repo}]" + staged=true + } + + else + ln "${canonical}" "${WORKDIR}/staging/${_repo}/${pkgfile}" || { + error "Can't put ${pkgfile} on [staging]" + exit 1 + } && { + msg2 "${pkg} staged on [${_repo}]" + staged=true + } + + fi + done + fi + done done if ! $staged ; then - error "No package was staged" - exit 1 + error "No package was staged" + exit 1 fi exit 0 |