source: main/trunk/package-kits/linux/repos/pacman@ 29706

Last change on this file since 29706 was 29706, checked in by Jeremy Symon, 9 years ago

Fixed testing for dependencies

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2
3. $(dirname $0)/conf.sh
4
5help="Options:
6 setup
7 add </path/to/1.pkg.tar.xz> ..."
8
9repo_add_check() {
10 test -d $repos/arch/ || {
11 echo "Repository not found. Have you set it up?" >&2
12 exit 1
13 }
14 which repo-add || {
15 echo "Must install repo-add to manage pacman packages" >&2
16 exit 1
17 }
18}
19
20case $1 in
21 setup)
22 echo "Making arch package repository folders"
23 for arch in x86_64 i686; do
24 mkdir -p $repos/arch/$arch || exit 1
25 done
26 echo
27 keyid=$(get_gpg)
28 echo "Making ReadMe file"
29 echo "\
30$setup_cmd_instruction
31
32 (
33 echo '[$label]'
34 echo 'Server = http://$uri_root/arch/\$arch'
35 ) >> /etc/pacman.conf
36 curl -L 'http://$uri_root/gpg.key' | pacman-key -a -
37 pacman-key -f $keyid
38 pacman-key --lsign-key $keyid
39 pacman -Syu
40
41$install_cmd_instruction
42
43 sudo pacman -S greenstone
44" > $repos/arch/ReadMe.txt
45 ;;
46 add)
47 keyid=$(get_gpg)
48 repo_add_check
49 shift
50 for pkg in $@; do
51 # Default to all architectures unless an architecture is specified
52 arch="x86_64 i686"
53 echo $pkg | grep 'x86_64\.pkg' >/dev/null 2>/dev/null && {
54 arch="x86_64"
55 }
56 echo $pkg | grep 'i686\.pkg' >/dev/null 2>/dev/null && {
57 arch="i686"
58 }
59 name="$(basename $pkg)"
60 for pkgarch in $arch; do
61 dir="$repos/arch/$pkgarch"
62 cp "$pkg" "$dir/"
63 cd "$dir"
64 echo "$name: $pkgarch"
65 rm -f "${name}.sig"
66 gpg --detach-sign --use-agent --default-key "$keyid" "$name"
67 repo-add -s -k "$keyid" -v -d "${label}.db.tar.xz" "$name"
68 cd -
69 done
70 done
71 ;;
72 -h|--help|help)
73 echo "$help"
74 ;;
75 *)
76 if test -z "$*"; then
77 echo "$help"
78 else
79 repo_add_check
80 repo-add $@
81 fi
82 ;;
83esac
Note: See TracBrowser for help on using the repository browser.