summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-31 15:18:50 -0700
committerGitHub <noreply@github.com>2018-10-31 15:18:50 -0700
commita1c0c933ef2117bfff8bba82add42b92b2df05c7 (patch)
treecc9eceab9736e4d1ec7bfc3b38c91fdf69693537
parent8d05f229f2aa93c58e71f785d437c03f6fc740eb (diff)
parent8d89528c6e667dda012261768a1711d42035c851 (diff)
downloadchef-a1c0c933ef2117bfff8bba82add42b92b2df05c7.tar.gz
Merge pull request #7835 from chef/SLES_15_on_13
Backport: Don't remove package symlinks when upgrading Chef on SLES 15
-rwxr-xr-xomnibus/package-scripts/angrychef/postrm14
-rwxr-xr-xomnibus/package-scripts/chef-fips/postrm14
-rwxr-xr-xomnibus/package-scripts/chef/postrm14
-rw-r--r--spec/support/platform_helpers.rb3
4 files changed, 35 insertions, 10 deletions
diff --git a/omnibus/package-scripts/angrychef/postrm b/omnibus/package-scripts/angrychef/postrm
index 247688074e..a153da7102 100755
--- a/omnibus/package-scripts/angrychef/postrm
+++ b/omnibus/package-scripts/angrychef/postrm
@@ -11,11 +11,19 @@ is_smartos() {
uname -v | grep "^joyent" 2>&1 >/dev/null
}
-is_darwin()
-{
+is_darwin() {
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
+is_suse() {
+ if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ [ "$ID_LIKE" = "sles" ] || [ "$ID_LIKE" = "suse" ]
+ else
+ [ -f /etc/SuSE-release ]
+ fi
+}
+
if is_smartos; then
PREFIX="/opt/local"
elif is_darwin; then
@@ -33,7 +41,7 @@ cleanup_symlinks() {
# Clean up binary symlinks if they exist
# see: http://tickets.opscode.com/browse/CHEF-3022
-if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! -f /etc/SuSE-release ]; then
+if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! is_suse ]; then
# not a redhat-ish RPM-based system
cleanup_symlinks
elif [ "x$1" = "x0" ]; then
diff --git a/omnibus/package-scripts/chef-fips/postrm b/omnibus/package-scripts/chef-fips/postrm
index 247688074e..a153da7102 100755
--- a/omnibus/package-scripts/chef-fips/postrm
+++ b/omnibus/package-scripts/chef-fips/postrm
@@ -11,11 +11,19 @@ is_smartos() {
uname -v | grep "^joyent" 2>&1 >/dev/null
}
-is_darwin()
-{
+is_darwin() {
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
+is_suse() {
+ if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ [ "$ID_LIKE" = "sles" ] || [ "$ID_LIKE" = "suse" ]
+ else
+ [ -f /etc/SuSE-release ]
+ fi
+}
+
if is_smartos; then
PREFIX="/opt/local"
elif is_darwin; then
@@ -33,7 +41,7 @@ cleanup_symlinks() {
# Clean up binary symlinks if they exist
# see: http://tickets.opscode.com/browse/CHEF-3022
-if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! -f /etc/SuSE-release ]; then
+if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! is_suse ]; then
# not a redhat-ish RPM-based system
cleanup_symlinks
elif [ "x$1" = "x0" ]; then
diff --git a/omnibus/package-scripts/chef/postrm b/omnibus/package-scripts/chef/postrm
index 247688074e..a153da7102 100755
--- a/omnibus/package-scripts/chef/postrm
+++ b/omnibus/package-scripts/chef/postrm
@@ -11,11 +11,19 @@ is_smartos() {
uname -v | grep "^joyent" 2>&1 >/dev/null
}
-is_darwin()
-{
+is_darwin() {
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
+is_suse() {
+ if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ [ "$ID_LIKE" = "sles" ] || [ "$ID_LIKE" = "suse" ]
+ else
+ [ -f /etc/SuSE-release ]
+ fi
+}
+
if is_smartos; then
PREFIX="/opt/local"
elif is_darwin; then
@@ -33,7 +41,7 @@ cleanup_symlinks() {
# Clean up binary symlinks if they exist
# see: http://tickets.opscode.com/browse/CHEF-3022
-if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! -f /etc/SuSE-release ]; then
+if [ ! -f /etc/redhat-release -a ! -f /etc/fedora-release -a ! -f /etc/system-release -a ! is_suse ]; then
# not a redhat-ish RPM-based system
cleanup_symlinks
elif [ "x$1" = "x0" ]; then
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 3cc8778f7a..4f16394d34 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -205,7 +205,8 @@ def selinux_enabled?
end
def suse?
- File.exists?("/etc/SuSE-release")
+ ::File.exists?("/etc/SuSE-release") ||
+ ( ::File.exists?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
end
def root?