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 "$(gettext "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 "$(gettext "There are two types of actions
:\n\n")"
34 printf "$(gettext "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 "$(gettext "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 "$(gettext "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 for i in ${options[@]}; do
64 local lc=$(echo $i | tr [:upper:] [:lower:])
65 if [ "$lc" = "force" ]; then
74 if [ "$1" = "-h" -o "$1" = "--help" ]; then
79 if [ "$1" = "-V" -o "$1" = "--version" ]; then
89 # source system and user makepkg.conf
90 if [ -r /etc/makepkg.conf ]; then
91 source /etc/makepkg.conf
93 die "/etc/makepkg.conf not found. Cannot continue."
96 if [ -r ~/.makepkg.conf ]; then
97 source ~/.makepkg.conf
100 if [ "$1" != "upd" -a "$1" != "del" ]; then
109 if [ "$4" != "" ]; then
114 if [ "$action" = "upd" ]; then # INSERT / UPDATE
115 if [ ! -f "$option" ]; then
116 die "$(gettext "%s not found")" $option
119 unset pkgname pkgver pkgrel options
121 source $option || die "$(gettext "failed to parse %s")" $option
122 if [ "$arch" = 'any
' ]; then
125 pkgfile="$pkgdir/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT}"
127 if [ ! -f "$pkgfile" ]; then
128 die "$(gettext "could not find %s-%s-%s-%s%s - aborting")" $pkgname $pkgver $pkgrel $CARCH $PKGEXT
135 repo-add "$pkgdb" $opt_force "$pkgfile"
137 fname="$(basename $option)"
138 if [ "$fname" = "PKGBUILD" ]; then
139 if [ ! -f "$option" ]; then
140 die "$(gettext "%s not found")" $option
143 unset pkgname pkgver pkgrel options
149 repo-remove "$pkgdb" "$pkgname"
153 # vim: set ts=2 sw=2 noet: