diff options
author | L. Bradley LaBoon | 2015-12-07 12:01:38 -0500 |
---|---|---|
committer | L. Bradley LaBoon | 2015-12-07 12:01:38 -0500 |
commit | b166ffbfd1430c2dc899de646b3c0949c48305ac (patch) | |
tree | 475254a8e14f02562c3e45a8a0d50ddc5c0949cc | |
download | aur-b166ffbfd1430c2dc899de646b3c0949c48305ac.tar.gz |
Version 6.3.1
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | PKGBUILD | 25 | ||||
-rw-r--r-- | splunk.install | 142 | ||||
-rw-r--r-- | splunk.service | 16 |
4 files changed, 200 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..07d143dddc34 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +# Generated by mksrcinfo v8 +# Mon Dec 7 16:58:48 UTC 2015 +pkgbase = splunk + pkgdesc = Statistical analysis and search tool for logs and machine data + pkgver = 6.3.1_f3e41e4b37b2 + pkgrel = 1 + url = http://www.splunk.com/ + install = splunk.install + arch = x86_64 + license = custom + source = http://download.splunk.com/products/splunk/releases/6.3.1/splunk/linux/splunk-6.3.1-f3e41e4b37b2-Linux-.tgz + source = splunk.service + sha256sums = a02376ff094c4095d955c15841899e3eb238e6a3316a613c037acc3da4f525ef + sha256sums = ca96b85750a0592208facc747bbe1eb22b0a35b6dee841e6f51f1ad6a9157757 + +pkgname = splunk + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..02fa6968f42a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,25 @@ +# Maintainer: L. Bradley LaBoon <me@bradleylaboon.com> +pkgname=splunk +pkgver=6.3.1_f3e41e4b37b2 +pkgrel=1 +pkgdesc="Statistical analysis and search tool for logs and machine data" +url="http://www.splunk.com/" +arch=('x86_64') +license=('custom') +install="$pkgname.install" +source=( + "http://download.splunk.com/products/splunk/releases/6.3.1/splunk/linux/$pkgname-${pkgver//_/-}-Linux-$CARCH.tgz" + "$pkgname.service" +) +sha256sums=( + 'a02376ff094c4095d955c15841899e3eb238e6a3316a613c037acc3da4f525ef' + 'ca96b85750a0592208facc747bbe1eb22b0a35b6dee841e6f51f1ad6a9157757' +) + +package() { + cd "$srcdir" + install -Dm644 "$pkgname/license-eula.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm644 "$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service" + mkdir "$pkgdir/opt" + cp -r "$pkgname" "$pkgdir/opt/" +} diff --git a/splunk.install b/splunk.install new file mode 100644 index 000000000000..c385869e97ea --- /dev/null +++ b/splunk.install @@ -0,0 +1,142 @@ +pre_install() { + SPLUNK_HOME="/opt/splunk" + + group_exists=no + # Try to test for group existence in a 'modern' fashion + if which getent >/dev/null; then + if getent group splunk >/dev/null; then + group_exists=yes + fi + # or fall back + elif grep '^splunk:' /etc/group >/dev/null; then + group_exists=yes + fi + + if [ "${group_exists}"x = nox ]; then + groupadd splunk + fi + if id splunk > /dev/null 2>&1; then + : #user already exists + else + useradd -c "Splunk Server" -d $SPLUNK_HOME -s /bin/bash -g splunk splunk + fi +} + +post_install() { + SPLUNK_HOME="/opt/splunk" + + if [ ! -f "$SPLUNK_HOME/etc/splunk-launch.conf" ]; then + sed "s%# SPLUNK_HOME=.*%SPLUNK_HOME=$SPLUNK_HOME%g" "$SPLUNK_HOME/etc/splunk-launch.conf.default" > "$SPLUNK_HOME/etc/splunk-launch.conf" + fi + + # Build the post-install message in steps: + touch "$SPLUNK_HOME/ftr" + echo "-------------------------------------------------------------------------" > "$SPLUNK_HOME/ftr" + echo "Splunk has been installed in:" >> "$SPLUNK_HOME/ftr" + echo " $SPLUNK_HOME" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "To start Splunk, run the command:" >> "$SPLUNK_HOME/ftr" + echo " $SPLUNK_HOME/bin/splunk start" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "To use the Splunk web interface, point your browser to:" >> "$SPLUNK_HOME/ftr" + echo " http://$HOSTNAME:8000" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "Complete documentation is at http://docs.splunk.com/Documentation/Splunk" >> "$SPLUNK_HOME/ftr" + echo "-------------------------------------------------------------------------" >> "$SPLUNK_HOME/ftr" + + echo "Splunk has been installed to $SPLUNK_HOME" + echo "You can start Splunk by running 'systemctl start splunk'" + + chown -R splunk:splunk "$SPLUNK_HOME" +} + +pre_upgrade() { + SPLUNK_HOME="/opt/splunk" + echo "Attempting to stop the installed Splunk Server..." + $SPLUNK_HOME/bin/splunk stop + systemctl stop splunk + + group_exists=no + # Try to test for group existence in a 'modern' fashion + if which getent >/dev/null; then + if getent group splunk >/dev/null; then + group_exists=yes + fi + # or fall back + elif grep '^splunk:' /etc/group >/dev/null; then + group_exists=yes + fi + + if [ "${group_exists}"x = nox ]; then + groupadd splunk + fi + if id splunk > /dev/null 2>&1; then + : #user already exists + else + useradd -c "Splunk Server" -d $SPLUNK_HOME -s /bin/bash -g splunk splunk + fi +} + +post_upgrade() { + SPLUNK_HOME="/opt/splunk" + + # Build the post-upgrade message in steps: + touch "$SPLUNK_HOME/ftr" + echo "-------------------------------------------------------------------------" > "$SPLUNK_HOME/ftr" + echo "Splunk has been updated in:" >> "$SPLUNK_HOME/ftr" + echo " $SPLUNK_HOME" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "To start Splunk, run the command:" >> "$SPLUNK_HOME/ftr" + echo " $SPLUNK_HOME/bin/splunk start" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "To use the Splunk web interface, point your browser to:" >> "$SPLUNK_HOME/ftr" + echo " http://$HOSTNAME:8000" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "" >> "$SPLUNK_HOME/ftr" + echo "Complete documentation is at http://docs.splunk.com/Documentation/Splunk" >> "$SPLUNK_HOME/ftr" + echo "-------------------------------------------------------------------------" >> "$SPLUNK_HOME/ftr" + + echo "Splunk has been upgraded in $SPLUNK_HOME" + echo "Run 'systemctl start splunk' to complete the upgrade." + + chown -R splunk:splunk "$SPLUNK_HOME" +} + +pre_remove() { + SPLUNK_HOME="/opt/splunk" + echo "Attempting to stop the installed Splunk Server..." + $SPLUNK_HOME/bin/splunk stop + systemctl stop splunk +} + +post_remove() { + SPLUNK_HOME="/opt/splunk" + + # Remove any remaining files + rm -rf $SPLUNK_HOME + + # Remove splunk user/group if there are no other splunk packages + if [ `pacman -Q | grep splunk | wc -l` -eq 1 ]; then + if id splunk > /dev/null 2>&1; then + userdel -r splunk + fi + + group_exists=no + # Try to test for group existence in a 'modern' fashion + if which getent >/dev/null; then + if getent group splunk >/dev/null; then + group_exists=yes + fi + # or fall back + elif grep '^splunk:' /etc/group >/dev/null; then + group_exists=yes + fi + + if [ "${group_exists}"x = yesx ]; then + groupdel splunk + fi + fi +} diff --git a/splunk.service b/splunk.service new file mode 100644 index 000000000000..1fc48936624e --- /dev/null +++ b/splunk.service @@ -0,0 +1,16 @@ +[Unit] +Description=Splunk +Wants=network.target +After=network.target + +[Service] +Type=forking +RemainAfterExit=yes +User=splunk +ExecStart=/opt/splunk/bin/splunk start --answer-yes --no-prompt --accept-license +ExecStop=/opt/splunk/bin/splunk stop +ExecReload=/opt/splunk/bin/splunk restart +StandardOutput=syslog + +[Install] +WantedBy=multi-user.target |