aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates/upload-bin
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-08-16 22:38:24 +0000
committerNicolas Vigier <boklm@mageia.org>2011-08-16 22:38:24 +0000
commit2a97b90821f2ac84df158dbe5aab4be1410af034 (patch)
tree5ae0e0df0d6d103f3481b153149418fa41b6dace /modules/buildsystem/templates/upload-bin
parent57bd006438f36891b7d7864c423c43a34498789d (diff)
downloadpuppet-2a97b90821f2ac84df158dbe5aab4be1410af034.tar
puppet-2a97b90821f2ac84df158dbe5aab4be1410af034.tar.gz
puppet-2a97b90821f2ac84df158dbe5aab4be1410af034.tar.bz2
puppet-2a97b90821f2ac84df158dbe5aab4be1410af034.tar.xz
puppet-2a97b90821f2ac84df158dbe5aab4be1410af034.zip
add script to upload binrepo files
Diffstat (limited to 'modules/buildsystem/templates/upload-bin')
-rwxr-xr-xmodules/buildsystem/templates/upload-bin26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/buildsystem/templates/upload-bin b/modules/buildsystem/templates/upload-bin
new file mode 100755
index 00000000..30730874
--- /dev/null
+++ b/modules/buildsystem/templates/upload-bin
@@ -0,0 +1,26 @@
+#!/bin/sh
+binrepodir=<%= binrepodir %>
+uploadinfosdir=<%= uploadinfosdir %>
+tmpfile=$(mktemp)
+mail_from="root@mageia.org"
+mail_dest="boklm@mars-attacks.org"
+
+username="$1"
+comment="$2"
+
+/bin/cat > "$tmpfile"
+sha1sum=$(/usr/bin/sha1sum "$tmpfile" | sed 's/ .*$//')
+if [ -f "$binrepodir/$sha1sum" ]
+then
+ echo "File $sha1sum already exists." >&2
+ /bin/rm -f "$tmpfile"
+ exit 2
+fi
+/bin/mv "$tmpfile" "$binrepodir/$sha1sum"
+echo "$username:$comment" > "$uploadinfosdir/$sha1sum"
+echo "User $username uploaded file $sha1sum: $comment"
+
+/usr/bin/mailx -s "New file uploaded: $sha1sum - $comment" -S "from=$username <$mail_from>" "$mail_dest"
+
+exit 0
+