Switch repo-add, repo-remove, and pacman-optimize to bsdtar

Relatively straightforward fixes (s/tar/bsdtar/g, add hyphens to options).

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-07-15 10:29:26 -04:00
parent f0ea21cffc
commit 66b09410b4
3 changed files with 15 additions and 15 deletions

View file

@ -109,7 +109,7 @@ find $dbroot -type f | sort | xargs md5sum > /tmp/pacsums.old
# step 2: tar it up # step 2: tar it up
msg "$(gettext "Tar'ing up %s...")" "$dbroot" msg "$(gettext "Tar'ing up %s...")" "$dbroot"
cd $dbroot cd $dbroot
tar -czf /tmp/pacmanDB.tgz ./ bsdtar -czf /tmp/pacmanDB.tgz ./
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old
die_r "$(gettext "Tar'ing up %s failed.")" "$dbroot" die_r "$(gettext "Tar'ing up %s failed.")" "$dbroot"
@ -118,7 +118,7 @@ fi
# step 3: make and sum the new db # step 3: make and sum the new db
msg "$(gettext "Making and MD5sum'ing the new db...")" msg "$(gettext "Making and MD5sum'ing the new db...")"
mkdir $dbroot.new mkdir $dbroot.new
tar -zxpf /tmp/pacmanDB.tgz -C $dbroot.new/ bsdtar -zxpf /tmp/pacmanDB.tgz -C $dbroot.new/
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old rm -f /tmp/pacmanDB.tgz /tmp/pacsums.old
rm -rf "$dbroot.new" rm -rf "$dbroot.new"
@ -141,7 +141,7 @@ fi
# and use the .tgz to replace the old one # and use the .tgz to replace the old one
msg "$(gettext "Putting the new database in place...")" msg "$(gettext "Putting the new database in place...")"
rm -rf "$dbroot.new" "$dbroot"/* rm -rf "$dbroot.new" "$dbroot"/*
tar -zxpf /tmp/pacmanDB.tgz -C "$dbroot"/ bsdtar -zxpf /tmp/pacmanDB.tgz -C "$dbroot"/
# remove the lock file, sum files, and .tgz of database # remove the lock file, sum files, and .tgz of database
rm -f $lockfile /tmp/pacsums.old /tmp/pacsums.new /tmp/pacmanDB.tgz rm -f $lockfile /tmp/pacsums.old /tmp/pacsums.new /tmp/pacmanDB.tgz

View file

@ -80,7 +80,7 @@ checksum_name () {
# test if a file is a repository DB # test if a file is a repository DB
test_repo_db_file () { test_repo_db_file () {
if [ -f "$REPO_DB_FILE" ]; then if [ -f "$REPO_DB_FILE" ]; then
[ "$(tar tf "$REPO_DB_FILE" | grep -c "/desc")" -gt 0 ] || return 1 [ "$(bsdtar -tf "$REPO_DB_FILE" | grep -c "/desc")" -gt 0 ] || return 1
else else
true true
fi fi
@ -114,7 +114,7 @@ db_write_entry()
" "
# read info from the zipped package # read info from the zipped package
for i in $(tar xOf "$pkgfile" .PKGINFO | grep -v "^#" |sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do for i in $(bsdtar -xOf "$pkgfile" .PKGINFO | grep -v "^#" |sed 's|\(\w*\)\s*=\s*\(.*\)|\1="\2"|'); do
eval "${i}" eval "${i}"
case "$i" in case "$i" in
group=*) _groups="$_groups $group" ;; group=*) _groups="$_groups $group" ;;
@ -266,11 +266,11 @@ if [ $# -gt 1 ]; then
exit 1 exit 1
elif [ -f "$REPO_DB_FILE" ]; then elif [ -f "$REPO_DB_FILE" ]; then
echo "$(gettext ":: extracting database to a temporary location")" echo "$(gettext ":: extracting database to a temporary location")"
tar xf "$REPO_DB_FILE" -C "$gstmpdir" bsdtar -xf "$REPO_DB_FILE" -C "$gstmpdir"
fi fi
else else
if [ -f "$arg" ]; then if [ -f "$arg" ]; then
if ! tar tf "$arg" .PKGINFO 2>&1 >/dev/null; then if ! bsdtar -tf "$arg" .PKGINFO 2>&1 >/dev/null; then
echo "$(gettext "error: '%s' is not a package file, skipping")" $arg echo "$(gettext "error: '%s' is not a package file, skipping")" $arg
else else
echo "$(gettext ":: adding package '%s'")" $arg echo "$(gettext ":: adding package '%s'")" $arg
@ -295,10 +295,10 @@ if [ $# -gt 1 ]; then
[ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old"
[ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old" [ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
case "$DB_COMPRESSION" in case "$DB_COMPRESSION" in
gz) tar c * | gzip -9 >$REPO_DB_FILE ;; gz) bsdtar -c * | gzip -9 >$REPO_DB_FILE ;;
bz2) tar c * | bzip2 -9 >$REPO_DB_FILE ;; bz2) bsdtar -c * | bzip2 -9 >$REPO_DB_FILE ;;
*) echo "$(gettext "warning: no compression set")" *) echo "$(gettext "warning: no compression set")"
tar c * >$REPO_DB_FILE;; bsdtar -c * >$REPO_DB_FILE;;
esac esac
fi fi
else else

View file

@ -52,7 +52,7 @@ There is NO WARRANTY, to the extent permitted by law.\n")"
# test if a file is a repository DB # test if a file is a repository DB
test_repo_db_file () { test_repo_db_file () {
if [ -f "$REPO_DB_FILE" ]; then if [ -f "$REPO_DB_FILE" ]; then
[ "$(tar tf "$REPO_DB_FILE" | grep -c "/desc")" -gt 0 ] || return 1 [ "$(bsdtar -tf "$REPO_DB_FILE" | grep -c "/desc")" -gt 0 ] || return 1
else else
true true
fi fi
@ -120,7 +120,7 @@ if [ $# -gt 1 ]; then
exit 1 exit 1
elif [ -f "$REPO_DB_FILE" ]; then elif [ -f "$REPO_DB_FILE" ]; then
echo "$(gettext ":: extracting database to a temporary location")" echo "$(gettext ":: extracting database to a temporary location")"
tar xf "$REPO_DB_FILE" -C "$gstmpdir" bsdtar -xf "$REPO_DB_FILE" -C "$gstmpdir"
fi fi
else else
echo "$(gettext ":: searching for package '%s'")" echo "$(gettext ":: searching for package '%s'")"
@ -143,10 +143,10 @@ if [ $# -gt 1 ]; then
[ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old" [ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old"
[ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old" [ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
case "$DB_COMPRESSION" in case "$DB_COMPRESSION" in
gz) tar c * | gzip -9 >$REPO_DB_FILE ;; gz) bsdtar -c * | gzip -9 >$REPO_DB_FILE ;;
bz2) tar c * | bzip2 -9 >$REPO_DB_FILE ;; bz2) bsdtar -c * | bzip2 -9 >$REPO_DB_FILE ;;
*) echo "$(gettext "warning: no compression set")" *) echo "$(gettext "warning: no compression set")"
tar c * >$REPO_DB_FILE;; bsdtar -c * >$REPO_DB_FILE;;
esac esac
fi fi
else else