5 # Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
6 # Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 printf "updatesync (pacman) %s\n\n" "$myver"
28 printf "Usage: %s <action> <destfile> <option> [package_directory]\n\n" "$0"
30 updatesync will update a sync database by reading a PKGBUILD and\n\
31 modifying the destfile. updatesync updates the database in a temporary\n\
32 directory and then compresses it to <destfile>.\n\n"
33 printf "There are two types of actions:\n\n"
34 printf "upd - Will update a package's entry or create it if it doesn't exist.\n It takes the package's PKGBUILD as an option.\n"
35 printf "del - Will remove a package's entry from the db. It takes the package's\n name as an option.\n"
38 updatesync will calculate md5sums of packages in the same directory as\n\
39 <destfile>, unless an alternate [package_directory] is specified.\n\n"
40 echo "Example: updatesync upd /home/mypkgs/custom.db.tar.gz PKGBUILD"
44 printf "updatesync (pacman) %s\n" "$myver"
46 Copyright (C) 2004 Jason Chu <jason@archlinux.org>.\n\n\
47 This is free software; see the source for copying conditions.\n\
48 There is NO WARRANTY, to the extent permitted by law.\n"
53 printf "==> ERROR: ${mesg}\n" "$@" >&2
63 if [ "$1" = "-h" -o "$1" = "--help" ]; then
68 if [ "$1" = "-V" -o "$1" = "--version" ]; then
78 # source system and user makepkg.conf
79 if [ -r /etc
/makepkg.conf
]; then
80 source /etc
/makepkg.conf
82 die
"/etc/makepkg.conf not found. Cannot continue."
85 if [ -r ~
/.makepkg.conf
]; then
86 source ~
/.makepkg.conf
89 if [ "$1" != "upd" -a "$1" != "del" ]; then
98 if [ "$4" != "" ]; then
102 if [ "$action" = "upd" ]; then # INSERT / UPDATE
103 if [ ! -f "$option" ]; then
104 die
"$option not found"
107 unset pkgname pkgver pkgrel options
109 source $option || die
"failed to parse $option"
110 if [ "$arch" = 'any' ]; then
113 pkgfile
="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
115 if [ ! -f "$pkgfile" ]; then
116 die
"could not find %s-%s-%s-%s%s - aborting" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
119 repo-add
"$pkgdb" "$pkgfile"
121 fname
="$(basename $option)"
122 if [ "$fname" = "PKGBUILD" ]; then
123 if [ ! -f "$option" ]; then
124 die
"%s not found" $option
127 unset pkgname pkgver pkgrel options
133 repo-remove
"$pkgdb" "$pkgname"
137 # vim: set ts=2 sw=2 noet: