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

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

Addded ReadMe files containing setup instructions for all package managers

  • Property svn:executable set to *
File size: 2.7 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 cd $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://$domain/repos/rpm/\$basearch'
38 echo 'enabled=1'
39 echo 'gpgcheck=1'
40 echo 'gpgkey=http://$domain/repos/gpg.key'
41 ) > /etc/yum.repos.d/greenstone.repo
42
43$install_cmd_instruction
44
45 sudo yum install greenstone
46" > $repos/rpm/ReadMe
47 ;;
48 add)
49 keyid=$(get_gpg)
50 createrepo_check
51 shift
52 for pkg in $@; do
53 # Default to all architectures unless an architecture is specified
54 arch="any"
55 echo $pkg | grep 'x86_64\.rpm' >/dev/null 2>/dev/null && {
56 arch="x86_64"
57 }
58 echo $pkg | grep 'i686\.rpm' >/dev/null 2>/dev/null && {
59 arch="i386"
60 }
61 name="$(basename $pkg)"
62 echo "$name: $arch"
63 cp $pkg $arch/
64 # Unfortunately RPM is (as usual) sub-standard, and will not use
65 # gpg-agent. As such, you will probably be forced to enter a pass
66 # phrase for every single package that gets signed, regardless of
67 # whether your GPG key even has a pass-phrase (just hit enter in
68 # that case)
69 echo "Signing $name..."
70 rpmsign --key-id=$keyid --addsign $arch/$name
71 # If arch is any, symlink package into all architectures
72 if test "$arch" = "any"; then
73 for link in x86_64 i386; do
74 echo "$name: $link (linked)"
75 cd $link
76 ln -sf ../any/$name $name
77 cd ..
78 done
79 fi
80 done
81 for arch in x86_64 i386; do
82 cd $arch
83 createrepo --update .
84 rm -f repodata/repomd.xml.asc
85 gpg --detach-sign --armor --use-agent --default-key $keyid repodata/repomd.xml
86 cd ..
87 done
88 ;;
89 -h|--help|help)
90 echo "$help"
91 ;;
92 *)
93 if test -z "$*"; then
94 echo "$help"
95 else
96 createrepo_check
97 createrepo $@
98 fi
99 ;;
100esac
Note: See TracBrowser for help on using the repository browser.