summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-10-30 14:36:00 -0700
committerTim Smith <tsmith@chef.io>2018-10-31 12:39:33 -0700
commit4d9242a362404c84b141fbfb65d954e136cf4736 (patch)
treee4a353594ba7faf80b2bd84379a13006fc7ff6bd
parent36b8f51ad6a745647a999c6ec5d5ebd721c11c6b (diff)
downloadchef-4d9242a362404c84b141fbfb65d954e136cf4736.tar.gz
Fix testing / installing on SLES 15
Make sure we identify SLES 15 as suse for our zypper tests Make sure we don't remove the symlinks on SLES when doing an upgrade or the new release will be broken Signed-off-by: Tim Smith <tsmith@chef.io>
-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..7789e7f221 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
+ source /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..7789e7f221 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
+ source /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..7789e7f221 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
+ source /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 6ae052ba1d..5ae9c01722 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -220,7 +220,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?