Skip to content

Commit bb4108e

Browse files
authored
Install systemd-sysvcompat package on opensuse systems (#109885)
The `systemd-sysv-install` utility is now provided by the `systemd-sysvcompat` package. Ensure it's installed when running packaging tests. Closes #109831
1 parent 1e0b614 commit bb4108e

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.ci/scripts/packaging-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# opensuse 15 has a missing dep for systemd
44

55
if which zypper > /dev/null ; then
6-
sudo zypper install -y insserv-compat
6+
sudo zypper install -y insserv-compat systemd-sysvcompat
77
fi
88

99
if [ -e /etc/sysctl.d/99-gce.conf ]; then

distribution/packages/src/common/scripts/postinst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,9 @@ if [ "$RESTART_ON_UPGRADE" = "true" ]; then
119119
echo " OK"
120120
fi
121121

122+
# For SysV compatibility on systemd systems ensure that all rc*.d directories exist
123+
if [ -x /usr/lib/systemd/systemd-sysv-install ]; then
124+
mkdir -p /etc/init.d/rc{0..6}.d
125+
fi
126+
122127
@scripts.footer@

qa/os/src/test/java/org/elasticsearch/packaging/test/PackageTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void test50Remove() throws Exception {
200200
}
201201

202202
assertThat(sh.runIgnoreExitCode("systemctl status elasticsearch.service").exitCode, is(statusExitCode));
203-
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, is(1));
203+
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, not(0));
204204

205205
}
206206

qa/os/src/test/java/org/elasticsearch/packaging/test/RpmPreservationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import static org.elasticsearch.packaging.util.Packages.verifyPackageInstallation;
3030
import static org.elasticsearch.packaging.util.Platforms.isSystemd;
3131
import static org.elasticsearch.packaging.util.ServerUtils.enableGeoIpDownloader;
32-
import static org.hamcrest.core.Is.is;
32+
import static org.hamcrest.Matchers.not;
3333
import static org.junit.Assume.assumeTrue;
3434

3535
public class RpmPreservationTests extends PackagingTestCase {
@@ -85,7 +85,7 @@ public void test30PreserveConfig() throws Exception {
8585
assertRemoved(distribution());
8686

8787
if (isSystemd()) {
88-
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, is(1));
88+
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, not(0));
8989
}
9090

9191
assertPathsDoNotExist(

0 commit comments

Comments
 (0)