Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (57 sloc) 1.49 KB
#!/bin/bash
set -e
reponame() {
release=$(cat /etc/SuSE-release)
case "$release" in
*openSUSE?11.4*)
echo openSUSE_11.4 ;;
*openSUSE?12.1*)
echo openSUSE_12.1 ;;
*openSUSE?12.2*)
echo openSUSE_12.2 ;;
*openSUSE?12.3*)
echo openSUSE_12.3 ;;
*"SUSE Linux Enterprise Server"*"VERSION = 11"*"PATCHLEVEL = 3"*)
echo SLE_11_SP3 ;;
esac
}
# $1 32 bit id
addrepokey() {
rpm -qa gpg-pubkey | grep -i $1 && return
gpg --keyserver pgp.mit.edu --recv-keys $1
KEYFILE=`mktemp gpg-key-$1-XXXXXX`
gpg --armor --export $1 > $KEYFILE
rpm --import $KEYFILE
rm $KEYFILE
}
addrepo() {
REPO=$1
REPOPATH=${REPO//:/:/} # turn a:b:c into a:/b:/c
REPOURL=http://download.opensuse.org/repositories/${REPOPATH}/$(reponame)
REPOKEY=$2
zypper repos --export - | grep --fixed-strings $REPOURL && return
addrepokey $REPOKEY
zypper addrepo $REPOURL ${REPO}
zypper refresh ${REPO}
}
# $1 obs:repo:name
addobsvendor() {
VENDORBASE=${1%%:*}
VENDORID=obs://build.opensuse.org/$VENDORBASE
VDIR=/etc/zypp/vendors.d
mkdir -p $VDIR
test -f $VDIR/$VENDORBASE && return
cat <<EOF > $VDIR/$VENDORBASE
[main]
vendors = SUSE,$VENDORID
EOF
}
install() {
zypper --non-interactive install rubygem-chef
}
rpm -q rubygem-chef && exit
install && exit
addrepo devel:languages:ruby:extensions 0E9AF123
install && exit
addobsvendor devel:languages:ruby:extensions
install