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

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

Updated yum ReadMe's setup instructions to automatically refresh the cache, so that after running the setup commands the system will be ready to 'yum install greenstone' (same as with apt and pacman)

  • 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 yum makecache
43
44$install_cmd_instruction
45
46 sudo yum install greenstone
47" > $repos/rpm/ReadMe
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="any"
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 echo "$name: $arch"
64 cp $pkg $arch/
65 # Unfortunately RPM is (as usual) sub-standard, and will not use
66 # gpg-agent. As such, you will probably be forced to enter a pass
67 # phrase for every single package that gets signed, regardless of
68 # whether your GPG key even has a pass-phrase (just hit enter in
69 # that case)
70 echo "Signing $name..."
71 rpmsign --key-id=$keyid --addsign $arch/$name
72 # If arch is any, symlink package into all architectures
73 if test "$arch" = "any"; then
74 for link in x86_64 i386; do
75 echo "$name: $link (linked)"
76 cd $link
77 ln -sf ../any/$name $name
78 cd ..
79 done
80 fi
81 done
82 for arch in x86_64 i386; do
83 cd $arch
84 createrepo --update .
85 rm -f repodata/repomd.xml.asc
86 gpg --detach-sign --armor --use-agent --default-key $keyid repodata/repomd.xml
87 cd ..
88 done
89 ;;
90 -h|--help|help)
91 echo "$help"
92 ;;
93 *)
94 if test -z "$*"; then
95 echo "$help"
96 else
97 createrepo_check
98 createrepo $@
99 fi
100 ;;
101esac
Note: See TracBrowser for help on using the repository browser.