diff --git a/PKGBUILD b/PKGBUILD index 293484deeebd5..3a859f8f4757e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: L. Bradley LaBoon pkgname=splunkforwarder -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} @@ -16,15 +16,19 @@ arch=('x86_64' 'aarch64') license=('custom') conflicts=('splunk') install="$pkgname.install" -source=("$pkgname.service") +source=("$pkgname.service" "$pkgname.sysusers" "$pkgname.tmpfiles") source_x86_64=("https://download.splunk.com/products/universalforwarder/releases/$basever/linux/$pkgname-$splunkver-Linux-x86_64.tgz") source_aarch64=("https://download.splunk.com/products/universalforwarder/releases/$basever/linux/$pkgname-$splunkver-Linux-armv8.tgz") -sha256sums=('8bd6b2bcf9e9d89d3ab2160c409687313bbee00b7e44b3df3266b44d15a5c152') -sha256sums_x86_64=('edab705b8ef78d8a095bae982a969f4789102f4ecb7848c3b69224276128eac0') -sha256sums_aarch64=('8a817be3a535e1ac60240ba5f17d21fca95d2b0b5dda519ad5abf717f3bd98dc') +sha256sums=('8bd6b2bcf9e9d89d3ab2160c409687313bbee00b7e44b3df3266b44d15a5c152' + '27d1d172add8c64a275ec3356f0fa0b9d56036a7e64b7b882e066a67f6173b5b' + 'bca1b7720a827973f1c959cb78d788324f47dd6fcfc03bf4452c457f2d044db5') +sha256sums_x86_64=('ba66f1011089c59c06dda9bc940ab2006fa3aa149ee095275a24f3263abc524b') +sha256sums_aarch64=('46119d72b55ed6c40d6abd9befe85fbcf1c40e918ab7cf9dac00c226328043a5') 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" diff --git a/splunkforwarder.install b/splunkforwarder.install index 77079751ffb8b..fedde081f4d66 100644 --- a/splunkforwarder.install +++ b/splunkforwarder.install @@ -1,32 +1,10 @@ SPLUNK_HOME="/opt/splunkforwarder" -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 forwarder has been installed to $SPLUNK_HOME" echo "You can start Splunk by running 'systemctl start splunkforwarder'" - - chown -R splunk:splunk "$SPLUNK_HOME" } pre_upgrade() { echo "Attempting to stop the installed Splunk Server..." $SPLUNK_HOME/bin/splunk stop systemctl stop splunkforwarder - - 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 forwarder has been upgraded in $SPLUNK_HOME" echo "Run 'systemctl start splunkforwarder' to complete the upgrade." - - chown -R splunk:splunk "$SPLUNK_HOME" } pre_remove() { @@ -105,26 +59,3 @@ pre_remove() { $SPLUNK_HOME/bin/splunk stop systemctl stop splunkforwarder } - -post_remove() { - 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/splunkforwarder.sysusers b/splunkforwarder.sysusers new file mode 100644 index 0000000000000..ede2d955158c0 --- /dev/null +++ b/splunkforwarder.sysusers @@ -0,0 +1 @@ +u splunk - "Splunk Server" /opt/splunkforwarder /bin/bash diff --git a/splunkforwarder.tmpfiles b/splunkforwarder.tmpfiles new file mode 100644 index 0000000000000..98126c0714332 --- /dev/null +++ b/splunkforwarder.tmpfiles @@ -0,0 +1,2 @@ +Z /opt/splunkforwarder - splunk splunk +z /opt/splunkforwarder 0750 splunk splunk