mirror of
https://github.com/archlinux/aur.git
synced 2026-03-14 23:16:48 +01:00
Updated to 8.2.1. Changed to use sysusers and tmpfiles
This commit is contained in:
parent
f1ad9d2ed8
commit
d7d4b26425
4 changed files with 15 additions and 81 deletions
14
PKGBUILD
14
PKGBUILD
|
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: L. Bradley LaBoon <me@bradleylaboon.com>
|
||||
pkgname=splunk
|
||||
basever=8.2.0
|
||||
splunkver=${basever}-e053ef3c985f
|
||||
basever=8.2.1
|
||||
splunkver=${basever}-ddff1c41e5cf
|
||||
# Splunk is inconsistent with the length of their version numbers
|
||||
if [ ${#basever} -gt 5 ]; then
|
||||
pkgver=${basever}
|
||||
|
|
@ -15,14 +15,18 @@ url="https://www.splunk.com/"
|
|||
arch=('x86_64')
|
||||
license=('custom')
|
||||
install="$pkgname.install"
|
||||
source=("$pkgname.service")
|
||||
source=("$pkgname.service" "$pkgname.sysusers" "$pkgname.tmpfiles")
|
||||
source_x86_64=("https://download.splunk.com/products/splunk/releases/$basever/linux/$pkgname-$splunkver-Linux-x86_64.tgz")
|
||||
sha256sums=('ca96b85750a0592208facc747bbe1eb22b0a35b6dee841e6f51f1ad6a9157757')
|
||||
sha256sums_x86_64=('868ac331aee0a3437a85cd57604bace201c4ad77c68ee1bbde0cc90fe3f0b717')
|
||||
sha256sums=('ca96b85750a0592208facc747bbe1eb22b0a35b6dee841e6f51f1ad6a9157757'
|
||||
'236deb352218f9551df894efd613aad201afb20713ac563ab381f68b6ffce853'
|
||||
'56b70a2395270fc038987241504df11c390f3234d5be640bbc6a311b978e8475')
|
||||
sha256sums_x86_64=('665485ddf65d115f0787f8b0df70ba7fc6fb325b7fa58cdbd3149e2dc7572c04')
|
||||
options=(!strip)
|
||||
|
||||
package() {
|
||||
cd "$srcdir"
|
||||
install -vDm 644 ${pkgname}.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
|
||||
install -vDm 644 ${pkgname}.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -1,32 +1,10 @@
|
|||
SPLUNK_HOME="/opt/splunk"
|
||||
|
||||
pre_install() {
|
||||
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() {
|
||||
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"
|
||||
|
|
@ -43,37 +21,15 @@ post_install() {
|
|||
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() {
|
||||
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() {
|
||||
|
|
@ -93,11 +49,9 @@ post_upgrade() {
|
|||
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() {
|
||||
|
|
@ -105,30 +59,3 @@ pre_remove() {
|
|||
$SPLUNK_HOME/bin/splunk stop
|
||||
systemctl stop splunk
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
# 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
|
||||
}
|
||||
|
|
|
|||
1
splunk.sysusers
Normal file
1
splunk.sysusers
Normal file
|
|
@ -0,0 +1 @@
|
|||
u splunk - "Splunk Server" /opt/splunk /bin/bash
|
||||
2
splunk.tmpfiles
Normal file
2
splunk.tmpfiles
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Z /opt/splunk - splunk splunk
|
||||
z /opt/splunk 0750 splunk splunk
|
||||
Loading…
Add table
Reference in a new issue