modified version of jenkins debian glue (https://github.com/mika/jenkins-debian-glue) for devuan
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 lines
1.7 KiB

#!/bin/sh
set -x
set -e
if [ -r /etc/jenkins/debian_glue ] ; then
. /etc/jenkins/debian_glue
fi
if [ "${REMOTE_REPOS:-}" = "true" ] ; then
echo "REMOTE_REPOS is set, ignoring request to generate local repository."
exit 0
fi
if [ "$#" -lt 1 ] ; then
echo "Usage: $0 <codename>" >&2
exit 1
fi
# repository/codename that should be added
REPOS="$1"
if [ -z "${REPOSITORY:-}" ] ; then
REPOSITORY='/srv/repository'
echo "*** Repository variable REPOSITORY is unset, using default [$REPOSITORY] ***"
fi
sudo mkdir -p "${REPOSITORY}"/conf || true
sudo chown $(id -un) "${REPOSITORY}"/conf || true
touch "${REPOSITORY}"/conf/distributions
if [ -r /etc/jenkins/debian_glue ] ; then
echo "*** Sourcing /etc/jenkins/debian_glue ***"
. /etc/jenkins/debian_glue
fi
# support setting key id
if [ -z "${KEY_ID:-}" ] ; then
echo "*** WARNING: No KEY_ID found, can not sign repository. ***"
echo "*** Generate a key executing 'gpg --gen-key' as user root"
echo "*** and then set up /etc/jenkins/debian_glue, see"
echo "*** /usr/share/jenkins-debian-glue/examples/debian_glue"
fi
if grep -q "^Codename: ${REPOS}$" "${REPOSITORY}"/conf/distributions ; then
echo "Codename/repository $REPOS exists already, ignoring request to add again."
exit 0
fi
cat >> "${REPOSITORY}"/conf/distributions << EOF
Codename: ${REPOS}
AlsoAcceptFor: unstable
Architectures: amd64 i386 source
Components: main
DebIndices: Packages Release . .gz
DscIndices: Sources Release .gz
Tracking: minimal
EOF
if [ -n "${KEY_ID:-}" ] ; then
echo "*** Signing repository with Key ID $KEY_ID ***"
printf "SignWith: ${KEY_ID}\n\n" >> "${REPOSITORY}"/conf/distributions
fi
echo "Added $REPOS as new codename/repos to the reprepro configuration."