aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates/binrepo/upload-bin
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2012-01-08 18:04:14 +0000
committerMichael Scherer <misc@mageia.org>2012-01-08 18:04:14 +0000
commit1403da52f0620a1267d867273adcb8f36d6547e9 (patch)
treec0999f8e4d739a9ad07dd00fb60057a744f77e76 /modules/buildsystem/templates/binrepo/upload-bin
parent761db207f6fecb2f8117919055c72e058ceb8f6f (diff)
downloadpuppet-1403da52f0620a1267d867273adcb8f36d6547e9.tar
puppet-1403da52f0620a1267d867273adcb8f36d6547e9.tar.gz
puppet-1403da52f0620a1267d867273adcb8f36d6547e9.tar.bz2
puppet-1403da52f0620a1267d867273adcb8f36d6547e9.tar.xz
puppet-1403da52f0620a1267d867273adcb8f36d6547e9.zip
fix error in the path ( ie, no 's' )
Diffstat (limited to 'modules/buildsystem/templates/binrepo/upload-bin')
-rwxr-xr-xmodules/buildsystem/templates/binrepo/upload-bin29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/buildsystem/templates/binrepo/upload-bin b/modules/buildsystem/templates/binrepo/upload-bin
new file mode 100755
index 00000000..ef64a1a3
--- /dev/null
+++ b/modules/buildsystem/templates/binrepo/upload-bin
@@ -0,0 +1,29 @@
+#!/bin/sh
+binrepodir=<%= binrepodir %>
+uploadinfosdir=<%= uploadinfosdir %>
+tmpfile=$(mktemp)
+mail_from="<%= uploadmail_from %>"
+mail_dest="<%= uploadmail_to %>"
+
+test $# = 2 || exit 3
+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"
+/bin/chmod 644 "$binrepodir/$sha1sum"
+echo "$username:$comment" > "$uploadinfosdir/$sha1sum"
+echo "User $username uploaded file $sha1sum: $comment"
+
+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
+