diff options
author | L. Bradley LaBoon | 2021-06-25 17:35:46 -0400 |
---|---|---|
committer | L. Bradley LaBoon | 2021-06-25 17:35:46 -0400 |
commit | d7d4b264251dbbc56251ab6eb4a570cb8106122b (patch) | |
tree | 6ba5b6a6ae4636f2580f7572902c22cce6e0652f /splunk.install | |
parent | f1ad9d2ed812ba3dfad5896b3364f4153e24e2c5 (diff) | |
download | aur-d7d4b264251dbbc56251ab6eb4a570cb8106122b.tar.gz |
Updated to 8.2.1. Changed to use sysusers and tmpfiles
Diffstat (limited to 'splunk.install')
-rw-r--r-- | splunk.install | 79 |
1 files changed, 3 insertions, 76 deletions
diff --git a/splunk.install b/splunk.install index 0165a5f69d57..5a7dfa9459b0 100644 --- a/splunk.install +++ b/splunk.install @@ -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 -} |