source: main/trunk/package-kits/linux/repos/rpm@ 29705

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

Updated rpm repo script to no longer symlink noarch packages into 32- and 64-bit repos. (see r29704 where the same was done for pacman)

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/sh
2
3. $(dirname $0)/conf.sh
4
5help="Options:
6 setup
7 add </path/to/1.rpm> ..."
8
9createrepo_check() {
10 test -d $repos/rpm/ || {
11 echo "Repository not found. Have you set it up?" >&2
12 exit 1
13 }
14 test -x `which createrepo` || {
15 echo "Must install createrepo to manage rpm packages" >&2
16 exit 1
17 }
18 test -x `which rpmsign` || {
19 echo "Must install rpmsign to sign rpm packages" >&2
20 exit 1
21 }
22}
23
24case $1 in
25 setup)
26 echo "Making rpm package repository folders"
27 for arch in any x86_64 i386; do
28 mkdir -p $repos/rpm/$arch || exit 1
29 done
30 echo "Making ReadMe file"
31 echo "\
32$setup_cmd_instruction
33
34 (
35 echo '[$label]'
36 echo 'name=$origin'
37 echo 'baseurl=http://$uri_root/rpm/\$basearch'
38 echo 'enabled=1'
39 echo 'gpgcheck=1'
40 echo 'gpgkey=http://$uri_root/gpg.key'
41 ) > /etc/yum.repos.d/greenstone.repo
42 yum makecache
43
44$install_cmd_instruction
45
46 sudo yum install greenstone
47" > $repos/rpm/ReadMe.txt
48 ;;
49 add)
50 keyid=$(get_gpg)
51 createrepo_check
52 shift
53 for pkg in $@; do
54 # Default to all architectures unless an architecture is specified
55 arch="x86_64 i386"
56 echo $pkg | grep 'x86_64\.rpm' >/dev/null 2>/dev/null && {
57 arch="x86_64"
58 }
59 echo $pkg | grep 'i686\.rpm' >/dev/null 2>/dev/null && {
60 arch="i386"
61 }
62 name="$(basename $pkg)"
63 for pkgarch in $arch; do
64 dir="$repos/rpm/$pkgarch"
65 cp "$pkg" "$dir/"
66 cd "$dir"
67 echo "$name: $arch"
68 # Unfortunately RPM is (as usual) sub-standard, and will not use
69 # gpg-agent. As such, you will probably be forced to enter a pass
70 # phrase for every single package that gets signed, regardless of
71 # whether your GPG key even has a pass-phrase (just hit enter in
72 # that case)
73 echo "Signing $name..."
74 rpmsign --key-id="$keyid" --addsign "$name"
75 cd -
76 done
77 done
78 for arch in x86_64 i386; do
79 cd "$repos/rpm/$arch"
80 createrepo --update .
81 rm -f repodata/repomd.xml.asc
82 gpg --detach-sign --armor --use-agent --default-key "$keyid" repodata/repomd.xml
83 cd -
84 done
85 ;;
86 -h|--help|help)
87 echo "$help"
88 ;;
89 *)
90 if test -z "$*"; then
91 echo "$help"
92 else
93 createrepo_check
94 createrepo $@
95 fi
96 ;;
97esac
Note: See TracBrowser for help on using the repository browser.