Skip to content

Commit

Permalink
Merge pull request #55 from it-novum/issue-54
Browse files Browse the repository at this point in the history
Resolve #54
  • Loading branch information
nook24 authored Jun 8, 2021
2 parents 96d9fc1 + 1b310d5 commit 343262d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.3
3.0.5
12 changes: 7 additions & 5 deletions build/package/postinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ set -u
if [ -f /usr/bin/openitcockpit-agent ]; then

if [ -x "$(command -v systemctl)" ]; then
if [ ! -f /lib/systemd/system/openitcockpit-agent.service ]; then
if [ -d /lib/systemd/system/ ]; then
# Debian / Ubuntu / Arch
if [ -d /lib/systemd/system/ ]; then
# Debian / Ubuntu / Arch
if [ ! -f /lib/systemd/system/openitcockpit-agent.service ]; then
ln /etc/openitcockpit-agent/init/openitcockpit-agent.service /lib/systemd/system/openitcockpit-agent.service
elif [ -d /usr/lib/systemd/system/ ]; then
# RedHat / Suse
fi
elif [ -d /usr/lib/systemd/system/ ]; then
# RedHat / Suse
if [ ! -f /usr/lib/systemd/system/openitcockpit-agent.service ]; then
ln /etc/openitcockpit-agent/init/openitcockpit-agent.service /usr/lib/systemd/system/openitcockpit-agent.service
fi
fi
Expand Down
24 changes: 21 additions & 3 deletions build/package/prerm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ if [ -f /usr/bin/openitcockpit-agent ]; then
/bin/systemctl -a | grep openitcockpit-agent >/dev/null
RC=$?
if [ "$RC" -eq 0 ]; then
/bin/systemctl stop openitcockpit-agent
/bin/systemctl disable openitcockpit-agent

if [ "$1" -eq "0" ] || [ "$1" = "purge" ] || [ "$1" = "remove" ] ; then
# Uninstall on CentOS / Debian / Ubuntu
/bin/systemctl stop openitcockpit-agent
/bin/systemctl disable openitcockpit-agent
fi

fi
else
service openitcockpit-agent stop
Expand All @@ -31,7 +36,20 @@ if [ -f /usr/bin/openitcockpit-agent ]; then
fi

fi
rm -f /etc/init.d/openitcockpit-agent /lib/systemd/system/openitcockpit-agent.service /usr/lib/systemd/system/openitcockpit-agent.service /var/log/openitcockpit-agent

if [ "$1" -eq "0" ]; then
# Uninstall on CentOS
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax
# https://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets
rm -f /etc/init.d/openitcockpit-agent /lib/systemd/system/openitcockpit-agent.service /usr/lib/systemd/system/openitcockpit-agent.service /var/log/openitcockpit-agent
fi

if [ "$1" = "purge" ] || [ "$1" = "remove" ] ; then
# Uninstall on Debian / Ubuntu
# https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
rm -f /etc/init.d/openitcockpit-agent /lib/systemd/system/openitcockpit-agent.service /usr/lib/systemd/system/openitcockpit-agent.service /var/log/openitcockpit-agent
fi

set -e

fi
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// AgentVersion as the name says
const AgentVersion = "3.0.3"
const AgentVersion = "3.0.5"

// CustomCheck are external plugins and scripts which should be executed by the Agent
type CustomCheck struct {
Expand Down

0 comments on commit 343262d

Please sign in to comment.