1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
#!/bin/sh
set -e
set -x
#################################
# AUTOMATICALLY DETECT ENV HERE #
#################################
if ! [ -r /etc/pkgos/pkgos.conf ] ; then
echo "Could not read /etc/pkgos/pkgos.conf"
exit 1
else
. /etc/pkgos/pkgos.conf
fi
detect_env () {
DEB_RELEASE=`lsb_release -a | grep Codename: | awk '{print $2}'`
DEB_RELEASE_NUM=`lsb_release -a | grep Release: | awk '{print $2}'`
DEB_DIST_TYPE=$(lsb_release -a | grep "Distributor ID:" | awk '{print $3}')
APT="apt-get install -y"
echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/80norecommends
}
build_ostack_archive_keyring_package () {
# # Export the jenkins GPG key as pubkey.gpg in debian/dists/pubkey.gpg
# mkdir -p ${REPO_ROOT}/debian/dists
# chown -R ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian/dists
# chown ${THE_DEV_USER}:${THE_DEV_USER} ${REPO_ROOT}/debian
# su ${THE_DEV_USER} -c "gpg --export -a ${THE_DEV_USER}" >${REPO_ROOT}/debian/dists/pubkey.gpg
# Create a Debian package out of it, called openstack-debian-archive-keyring
# and put it in the newly created Debian repository.
# Yes, a working, Debian-policy-compliant package is really only a few lines of shell... :)
TMPDIR=`mktemp -d`
MYCWD=`pwd`
cd ${TMPDIR}
VER=0.1
NAME=openstack-backports-archive-keyring
rm -rf ${NAME}-${VER}
mkdir -p ${NAME}-${VER}/debian/source
cd ${NAME}-${VER}
export DEBFULLNAME="Autogenerated key"
export DEBEMAIL="${THE_DEV_USER}@${HOST_FQDN}"
dch --create --package ${NAME} -D unstable --noquery --newversion 0.1 -m "Automatic archive package build."
sed -i 's/MAINTAINER <EMAIL>/Autogenerated key <'${THE_DEV_USER}'@'${HOST_FQDN}'>/' debian/changelog
echo "3.0 (native)" >debian/source/format
echo 9 >debian/compat
echo "#!/usr/bin/make -f
%:
dh \$@
" >debian/rules
echo "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ${NAME}
Source: See the openstack-pkg-tools package
Files: *
Copyright: (c) 2015, Thomas Goirand <zigo@debian.org>
License: Apache-2
Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in /usr/share/common-licenses/Apache-2.0.
" >debian/copyright
echo "Source: ${NAME}
Section: net
Priority: extra
Maintainer: PKG OpenStack <openstack-devel@lists.alioth.debian.org>
Uploaders: Thomas Goirand <zigo@debian.org>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.6
Package: ${NAME}
Architecture: all
Depends: gnupg, \${misc:Depends}
Description: OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
OpenStack ${TARGET_OPENSTACK_REL} ${TARGET_DISTRO} archive keyring
">debian/control
#su ${THE_DEV_USER} -c "gpg --export -a ${THE_DEV_USER}" >pubkey.gpg
gpg --export -a >pubkey.gpg
echo "pubkey.gpg /usr/share/${NAME}" >debian/${NAME}.install
echo "#!/bin/sh
set -e
if [ \"\$1\" = \"configure\" ] || [ \"\$1\" = \"reconfigure\" ] ; then
apt-key add /usr/share/${NAME}/pubkey.gpg
fi
#DEBHELPER#
exit 0
" >debian/${NAME}.postinst
#chown -R ${THE_DEV_USER}:${THE_DEV_USER} .
#su ${THE_DEV_USER} -c dpkg-buildpackage || true
dpkg-buildpackage
FIRST_LETTER=`echo ${NAME} | awk '{print substr($0,0,2)}'`
cd ..
MYDEST=${REPO_ROOT}/debian/pool/${REPO_DEST}/main/${FIRST_LETTER}/${NAME}
MYDEST2=${REPO_ROOT}/debian/pool/${REPO_NOCHANGE_BACKPORT_DEST}/main/${FIRST_LETTER}/${NAME}
for i in ${MYDEST} ${MYDEST2} ; do
mkdir -p ${i}
cp *.changes *.tar.xz *.deb *.dsc ${i}
done
cd ${MYCWD}
rm -r ${TMPDIR}
}
HOST_FQDN=`hostname --fqdn`
THE_DEV_USER=jenkins
build_ostack_archive_keyring_package
|