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

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

Created script for managing Pacman repo

  • Property svn:executable set to *
File size: 3.1 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 cd $repos/arch/ || {
11 echo "Repository not found. Have you set it up?" >&2
12 exit 1
13 }
14 test -x `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 any x86_64 i686; do
24 mkdir -p $repos/arch/$arch || exit 1
25 done
26 echo "Making readme file"
27 echo "\
28To use this repository:
29
301. Add the following section to your pacman.conf:
31
32 [$label]
33 Server = http://$domain/repos/arch/\$arch
34
352. Import the $label GPG public key:
36
37 wget http://$domain/repos/gpg.key -O ${label}.key
38 sudo pacman-key -a ${label}.key
39 sudo pacman-key -f <keyid>
40 sudo pacman-key --lsign-key <keyid>
41
42To find the <keyid>, you can run
43
44 sudo pacman-key -l
45
46And find the key with uid '$origin'.
47It should be at the bottom, as it was just added
48
492.1. If you don't want to import the $label GPG key, you can just prepend the
50following to your pacman.conf:
51
52 [SigLevel = Optional]
53
54This will disable signature checking, allowing you to install packages
55without ensuring they originated with the Greenstone Team." > $repos/arch/readme
56 ;;
57 add)
58 if test -f $base/gpg.key.id; then
59 keyid=$(cat $base/gpg.key.id)
60 else
61 gpg --list-keys
62 echo "Enter the keyid of the GPG key to use:"
63 while test -z $keyid; do
64 echo -n "> "
65 read keyid
66 done
67 echo $keyid > $base/gpg.key.id
68 echo
69 fi
70 repo_add_check
71 shift
72 for pkg in $@; do
73 # Default to all architectures unless an architecture is specified
74 arch="any"
75 echo $pkg | grep 'x86_64\.pkg' >/dev/null 2>/dev/null && {
76 arch="x86_64"
77 }
78 echo $pkg | grep 'i686\.pkg' >/dev/null 2>/dev/null && {
79 arch="i686"
80 }
81 name="$(basename $pkg)"
82 echo "$name: $arch"
83 cp $pkg $arch/
84 rm -f "$arch/${name}.sig"
85 gpg --detach-sign --use-agent --default-key $keyid "$arch/$name"
86 # If arch is any, symlink package into all architectures
87 if test "$arch" = "any"; then
88 for link in x86_64 i686; do
89 echo "$name: $link (linked)"
90 cd $link
91 ln -sf ../any/$name $name
92 ln -sf ../any/${name}.sig ${name}.sig
93 cd ..
94 done
95 arch="any x86_64 i686"
96 fi
97
98 for pkgarch in $arch; do
99 cd $pkgarch
100 repo-add -s -k $keyid -v -d ${label}.db.tar.xz $name
101 cd ..
102 done
103 done
104 ;;
105 -h|--help|help)
106 echo "$help"
107 ;;
108 *)
109 if test -z "$*"; then
110 echo "$help"
111 else
112 repo_add_check
113 repo-add $@
114 fi
115 ;;
116esac
Note: See TracBrowser for help on using the repository browser.