Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17687: All package scripts should be set -e #2323

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions rudder-agent/SPECS/rudder-agent.spec
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ find %{buildroot} -type f -o -type l | sed "s,%{buildroot},," | sed "s,\.py$,\.p
# Pre Installation
#=================================================

set -e

CFRUDDER_FIRST_INSTALL=$1

LOG_DIR="/var/log/rudder/install/"
Expand All @@ -396,6 +398,8 @@ echo "`date` - Starting rudder-agent pre installation script" >> ${LOG_FILE}
# Post Installation
#=================================================

set -e

CFRUDDER_FIRST_INSTALL="false"

if [ $1 -eq 1 ]
Expand All @@ -410,6 +414,8 @@ fi
# Pre Uninstallation
#=================================================

set -e

# Do it during upgrade and uninstall

# Keep a backup copy of uuid.hive
Expand Down Expand Up @@ -446,6 +452,8 @@ fi
# Post Uninstallation
#=================================================

set -e

%if "%{?aix}"
# AIX doesn't have a pidof command, let's define it
function pidof {
Expand Down
2 changes: 2 additions & 0 deletions rudder-reports/SPECS/rudder-reports.spec
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ make --debug install DESTDIR=%{buildroot}
#=================================================
%post -n rudder-reports

set -e

%if 0%{?rhel}
/opt/rudder/share/package-scripts/rudder-reports-postinst true
%else
Expand Down
6 changes: 6 additions & 0 deletions rudder-server-relay/SPECS/rudder-server-relay.spec
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ install -m 644 rudder-relay-apache %{buildroot}/etc/sysconfig/rudder-relay-apach
#=================================================
%post -n rudder-server-relay

set -e

CFRUDDER_FIRST_INSTALL=$1

%if 0%{?rhel}
Expand Down Expand Up @@ -218,13 +220,17 @@ fi
# Pre Uninstallation
#=================================================
# Do it during upgrade and uninstall
set -e

/opt/rudder/share/package-scripts/rudder-server-relay-prerm

#=================================================
# Post Uninstallation
#=================================================
%postun -n rudder-server-relay

set -e

# Do it only during uninstallation
if [ $1 -eq 0 ]; then
# Restart apache since it is still using this user
Expand Down
8 changes: 8 additions & 0 deletions rudder-server-root/SPECS/rudder-server-root.spec
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ make --debug install DESTDIR=%{buildroot}
#=================================================
%pretrans

set -e

# We need to be sure that uuid.hive is set to root at beginning
mkdir -p /opt/rudder/etc
echo 'root' > /opt/rudder/etc/uuid.hive
Expand All @@ -93,6 +95,8 @@ echo "127.0.0.1" > /var/rudder/cfengine-community/policy_server.dat
# Pre Installation
#=================================================

set -e

CFRUDDER_FIRST_INSTALL=$1
LOG_FILE="/var/log/rudder/install/%{name}.log"

Expand All @@ -103,6 +107,8 @@ echo "`date` - Starting %{name} pre installation script" >> ${LOG_FILE}
# Post Installation
#=================================================

set -e

CFRUDDER_FIRST_INSTALL=$1

/opt/rudder/share/package-scripts/rudder-server-root-postinst "${CFRUDDER_FIRST_INSTALL}"
Expand All @@ -112,6 +118,8 @@ CFRUDDER_FIRST_INSTALL=$1
# Post Uninstallation
#=================================================

set -e

# Do it only during uninstallation
if [ $1 -eq 0 ]; then

Expand Down
11 changes: 11 additions & 0 deletions rudder-webapp/SPECS/rudder-webapp.spec
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ make --debug install APACHE_VHOSTDIR=%{apache_vhost_dir} DESTDIR=%{buildroot} JE
# pretrans is run before all preinst when installing more than one package
#=================================================
%pretrans

set -e

# We need to be sure that uuid.hive is set to root at beginning
mkdir -p /opt/rudder/etc
echo 'root' > /opt/rudder/etc/uuid.hive
Expand All @@ -205,6 +208,8 @@ echo "127.0.0.1" > /var/rudder/cfengine-community/policy_server.dat
#=================================================
%pre -n rudder-webapp

set -e

# Only do this on package upgrade
if [ $1 -ne 1 ]
then
Expand Down Expand Up @@ -309,6 +314,8 @@ fi
#=================================================
%postun -n rudder-webapp

set -e

# Do it only during uninstallation
if [ $1 -eq 0 ]; then
%if 0%{?suse_version}
Expand Down Expand Up @@ -354,6 +361,8 @@ fi
#=================================================
%preun -n rudder-webapp

set -e

if [[ $1 -eq 0 ]]
then
systemctl stop rudder-jetty
Expand All @@ -365,6 +374,8 @@ fi
#=================================================
%posttrans -n rudder-webapp

set -e

# during upgrade, service may have been stopped by uninstall of rudder-inventory-ldap or rudder-jetty
systemctl start rudder-slapd >/dev/null
systemctl start rudder-jetty >/dev/null
Expand Down