summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordian Edenhofer2015-08-21 13:28:13 +0200
committerGordian Edenhofer2015-08-21 13:28:13 +0200
commit1067ac9ed75db948daca9ca50355bdc2132ad981 (patch)
tree0e44b1e014c69e36d54a498aa8c827c8703bce3a
downloadaur-1067ac9ed75db948daca9ca50355bdc2132ad981.tar.gz
Initial commit
-rw-r--r--.SRCINFO23
-rw-r--r--PKGBUILD57
-rw-r--r--arch_munge.init49
-rw-r--r--munge-git.install77
4 files changed, 206 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..519c8a1b989f
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = munge-git
+ pkgdesc = An authentication service for creating and validating credentials. It is designed to be highly scalable for use in an HPC cluster environment.
+ pkgver = 1013.9bdf618
+ pkgrel = 1
+ url = https://github.com/dun/munge/wiki
+ install = munge-git.install
+ arch = i686
+ arch = x86_64
+ license = GPL3
+ license = LGPL3
+ makedepends = git
+ depends = openssl
+ optdepends = zlib: zlib compression support
+ optdepends = bzip2: bzip2 compression support
+ provides = munge
+ conflicts = munge
+ source = munge-git::git+https://github.com/dun/munge.git
+ source = arch_munge.init
+ md5sums = SKIP
+ md5sums = 668942f323275199d35db5a534d9a80e
+
+pkgname = munge-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..172cf364e718
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Gordian Edenhofer <gordian.edenhofer[at]yahoo[dot]de>
+
+pkgname=munge-git
+pkgver=1013.9bdf618
+pkgrel=1
+pkgdesc="An authentication service for creating and validating credentials. It is designed to be highly scalable for use in an HPC cluster environment."
+arch=('i686' 'x86_64')
+url="https://github.com/dun/munge/wiki"
+license=('GPL3' 'LGPL3')
+depends=('openssl')
+optdepends=("zlib: zlib compression support"
+ "bzip2: bzip2 compression support")
+makedepends=('git')
+provides=('munge')
+conflicts=('munge')
+install=$pkgname.install
+source=("${pkgname}"::"git+https://github.com/dun/munge.git"
+ "arch_munge.init")
+md5sums=('SKIP'
+ '668942f323275199d35db5a534d9a80e')
+
+pkgver() {
+ cd "${srcdir}/${pkgname}"
+ echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
+}
+
+build() {
+ cd "${srcdir}/${pkgname}"
+
+ ./configure \
+ --prefix=/usr \
+ --sbindir=/usr/bin \
+ --localstatedir=/var \
+ --sysconfdir=/etc
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}"
+
+ make DESTDIR="$pkgdir" install
+
+ # install arch specific munge init and remove original one...
+ rm -f $pkgdir/etc/init.d/munge
+ rmdir $pkgdir/etc/init.d
+
+ install -D -m755 ../arch_munge.init $pkgdir/etc/rc.d/munge
+
+ # /usr/sbin is deprecated in arch, hence using /usr/bin
+ sed -i 's/\/usr\/sbin/\/usr\/bin/g' $pkgdir/usr/lib/systemd/system/munge.service
+
+ # /var/run/munge will be created in post install, see munge.install
+ # because it is bad practice to put package-files in /run
+ rmdir $pkgdir/var/run/munge
+ rmdir $pkgdir/var/run
+}
diff --git a/arch_munge.init b/arch_munge.init
new file mode 100644
index 000000000000..5252a2d600df
--- /dev/null
+++ b/arch_munge.init
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+daemon_name=munge
+USER=munge
+[ -x /etc/default/munge ] && . /etc/default/munge
+
+PID=`pidof -o %PPID /usr/bin/munged`
+case "$1" in
+ start)
+ stat_busy "Starting MUNGE daemon"
+ VARRUNDIR="/run/munge"
+ if [ ! -d "$VARRUNDIR" ]; then
+ mkdir -m 755 -p "$VARRUNDIR"
+ [ -n "$USER" ] && chown "$USER" "$VARRUNDIR"
+ fi
+ [ -z "$PID" ] && su "$USER" -c /usr/bin/munged "$DAEMON_ARGS" 2>&1
+ if [ $? -gt 0 ] ; then
+ stat_fail
+ else
+ add_daemon $daemon_name # create the 'state' dir
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MUNGE daemon"
+ [ "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon $daemon_name # remove the 'state' dir
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 5
+ $0 start
+ ;;
+ status)
+ stat_busy "Checking MUNGE status"
+ ck_status $daemon_name
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+exit 0
diff --git a/munge-git.install b/munge-git.install
new file mode 100644
index 000000000000..c5b7afca8fdb
--- /dev/null
+++ b/munge-git.install
@@ -0,0 +1,77 @@
+post_install() {
+ # the installation process is described at https://code.google.com/p/munge/wiki/InstallationGuide
+ # create munge /var/run/munge dir
+ mkdir -p /var/run/munge
+
+ # add munge user/group
+ echo -e "\e[34;1m==>\e[39;1m Adding munge system group... \e[0m"
+ groupadd -r munge
+
+ echo -e "\e[34;1m==>\e[39;1m Adding munge system user... \e[0m"
+ useradd -r -c "Munge Daemon" -d /var/log/munge -g munge munge
+
+ echo -e "\e[34;1m==>\e[39;1m Locking Munge User Account... \e[0m"
+ passwd -l munge &>/dev/null
+
+ # create munge key
+ if [ ! -e /etc/munge/munge.key ] && [ -c /dev/urandom ]; then
+ echo -e "\e[34;1m==>\e[39;1m Creating random munge key : /etc/munge/munge.key\e[0m"
+ dd if=/dev/urandom bs=1 count=1024 of=/etc/munge/munge.key
+ chmod 0400 /etc/munge/munge.key
+ else
+ if [ -c /dev/urandom ]; then
+ echo -e "\e[34;1m==>\e[39;1m INFO: no munge key is generated since /etc/munge/munge.key already exists \e[0m"
+ else
+ echo -e "\e[34;1m==>\e[39;1m WARNING: did not create /etc/munge/munge.key since /dev/urandom is not found \e[0m"
+ fi
+ fi
+
+ # set permissions
+ chown munge:munge -R /etc/munge
+ chown munge:munge -R /var/log/munge
+ chown munge:munge -R /var/lib/munge
+ chown munge:munge -R /var/run/munge
+
+ # securing the installation, this is optional!
+ #chmod 0700 /etc/munge
+ #chmod 0711 /var/lib/munge
+ #chmod 0700 /var/log/munge
+ #chmod 0755 /var/run/munge
+}
+
+post_upgrade() {
+ # set permissions
+ chown munge:munge -R /etc/munge
+ chown munge:munge -R /var/log/munge
+ chown munge:munge -R /var/lib/munge
+ chown munge:munge -R /var/run/munge
+ if [ -e /etc/munge/munge.key ]; then
+ chmod 0400 /etc/munge/munge.key
+ fi
+}
+
+pre_remove() {
+ which systemctl >& /dev/null
+ if [ $? -eq 0 ]; then
+ echo -e "\e[34;1m==>\e[39;1m Stopping munge using SystemD... \e[0m"
+ systemctl stop munge
+
+ echo -e "\e[34;1m==>\e[39;1m Disabling SystemD related file(s)... \e[0m"
+ systemctl disable munge.service
+ else
+ echo -e "\e[34;1m==>\e[39;1m Stopping munge... "
+ /etc/rc.d/munge stop
+ fi
+}
+
+post_remove() {
+ # Removing obsolete dir
+ rm -rf /var/run/munge
+
+ # Notifying the user of kept dirs and change owner
+ [ -d /etc/munge ] && chown root:root -R /etc/munge && echo -e "\e[34;1m==>\e[39;1m NOTE: Custom configuration-file(s) in /etc/munge/ were kept on your system.\e[0m"
+ [ -d /var/log/munge ] && chown root:root -R /var/log/munge && echo -e "\e[34;1m==>\e[39;1m NOTE: Logfiles were preserved. They reside under /var/log/munge .\e[0m"
+
+ echo -e "\e[34;1m==>\e[39;1m Removing the munge user and group from the system... \e[0m"
+ userdel munge
+}