diff options
author | Michael Scherer <misc@mageia.org> | 2012-01-08 17:39:08 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2012-01-08 17:39:08 +0000 |
commit | 761db207f6fecb2f8117919055c72e058ceb8f6f (patch) | |
tree | efda221239f871fa06c641b0d0d4829c0e6b75d7 /modules/buildsystem/templates/binrepos | |
parent | 3e6f60ba018b26a1665a4f8077ab439dc6199503 (diff) | |
download | puppet-761db207f6fecb2f8117919055c72e058ceb8f6f.tar puppet-761db207f6fecb2f8117919055c72e058ceb8f6f.tar.gz puppet-761db207f6fecb2f8117919055c72e058ceb8f6f.tar.bz2 puppet-761db207f6fecb2f8117919055c72e058ceb8f6f.tar.xz puppet-761db207f6fecb2f8117919055c72e058ceb8f6f.zip |
split binrepos in its own file
Diffstat (limited to 'modules/buildsystem/templates/binrepos')
4 files changed, 59 insertions, 0 deletions
diff --git a/modules/buildsystem/templates/binrepos/sudoers.binrepo b/modules/buildsystem/templates/binrepos/sudoers.binrepo new file mode 100644 index 00000000..7a9efef4 --- /dev/null +++ b/modules/buildsystem/templates/binrepos/sudoers.binrepo @@ -0,0 +1 @@ +%<%= packagers_committers_group %> ALL =(<%= binrepo_login %>) NOPASSWD: <%= uploadbinpath %> diff --git a/modules/buildsystem/templates/binrepos/upload-bin b/modules/buildsystem/templates/binrepos/upload-bin new file mode 100755 index 00000000..ef64a1a3 --- /dev/null +++ b/modules/buildsystem/templates/binrepos/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 + diff --git a/modules/buildsystem/templates/binrepos/vhost_binrepo.conf b/modules/buildsystem/templates/binrepos/vhost_binrepo.conf new file mode 100644 index 00000000..8206614f --- /dev/null +++ b/modules/buildsystem/templates/binrepos/vhost_binrepo.conf @@ -0,0 +1,3 @@ +<Directory <%= binrepodir %>> + Options None +</Directory> diff --git a/modules/buildsystem/templates/binrepos/wrapper.upload-bin b/modules/buildsystem/templates/binrepos/wrapper.upload-bin new file mode 100644 index 00000000..4e79e494 --- /dev/null +++ b/modules/buildsystem/templates/binrepos/wrapper.upload-bin @@ -0,0 +1,26 @@ +#!/bin/sh + +binrepouser="<%= binrepo_login %>" +uploadbinpath="<%= uploadbinpath %>" +packagerscommittersgroup="<%= packagers_committers_group %>" + +function isingroup() +{ + grp="$1" + for group in `groups` + do if [ "$grp" = "$group" ] + then + return 0 + fi + done + return 1 +} + +if ! isingroup "$packagerscommittersgroup" +then + echo "You are not in $packagerscommittersgroup group." + exit 1 +fi + +sudo -u "$binrepouser" "$uploadbinpath" $(whoami) $@ + |