diff options
author | Giovanni Scafora <linuxmania@gmail.com> | 2007-06-04 07:21:14 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-06-04 22:54:25 +0200 |
commit | ecb594107edf66f190b19e78cf71378ddbe347fc (patch) | |
tree | f51240f38b8de0ba498e27a7cb1d6ce94a95005b | |
parent | d0679da4f32158b3091bd2862c4b9ce7efc5db29 (diff) | |
download | pacman-ecb594107edf66f190b19e78cf71378ddbe347fc.tar.gz pacman-ecb594107edf66f190b19e78cf71378ddbe347fc.tar.xz |
Add gettext/i18n to most of the currently-used scripts
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | scripts/abs.in | 26 | ||||
-rw-r--r-- | scripts/gensync.in | 46 | ||||
-rw-r--r-- | scripts/makepkg.in | 2 | ||||
-rw-r--r-- | scripts/pacman-optimize.in | 75 | ||||
-rw-r--r-- | scripts/repo-add.in | 52 | ||||
-rw-r--r-- | scripts/repo-remove.in | 40 | ||||
-rw-r--r-- | scripts/updatesync.in | 42 |
7 files changed, 151 insertions, 132 deletions
diff --git a/scripts/abs.in b/scripts/abs.in index 42ad56af..5daa65c8 100644 --- a/scripts/abs.in +++ b/scripts/abs.in @@ -21,6 +21,10 @@ # USA. # +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' CONFDIR="@sysconfdir@/abs" CONNMODE="m" @@ -31,14 +35,16 @@ CONNMODE="m" [ -f ~/.abs.conf ] && source ~/.abs.conf usage() { - echo "Arch Build System -- synchronization utility" - echo "usage: $0 [-p] [repository1 [repository2 ...]]" + printf "abs (pacman) %s\n" "$myver" + echo + printf "$(gettext "Usage: %s [-p] [repository1 [repository2 ...]]")\n" "$0" + echo + printf "$(gettext "abs will synchronize PKGBUILD scripts from the CVS repository")\n" + printf "$(gettext "into %s. You can follow different package trees by")\n" "$ABSROOT" + printf "$(gettext "editing %s files. If no argument is given, abs")\n" "$CONFDIR/supfile.*" + printf "$(gettext "will synchronize from supfiles specified in %s.")\n" "$CONFDIR/abs.conf" + printf "$(gettext "If -p is specified, the connection is opened in passive mode.")\n" echo - echo "abs will synchronize PKGBUILD scripts from the CVS repository" - echo "into $ABSROOT. You can follow different package trees by" - echo "editing @SYSCONFDIR@/abs/supfile.* files. If no argument is given, abs " - echo "will synchronize from supfiles specified in @SYSCONFDIR@/abs/abs.conf." - echo "If -p is specified, the connection is opened in passive mode." } version() { @@ -79,11 +85,11 @@ if [ "$1" = "-V" -o "$1" = "--version" ]; then fi if [ ! -d "$ABSROOT" ]; then - echo "abs: $ABSROOT does not exist (or is not a directory)" + echo "$(gettext "abs: %s does not exist (or is not a directory).")" "$ABSROOT" exit 1 fi if [ ! -w "$ABSROOT" ]; then - echo "abs: no write permissions in $ABSROOT" + echo "$(gettext "abs: no write permissions in %s.")" "$ABSROOT" exit 1 fi @@ -92,7 +98,7 @@ if [ "$(type -p cvsup)" ]; then elif [ "$(type -p csup)" ]; then CVSUP="csup" else - echo "abs: missing CVS synchronization utility. Install cvsup or csup." + echo "$(gettext "abs: missing CVS synchronization utility. Install cvsup or csup.")" exit 1 fi diff --git a/scripts/gensync.in b/scripts/gensync.in index 977dff06..ca83c17b 100644 --- a/scripts/gensync.in +++ b/scripts/gensync.in @@ -21,29 +21,33 @@ # USA. # +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' # functions usage() { - echo "gensync $myver" - echo "usage: $0 <root> <destfile> [package_directory]" + printf "gensync (pacman) %s\n" "$myver" echo - echo "gensync will generate a sync database by reading all PKGBUILD files" - echo "from <root>. gensync builds the database in a temporary directory" - echo "and then compresses it to <destfile>." + printf "$(gettext "Usage: %s <root> <destfile> [package_directory]")\n" "$0" echo - echo "gensync will calculate md5sums of packages in the same directory as" - echo "<destfile>, unless an alternate [package_directory] is specified." + echo "$(gettext "gensync will generate a sync database by reading all PKGBUILD files")" + echo "$(gettext "from <root>. gensync builds the database in a temporary directory")" + echo "$(gettext "and then compresses it to <destfile>.")" echo - echo "note: The <destfile> name is important. It must be of the form" - echo " {treename}.db.tar.gz where {treename} is the name of the custom" - echo " package repository you configured in @sysconfdir@/pacman.conf. The" - echo " generated database must reside in the same directory as your" - echo " custom packages (also configured in @sysconfdir@/pacman.conf)" + echo "$(gettext "gensync will calculate md5sums of packages in the same directory as")" + echo "$(gettext "<destfile>, unless an alternate [package_directory] is specified.")" echo - echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz" + echo "$(gettext "note: The <destfile> name is important. It must be of the form")" + echo "$(gettext " {treename}.db.tar.gz where {treename} is the name of the custom")" + echo "$(gettext " package repository you configured in /etc/pacman.conf. The")" + echo "$(gettext " generated database must reside in the same directory as your")" + echo "$(gettext " custom packages (also configured in /etc/pacman.conf)")" echo + echo "$(gettext "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz")" echo exit 0 } @@ -58,7 +62,8 @@ version() { } error () { - echo "==> ERROR: $*" >&2 + local mesg=$1; shift + printf "==> ERROR: ${mesg}\n" "$@" >&2 } die () { @@ -98,8 +103,7 @@ fi if [ -r @sysconfdir@/makepkg.conf ]; then source @sysconfdir@/makepkg.conf else - echo "ERROR: @sysconfdir@/makepkg.conf not found. Can not continue." >&2 - exit 1 # $E_CONFIG_ERROR # TODO: error codes + die "$(gettext "%s not found. Can not continue.")" "@sysconfdir@/makepkg.conf" fi if [ -r ~/.makepkg.conf ]; then @@ -117,9 +121,9 @@ if [ "$3" != "" ]; then pkgdir="$3" fi -[ ! -d "$rootdir" ] && die "invalid root dir: $rootdir" +[ ! -d "$rootdir" ] && die "$(gettext "invalid root dir: %s")" $rootdir -echo "gensync: building database entries, generating md5sums..." >&2 +echo "$(gettext "gensync: building database entries, generating md5sums...")" >&2 cd "$destdir" pkgs="" @@ -128,7 +132,7 @@ forcepkgs="" for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do unset pkgname pkgver pkgrel options - source $file || die "failed to parse parse $file" + source $file || die "$(gettext "failed to parse parse %s")" $file if [ "$pkgdir" != "" ]; then pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT" else @@ -136,7 +140,7 @@ for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do fi if [ ! -f "$pkgfile" ]; then - error "could not find $pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT - skipping" + error "$(gettext "could not find %s-%s-%s-%s.%s - skipping")" $pkgname $pkgver $pkgrel $CARCH $PKGEXT else if check_force; then forcepkgs="$forcepkgs $pkgfile" @@ -146,7 +150,7 @@ for file in $(find "$rootdir"/* -name "$BUILDSCRIPT"); do fi done -echo "creating repo DB..." +echo "$(gettext "creating repo DB...")" # we'll trim the output just a tad, as gensync may be used on large repos repo-add $destfile $pkgs --force $force_pkgs \ diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 6e70759b..6fedd8a6 100644 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -920,7 +920,7 @@ install_package() { } usage() { - printf "$(gettext "makepkg (pacman) %s")\n" "$myver" + printf "makepkg (pacman) %s\n" "$myver" echo printf "$(gettext "Usage: %s [options]")\n" "$0" echo diff --git a/scripts/pacman-optimize.in b/scripts/pacman-optimize.in index 0224b7c3..aaae6d24 100644 --- a/scripts/pacman-optimize.in +++ b/scripts/pacman-optimize.in @@ -21,35 +21,39 @@ # USA. # +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' +# TODO fix these paths dbroot='@ROOTDIR@@DBPATH@' lockfile='@ROOTDIR@@LOCKFILE@' -error() { - if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then - echo -e "\033[1;31m:: ERROR:\033[1;0m \033[1;1m$@\033[1;0m" >&2 - else - echo ":: ERROR: $@" >&2 - fi +msg() { + local mesg=$1; shift + printf "==> ${mesg}\n" "$@" >&2 } -# determine current USECOLOR setting -[ -f "/etc/rc.conf" ] && source /etc/rc.conf -[ -f "/etc/rc.d/functions" ] && source /etc/rc.d/functions +error () { + local mesg=$1; shift + printf "==> ERROR: ${mesg}\n" "$@" >&2 +} usage() { - echo "pacman-optimize (pacman) $myver" - echo "usage: $0 [pacman_db_root]" + printf "pacman-optimize (pacman) %s\n" "$myver" + echo + printf "$(gettext "Usage: %s[pacman_db_root]")\n" "$0" echo - echo "pacman-optimize is a little hack that should improve the performance" - echo "of pacman when reading/writing to its filesystem-based database." + echo "$(gettext "pacman-optimize is a little hack that should improve the performance")" + echo "$(gettext "of pacman when reading/writing to its filesystem-based database.")" echo - echo "Because pacman uses many small files to keep track of packages," - echo "there is a tendency for these files to become fragmented over time." - echo "This script attempts to relocate these small files into one" - echo "continuous location on your hard drive. The result is that the hard" - echo "drive should be able to read them faster, since the hard drive head" - echo "does not have to move around the disk as much." + echo "$(gettext "Because pacman uses many small files to keep track of packages,")" + echo "$(gettext "there is a tendency for these files to become fragmented over time.")" + echo "$(gettext "This script attempts to relocate these small files into one")" + echo "$(gettext "continuous location on your hard drive. The result is that the hard")" + echo "$(gettext "drive should be able to read them faster, since the hard drive head")" + echo "$(gettext "does not have to move around the disk as much.")" echo } @@ -88,73 +92,66 @@ fi # make sure pacman isn't running if [ -f $lockfile ]; then - die "Pacman lockfile was found. Cannot run while pacman is running." + die "$(gettext "Pacman lockfile was found. Cannot run while pacman is running.")" fi if [ ! -d "$dbroot" ]; then - die "$dbroot does not exist or is not a directory" + die "$(gettext "%s does not exist or is not a directory.")" "$dbroot" fi if [ ! -w "$dbroot" ]; then - die "You must have correct permissions to optimize the database" + die "$(gettext "You must have correct permissions to optimize the database.")" fi # do not let pacman run while we do this touch $lockfile # step 1: sum the old db -stat_busy "Md5sum'ing the old database" +msg "$(gettext "MD5sum'ing the old database...")" find $dbroot -type f | sort | xargs md5sum > /tmp/pacsums.old -stat_done # step 2: tar it up -stat_busy "Tar'ing up $dbroot" +msg "$(gettext "Tar'ing up %s...")" "$dbroot" cd $dbroot tar -czf /tmp/pacmanDB.tgz ./ if [ $? -ne 0 ]; then - stat_fail rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old - die_r "tar'ing up $dbroot failed" + die_r "$(gettext "Tar'ing up %s failed.")" "$dbroot" fi -stat_done # step 3: make and sum the new db -stat_busy "Making and md5sum'ing the new db" +msg "$(gettext "Making and MD5sum'ing the new db...")" mkdir $dbroot.new tar -zxpf /tmp/pacmanDB.tgz -C $dbroot.new/ if [ $? -ne 0 ]; then rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old rm -rf "$dbroot.new" - die_r "untar'ing $dbroot failed" + die_r "$(gettext "Untar'ing $dbroot failed.")" fi -find "$dbroot.new" -type f | sort | sed -e 's/pacman.new/pacman/g' |\ +find "$dbroot.new" -type f | sort | sed -e 's/pacman.new/pacman/g' | \ xargs md5sum > /tmp/pacsums.new -stat_done # step 4: compare the sums -stat_busy "Checking integrity" +msg "$(gettext "Checking integrity...")" diff /tmp/pacsums.old /tmp/pacsums.new >/dev/null 2>&1 if [ $? -ne 0 ]; then # failed - stat_fail # leave /tmp/pacsums.old and .new for checking to see what doesn't match up rm -rf "$dbroot.new" $lockfile /tmp/pacmanDB.tgz - die_r "integrity check FAILED, reverting to old database" + die_r "$(gettext "integrity check FAILED, reverting to old database.")" fi -stat_done # step 5: remove the new temporary database and the old one # and use the .tgz to replace the old one -stat_busy "Putting the new database in place" +msg "$(gettext "Putting the new database in place...")" rm -rf "$dbroot.new" "$dbroot"/* tar -zxpf /tmp/pacmanDB.tgz -C "$dbroot"/ -stat_done # remove the lock file, sum files, and .tgz of database rm -f $lockfile /tmp/pacsums.old /tmp/pacsums.new /tmp/pacmanDB.tgz echo -echo "Finished. Your pacman database has been optimized." +echo "$(gettext "Finished. Your pacman database has been optimized.")" echo exit 0 diff --git a/scripts/repo-add.in b/scripts/repo-add.in index 4dcde346..1ad468b2 100644 --- a/scripts/repo-add.in +++ b/scripts/repo-add.in @@ -20,6 +20,10 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' FORCE=0 @@ -28,19 +32,19 @@ TMP_DIR="" # print usage instructions usage() { - echo "repo-add $myver" + printf "repo-add (pacman) %s\n" "$myver" echo - echo "usage: repo-add <path-to-db> [--force] <package> ..." + echo "$(gettext "usage: repo-add <path-to-db> [--force] <package> ...")" echo - echo "repo-add will update a package database by reading a package file." - echo "Multiple packages to add can be specified on the command line." + echo "$(gettext "repo-add will update a package database by reading a package file.")" + echo "$(gettext "Multiple packages to add can be specified on the command line.")" echo - echo "The --force flag will add a 'force' entry to the sync database, which" - echo "tells pacman to skip its internal version number checking and update" - echo "the package regardless." + echo "$(gettext "The --force flag will add a 'force' entry to the sync database, which")" + echo "$(gettext "tells pacman to skip its internal version number checking and update")" + echo "$(gettext "the package regardless.")" echo - echo "Example:" - echo " repo-add /path/to/repo.db.tar.gz pacman-3.0.0.pkg.tar.gz" + echo "$(gettext "Example:")" + echo "$(gettext " repo-add /path/to/repo.db.tar.gz pacman-3.0.0.pkg.tar.gz")" echo } @@ -137,14 +141,14 @@ db_write_entry() # ensure $pkgname and $pkgver variables were found if [ -z "$pkgname" -o -z "$pkgver" ]; then - echo " error: invalid package file" + echo "$(gettext " error: invalid package file")" return 1 fi # remove any other package in the DB with same name for existing in *; do if [ "${existing%-*-*}" = "$pkgname" ]; then - echo ":: removing existing package '$existing'" + echo "$(gettext ":: removing existing package '%s'")" $existing rm -rf $existing fi done @@ -154,7 +158,7 @@ db_write_entry() cd "$pkgname-$pkgver" # create desc entry - echo ":: creating 'desc' db entry" + echo "$(gettext ":: creating 'desc' db entry")" echo -e "%FILENAME%\n$(basename $1)\n" >>desc echo -e "%NAME%\n$pkgname\n" >>desc echo -e "%VERSION%\n$pkgver\n" >>desc @@ -172,7 +176,7 @@ db_write_entry() # compute checksums for chk in ${DB_CHECKSUMS[@]}; do name="$(checksum_name $chk)" - echo ":: computing $name checksums" + echo "$(gettext ":: computing %s checksums")" $name if [ -n "$name" ]; then echo -e "%$name%\n$(get_checksum $chk $pkgfile)\n" >>desc fi @@ -241,8 +245,8 @@ fi if [ -r @sysconfdir@/makepkg.conf ]; then source @sysconfdir@/makepkg.conf else - echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 - exit 1 # $E_CONFIG_ERROR # TODO: error codes + echo "$(gettext "ERROR: /etc/makepkg.conf not found. Can not continue.")" >&2 + exit 1 # $E_CONFIG_ERROR fi if [ -r ~/.makepkg.conf ]; then @@ -252,7 +256,7 @@ fi # main routine if [ $# -gt 1 ]; then gstmpdir=$(mktemp -d /tmp/gensync.XXXXXXXXXX) || (\ - echo "cannot create temp directory for database building"; \ + echo "$(gettext "cannot create temp directory for database building")"; \ exit 1) success=0 @@ -263,18 +267,18 @@ if [ $# -gt 1 ]; then elif [ -z "$REPO_DB_FILE" ]; then REPO_DB_FILE="$(readlink -f $arg)" if ! test_repo_db_file; then - echo "error: repository file '$REPO_DB_FILE' is not a proper pacman db" + echo "$(gettext "error: repository file '%s' is not a proper pacman db")" $REPO_DB_FILE exit 1 elif [ -f "$REPO_DB_FILE" ]; then - echo ":: extracting database to a temporary location" + echo "$(gettext ":: extracting database to a temporary location")" tar xf "$REPO_DB_FILE" -C "$gstmpdir" fi else if [ -f "$arg" ]; then if ! tar tf "$arg" .PKGINFO 2>&1 >/dev/null; then - echo "error: '$arg' is not a package file, skipping" + echo "$(gettext "error: '%s' is not a package file, skipping")" $arg else - echo ":: adding package '$arg'" + echo "$(gettext ":: adding package '%s'")" $arg this_dir="$(pwd)" if db_write_entry "$arg"; then @@ -283,14 +287,14 @@ if [ $# -gt 1 ]; then cd $this_dir fi else - echo "error: package '$arg' not found" + echo "$(gettext "error: package '%s' not found")" $arg fi fi done # if all operations were a success, rezip database if [ "$success" = "1" ]; then - echo ":: creating updated database file ${REPO_DB_FILE}" + echo "$(gettext ":: creating updated database file %s")" ${REPO_DB_FILE} cd $gstmpdir if [ -n "$(ls)" ]; then [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" @@ -298,12 +302,12 @@ if [ $# -gt 1 ]; then case "$DB_COMPRESSION" in gz) tar c * | gzip -9 >$REPO_DB_FILE ;; bz2) tar c * | bzip2 -9 >$REPO_DB_FILE ;; - *) echo "warning: no compression set" + *) echo "$(gettext "warning: no compression set")" tar c * >$REPO_DB_FILE;; esac fi else - echo ":: no packages modified, nothing to do" + echo "$(gettext ":: no packages modified, nothing to do")" fi fi diff --git a/scripts/repo-remove.in b/scripts/repo-remove.in index a0b4a70a..02021f33 100644 --- a/scripts/repo-remove.in +++ b/scripts/repo-remove.in @@ -20,6 +20,10 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' FORCE=0 @@ -28,16 +32,16 @@ TMP_DIR="" # print usage instructions usage() { - echo "repo-remove $myver" + echo "$(gettext "repo-remove %s")" $myver echo - echo "usage: repo-remove <path-to-db> <packagename> ..." + echo "$(gettext "usage: repo-remove <path-to-db> <packagename> ...")" echo - echo "repo-remove will update a package database by removing the package name" - echo "specified on the command line from the given repo database. Multiple" - echo "packages to remove can be specified on the command line." + echo "$(gettext "repo-remove will update a package database by removing the package name")" + echo "$(gettext "specified on the command line from the given repo database. Multiple")" + echo "$(gettext "packages to remove can be specified on the command line.")" echo - echo "Example:" - echo " repo-remove /path/to/repo.db.tar.gz kernel26" + echo "$(gettext "Example:")" + echo "$(gettext " repo-remove /path/to/repo.db.tar.gz kernel26")" echo } @@ -67,7 +71,7 @@ db_remove_entry() # remove any other package in the DB with same name for existing in *; do if [ "${existing%-*-*}" = "$1" ]; then - echo ":: removing existing package '$existing'" + echo "$(gettext ":: removing existing package '%s'")" $existing rm -rf $existing fi done @@ -97,8 +101,8 @@ fi if [ -r @sysconfdir@/makepkg.conf ]; then source @sysconfdir@/makepkg.conf else - echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 - exit 1 # $E_CONFIG_ERROR # TODO: error codes + echo "$(gettext "ERROR: /etc/makepkg.conf not found. Can not continue.")" >&2 + exit 1 # $E_CONFIG_ERROR fi if [ -r ~/.makepkg.conf ]; then @@ -108,7 +112,7 @@ fi # main routine if [ $# -gt 1 ]; then gstmpdir=$(mktemp -d /tmp/gensync.XXXXXXXXXX) || (\ - echo "cannot create temp directory for database building"; \ + echo "$(gettext "cannot create temp directory for database building")"; \ exit 1) success=0 @@ -117,20 +121,20 @@ if [ $# -gt 1 ]; then if [ -z "$REPO_DB_FILE" ]; then REPO_DB_FILE="$(readlink -f $arg)" if ! test_repo_db_file; then - echo "error: repository file '$REPO_DB_FILE' is not a proper pacman db" + echo "$(gettext "error: repository file '%s' is not a proper pacman db")" $REPO_DB_FILE exit 1 elif [ -f "$REPO_DB_FILE" ]; then - echo ":: extracting database to a temporary location" + echo "$(gettext ":: extracting database to a temporary location")" tar xf "$REPO_DB_FILE" -C "$gstmpdir" fi else - echo ":: searching for package '$arg'" + echo "$(gettext ":: searching for package '%s'")" this_dir="$(pwd)" if db_remove_entry "$arg"; then success=1 else - echo "error: package matching '$arg' not found" + echo "$(gettext "error: package matching '%s' not found")" $arg fi cd $this_dir fi @@ -138,7 +142,7 @@ if [ $# -gt 1 ]; then # if all operations were a success, rezip database if [ "$success" = "1" ]; then - echo ":: creating updated database file ${REPO_DB_FILE}" + echo "$(gettext ":: creating updated database file %s")" ${REPO_DB_FILE} cd $gstmpdir if [ -n "$(ls)" ]; then [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" @@ -146,12 +150,12 @@ if [ $# -gt 1 ]; then case "$DB_COMPRESSION" in gz) tar c * | gzip -9 >$REPO_DB_FILE ;; bz2) tar c * | bzip2 -9 >$REPO_DB_FILE ;; - *) echo "warning: no compression set" + *) echo "$(gettext "warning: no compression set")" tar c * >$REPO_DB_FILE;; esac fi else - echo ":: no packages modified, nothing to do" + echo "$(gettext ":: no packages modified, nothing to do")" fi fi diff --git a/scripts/updatesync.in b/scripts/updatesync.in index c0888c74..1526e285 100644 --- a/scripts/updatesync.in +++ b/scripts/updatesync.in @@ -22,30 +22,34 @@ # USA. # +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + myver='@PACKAGE_VERSION@' # functions usage() { - echo "updatesync $myver" - echo "usage: $0 <action> <destfile> <option> [package_directory]" + printf "updatesync (pacman) %s\n" "$myver" echo - echo "updatesync will update a sync database by reading a PKGBUILD and" - echo "modifying the destfile. updatesync updates the database in a temporary" - echo "directory and then compresses it to <destfile>." + printf "$(gettext "Usage: %s <action> <destfile> <option> [package_directory]")\n" "$0" echo - echo "There are two types of actions:" + echo "$(gettext "updatesync will update a sync database by reading a PKGBUILD and")" + echo "$(gettext "modifying the destfile. updatesync updates the database in a temporary")" + echo "$(gettext "directory and then compresses it to <destfile>.")" echo - echo "upd - Will update a package's entry or create it if it doesn't exist." - echo " It takes the package's PKGBUILD as an option." - echo "del - Will remove a package's entry from the db." - echo " It takes the package's name as an option." + echo "$(gettext "There are two types of actions:")" echo - echo "updatesync will calculate md5sums of packages in the same directory as" - echo "<destfile>, unless an alternate [package_directory] is specified." + echo "$(gettext "upd - Will update a package's entry or create it if it doesn't exist.")" + echo "$(gettext " It takes the package's PKGBUILD as an option.")" + echo "$(gettext "del - Will remove a package's entry from the db.")" + echo "$(gettext " It takes the package's name as an option.")" echo - echo "example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD" + echo "$(gettext "updatesync will calculate md5sums of packages in the same directory as")" + echo "$(gettext "<destfile>, unless an alternate [package_directory] is specified.")" echo + echo "$(gettext "example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD")" echo exit 0 } @@ -60,7 +64,8 @@ version() { } error () { - echo "==> ERROR: $*" >&2 + local mesg=$1; shift + printf "==> ERROR: ${mesg}\n" "$@" >&2 } die () { @@ -100,8 +105,7 @@ fi if [ -r @sysconfdir@/makepkg.conf ]; then source @sysconfdir@/makepkg.conf else - echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 - exit 1 # $E_CONFIG_ERROR # TODO: error codes + die "$(gettext "%s not found. Can not continue.")" "@sysconfdir@/makepkg.conf" fi if [ -r ~/.makepkg.conf ]; then @@ -123,17 +127,17 @@ fi opt_force="" if [ ! -f "$option" ]; then - die "$option not found" + die "$(gettext "%s not found")" $option fi if [ "$action" = "upd" ]; then # INSERT / UPDATE unset pkgname pkgver pkgrel options - source $option || die "failed to parse $option" + source $option || die "$(gettext "failed to parse %s")" $option pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT" if [ ! -f "$pkgfile" ]; then - die "could not find $pkgname-$pkgver-$pkgrel-$CARCH.$PKGEXT - aborting" + die "$(gettext "could not find %s-%s-%s-%s.%s - aborting")" $pkgname $pkgver $pkgrel $CARCH $PKGEXT fi if check_force; then |