]> saetta.ns0.it Git - msys2/commitdiff
Autobuild: aggiunto il file per copiare e aggiungere dei deb.
authorAndrea Zagli <azagli@libero.it>
Sun, 21 May 2017 07:49:17 +0000 (09:49 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 21 May 2017 08:30:43 +0000 (10:30 +0200)
tools/autobuilder/copy_to_repo_debian.sh [new file with mode: 0755]
tools/autobuilder/zak_debian_copy_to_repo_saetta [new file with mode: 0644]

diff --git a/tools/autobuilder/copy_to_repo_debian.sh b/tools/autobuilder/copy_to_repo_debian.sh
new file mode 100755 (executable)
index 0000000..c8c7361
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+CUR=$PWD
+FROM=.
+CMD_COPY_TO_REPO="mkdir -p /opt/debian/repositories/saetta/tmp && cp -f <pkgsfilename> /opt/debian/repositories/saetta/tmp"
+CMD_ADD_TO_REPO="cd /opt/debian/repositories/saetta && reprepro includedeb saetta tmp/*.deb && rm -f tmp/*"
+REPOSITORY=""
+
+while getopts ":f:c:a:r:" opt; do
+       case $opt in
+               f)
+                   FROM=$OPTARG
+                       ;;
+               c)
+                   CMD_COPY_TO_REPO=$OPTARG
+                       ;;
+               a)
+                   CMD_ADD_TO_REPO=$OPTARG
+                       ;;
+               r)
+                   REPOSITORY=$OPTARG
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       exit 1
+                       ;;
+               :)
+                       echo "Option -$OPTARG requires an argument." >&2
+                       exit 1
+                       ;;
+       esac
+done
+
+echo "From: "$FROM
+
+if [ ! -d $FROM ]; then echo $FROM" isn't a directory" && exit 0; fi
+
+cd $FROM
+if [ ! -d "debian" ]; then
+       echo "No debian directory found."
+       exit
+fi
+
+
+# the build directory from debian/gbp.conf
+BUILDDIR=`sed -n -e 's/^\s*export-dir\s*=\s*//p' debian/gbp.conf`
+
+
+SNAPSHOT_HASH=`head -n 1 debian/changelog | sed -n -e 's/.*\((.*)\).*/\1/;s/\((\)\(.*\)\()\)/\2/p'`
+echo "Debian package snapshot version: "$SNAPSHOT_HASH
+
+
+index=0
+while read -r line ; do
+       PKGNAME=$BUILDDIR"/"`echo ${line} | sed -n -e 's/.* \(.*\)/\1/p'`"_"$SNAPSHOT_HASH"_amd64.deb"
+       PKGNAMES[$index]=$PKGNAME
+       ((index++))
+done < <(grep Package debian/control)
+
+
+for i in ${PKGNAMES[@]}; do
+       echo "Debian package name: "$i
+done
+
+
+if [ -e ~/.zak_debian_copy_to_repo$REPOSITORY ]; then . ~/.zak_debian_copy_to_repo$REPOSITORY; fi
+
+CMD_COPY_TO_REPO=${CMD_COPY_TO_REPO/"<pkgsfilename>"/"${PKGNAMES[@]}"}
+CMD_ADD_TO_REPO=${CMD_ADD_TO_REPO/"<pkgsfilename>"/"${PKGNAMES[@]}"}
+
+echo "Command copy to report: "$CMD_COPY_TO_REPO
+echo "Command add to report: "$CMD_ADD_TO_REPO
+
+bash -c "$CMD_COPY_TO_REPO"
+
+bash -c "$CMD_ADD_TO_REPO"
diff --git a/tools/autobuilder/zak_debian_copy_to_repo_saetta b/tools/autobuilder/zak_debian_copy_to_repo_saetta
new file mode 100644 (file)
index 0000000..70cc7ed
--- /dev/null
@@ -0,0 +1,2 @@
+CMD_COPY_TO_REPO="ssh -p 8080 andreaz@saetta.ns0.it -t su -c \\\"mkdir -p /opt/debian/repositories/saetta/tmp \\&\\& chmod o+w /opt/debian/repositories/saetta/tmp\\\" && scp -P 8080 <pkgsfilename> andreaz@saetta.ns0.it:/opt/debian/repositories/saetta/tmp"
+CMD_ADD_TO_REPO="ssh -p 8080 andreaz@saetta.ns0.it -t su -c \\\"cd /opt/debian/repositories/saetta \\&\\& reprepro includedeb saetta tmp/*.deb \\&\\& rm tmp/*\\\""