summaryrefslogtreecommitdiffstats
path: root/scripts/updatesync
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/updatesync')
-rwxr-xr-xscripts/updatesync37
1 files changed, 26 insertions, 11 deletions
diff --git a/scripts/updatesync b/scripts/updatesync
index 5385ed66..2f6866d4 100755
--- a/scripts/updatesync
+++ b/scripts/updatesync
@@ -3,7 +3,7 @@
# updatesync
#
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
-# Derived from gensync (c) 2002-2005 Judd Vinet <jvinet@zeroflux.org>
+# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
# USA.
#
-myver='2.9.7'
+myver='2.9.8'
usage() {
echo "updatesync $myver"
@@ -54,6 +54,18 @@ die()
exit 1
}
+check_option() {
+ local i
+ for i in ${options[@]}; do
+ local uc=`echo $i | tr [:lower:] [:upper:]`
+ local lc=`echo $i | tr [:upper:] [:lower:]`
+ if [ "$uc" = "$1" -o "$lc" = "$1" ]; then
+ echo $1
+ return
+ fi
+ done
+}
+
get_md5checksum()
{
if [ "$pkgdir" != "" ]; then
@@ -72,7 +84,7 @@ get_md5checksum()
db_write_entry()
{
unset pkgname pkgver pkgrel pkgdesc force
- unset groups replaces provides depends conflicts
+ unset groups replaces provides depends conflicts options
source $1 || return 1
cd $ustmpdir
mkdir $pkgname-$pkgver-$pkgrel || return 1
@@ -110,7 +122,7 @@ db_write_entry()
done
echo "" >>desc
fi
- if [ "$force" = "y" -o "$force" = "Y" ]; then
+ if [ "$force" = "y" -o "$force" = "Y" -o "`check_option FORCE`" ]; then
echo "%FORCE%" >>desc
echo "" >>desc
fi
@@ -157,7 +169,7 @@ delete_entry()
if [ $# -lt 3 ]; then
usage
- exit 0
+ exit 1
fi
if [ "$1" = "-h" -o "$1" = "--help" ]; then
@@ -210,12 +222,15 @@ if [ "$action" = "upd" ]; then
else
pkgfile="$destdir/$pkgname-$pkgver-$pkgrel.pkg.tar.gz"
fi
- [ -f $pkgfile ] || die "missing package file: $pkgfile"
- csize=`du -b $pkgfile | cut -f1`
- pkgmd5sum=`get_md5checksum $pkgfile`
- [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile"
- echo "updatesync: creating entry for $option" >&2
- db_write_entry $option || die "error writing entry for $option"
+ if [ -f $pkgfile ]; then
+ csize=`du -b $pkgfile | cut -f1`
+ pkgmd5sum=`get_md5checksum $pkgfile`
+ [ -z $pkgmd5sum ] && die "error generating checksum for $pkgfile"
+ echo "updatesync: creating entry for $option" >&2
+ db_write_entry $option || die "error writing entry for $option"
+ else
+ echo "updatesync: missing package: $pkgfile" >&2
+ fi
else
# DELETE
delete_entry $option