Version 6.3.1

This commit is contained in:
L. Bradley LaBoon 2015-12-07 12:01:38 -05:00
commit b166ffbfd1
4 changed files with 200 additions and 0 deletions

17
.SRCINFO Normal file
View file

@ -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

25
PKGBUILD Normal file
View file

@ -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/"
}

142
splunk.install Normal file
View file

@ -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
}

16
splunk.service Normal file
View file

@ -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