index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | scripts/repo-add.sh.in | 37 |
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 32e3a301..b4ae7d35 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -34,7 +34,6 @@ REPO_DB_FILE="" umask 0022 msg() { - [ $QUIET -ne 0 ] && return local mesg=$1; shift printf "==> ${mesg}\n" "$@" >&1 } @@ -68,8 +67,8 @@ repo-remove will update a package database by removing the package name\n\ specified on the command line from the given repo database. Multiple\n\ packages to remove can be specified on the command line.\n\n")" printf "$(gettext "\ -The -q/--quiet flag to either program will force silent running except\n\ -in the case of warnings or errors.\n\n")" +Use the -q/--quiet flag to minimize output to basic messages, warnings,\n\ +and errors\n\n")" echo "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0.pkg.tar.gz")" echo "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26")" } @@ -83,15 +82,6 @@ This is free software; see the source for copying conditions.\n\ There is NO WARRANTY, to the extent permitted by law.\n")" } -# test if a file is a repository DB -test_repo_db_file () { - if bsdtar -tf "$REPO_DB_FILE" | grep -q "/desc"; then - return 0 # YES - else - return 1 # NO - fi -} - # write a list entry # arg1 - Entry name # arg2 - List @@ -308,18 +298,6 @@ else exit 1 # $E_MISSING_PROGRAM fi -# source system and user makepkg.conf -if [ -r "$confdir/makepkg.conf" ]; then - source "$confdir/makepkg.conf" -else - error "$(gettext "%s not found. Cannot continue.")" "$confdir/makepkg.conf" - exit 1 # $E_CONFIG_ERROR -fi - -if [ -r ~/.makepkg.conf ]; then - source ~/.makepkg.conf -fi - # main routine gstmpdir=$(mktemp -d /tmp/repo-tools.XXXXXXXXXX) || (\ error "$(gettext "Cannot create temp directory for database building.")"; \ @@ -344,7 +322,7 @@ for arg in "$@"; do # store absolute path to repo DB REPO_DB_FILE=$($realpath "$arg") if [ -f "$REPO_DB_FILE" ]; then - if ! test_repo_db_file $cmd; then + if ! (bsdtar -tf "$REPO_DB_FILE" | grep -q "/desc"); then error "$(gettext "Repository file '%s' is not a proper pacman database.")" "$REPO_DB_FILE" exit 1 fi @@ -390,10 +368,11 @@ if [ $success -eq 1 ]; then [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" [ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old" - case "$DB_COMPRESSION" in - gz) TAR_OPT="z" ;; - bz2) TAR_OPT="j" ;; - *) warning "$(gettext "No compression set.")" ;; + case "$REPO_DB_FILE" in + *tar.gz) TAR_OPT="z" ;; + *tar.bz2) TAR_OPT="j" ;; + *) warning "$(gettext "'%s' does not have a valid archive extension.")" \ + "$REPO_DB_FILE" ;; esac bsdtar -c${TAR_OPT}f "$REPO_DB_FILE" * |