summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2019-04-29 17:20:02 +0200
committerKim Hagen <kim.sidney@gmail.com>2019-04-29 17:21:44 +0200
commitb084aaa59bfc979ce54c7a4850885aa644ef7e81 (patch)
tree53b384a2fb3964cdf945807252eb356389baa732
parent6ba1a32a0c4150a48f144fe214527819ea092df9 (diff)
downloadvyos-build-b084aaa59bfc979ce54c7a4850885aa644ef7e81.tar.gz
vyos-build-b084aaa59bfc979ce54c7a4850885aa644ef7e81.zip
add reprepro deploy script
-rw-r--r--docker/Dockerfile1
-rwxr-xr-xdocker/pkg-build.sh55
2 files changed, 56 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index beb88053..eafd6356 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -324,5 +324,6 @@ RUN echo "$(opam env --root=/opt/opam --set-root)" >> /etc/skel/.bashrc
# Cleanup
RUN rm -rf /tmp/*
+COPY pkg-build.sh /usr/local/bin/pkg-build.sh
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/docker/pkg-build.sh b/docker/pkg-build.sh
new file mode 100755
index 00000000..598917a1
--- /dev/null
+++ b/docker/pkg-build.sh
@@ -0,0 +1,55 @@
+if [ -z "$1" ]; then
+ RELEASE=`echo $GIT_BRANCH | sed 's/origin\//* /g' |sed -n 's/^\* \(.*\)$/\1/p'`
+else
+ RELEASE="$1"
+fi
+
+if [ "$RELEASE" == "master" ]; then
+ RELEASE="current"
+fi
+
+if [ -n "$1" ]; then
+ RELEASE="$1"
+fi
+
+ARCH=`dpkg --print-architecture`
+VYOS_REPO_PATH="/home/sentrium/web/dev.packages.vyos.net/public_html/repositories/$RELEASE/vyos/"
+
+exit_code () {
+rc=$?
+if [[ $rc != 0 ]] ; then
+ exit $rc
+fi
+}
+
+echo $RELEASE
+
+ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "bash --login -c 'mkdir -p ~/VyOS/$RELEASE/$ARCH'"
+exit_code
+
+scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ../*.deb khagen@dev.packages.vyos.net:~/VyOS/$RELEASE/$ARCH/
+exit_code
+
+for PACKAGE in `ls ../*.deb`;
+do
+ PACKAGE=`echo $PACKAGE| cut -d'/' -f 2`
+ SUBSTRING=`echo $PACKAGE| cut -d'_' -f 1`
+ if [[ "$PACKAGE" == *_all* ]]; then
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "uncron-add 'reprepro -v -b ${VYOS_REPO_PATH} remove ${RELEASE} ${SUBSTRING}'"
+ exit_code
+ else
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "uncron-add 'reprepro -v -b ${VYOS_REPO_PATH} -A $ARCH remove $RELEASE $SUBSTRING'"
+ exit_code
+ fi
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "uncron-add 'reprepro -v -b ${VYOS_REPO_PATH} deleteunreferenced'"
+ exit_code
+ if [[ "$PACKAGE" == *_all* ]]; then
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "uncron-add 'reprepro -v -b ${VYOS_REPO_PATH} includedeb $RELEASE ~/VyOS/$RELEASE/$ARCH/$PACKAGE'"
+ exit_code
+ else
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no khagen@dev.packages.vyos.net -t "uncron-add 'reprepro -v -b ${VYOS_REPO_PATH} -A $ARCH includedeb $RELEASE ~/VyOS/$RELEASE/$ARCH/$PACKAGE'"
+ exit_code
+ fi
+done
+
+rm -f ../*.deb