From 88d9bdc5b28ac9fb7a4d36f59aa47ea2c5046659 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Mon, 22 Aug 2022 19:22:23 +0900 Subject: [PATCH] install.sh: add --without-systemd option Since we fail to write files to $USER/.config on Jenkins jobs, we need an option to skip installing systemd units. Let's add --without-systemd to do that. Also, to detect the option availability, we need to increment relocatable package version. See scylladb/scylla-dtest#2819 --- install.sh | 22 ++++++++++++++++------ scripts/create-relocatable-package.py | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index bae587c..9b12e14 100755 --- a/install.sh +++ b/install.sh @@ -32,6 +32,7 @@ Options: --nonroot shortcut of '--disttype nonroot' --sysconfdir /etc/sysconfig specify sysconfig directory name --packaging use install.sh for packaging + --without-systemd skip installing systemd units --help this helpful message EOF exit 1 @@ -41,6 +42,7 @@ root=/ sysconfdir=/etc/sysconfig nonroot=false packaging=false +without_systemd=false while [ $# -gt 0 ]; do case "$1" in @@ -64,6 +66,10 @@ while [ $# -gt 0 ]; do packaging=true shift 1 ;; + "--without-systemd") + without_systemd=true + shift 1 + ;; "--help") shift 1 print_usage @@ -114,12 +120,16 @@ else fi install -d -m755 "$rsysconfdir" -install -d -m755 "$rsystemd" +if ! $without_systemd; then + install -d -m755 "$rsystemd" +fi install -d -m755 "$rprefix/scripts" "$rprefix/jmx" "$rprefix/jmx/symlinks" install -m644 dist/common/sysconfig/scylla-jmx -Dt "$rsysconfdir" -install -m644 dist/common/systemd/scylla-jmx.service -Dt "$rsystemd" -if ! $nonroot; then +if ! $without_systemd; then + install -m644 dist/common/systemd/scylla-jmx.service -Dt "$rsystemd" +fi +if ! $nonroot && ! $without_systemd; then if [ "$sysconfdir" != "/etc/sysconfig" ]; then install -d -m755 "$retc"/systemd/system/scylla-jmx.service.d cat << EOS > "$retc"/systemd/system/scylla-jmx.service.d/sysconfdir.conf @@ -128,7 +138,7 @@ EnvironmentFile= EnvironmentFile=$sysconfdir/scylla-jmx EOS fi -else +elif ! $without_systemd; then install -d -m755 "$rsystemd"/scylla-jmx.service.d cat << EOS > "$rsystemd"/scylla-jmx.service.d/nonroot.conf [Service] @@ -156,10 +166,10 @@ if $nonroot; then sed -i -e "s#/var/lib/scylla#$rprefix#g" "$rsysconfdir"/scylla-jmx sed -i -e "s#/etc/scylla#$rprefix/etc/scylla#g" "$rsysconfdir"/scylla-jmx sed -i -e "s#/opt/scylladb/jmx#$rprefix/jmx#g" "$rsysconfdir"/scylla-jmx - if check_usermode_support; then + if ! $without_systemd && check_usermode_support; then systemctl --user daemon-reload fi echo "Scylla-JMX non-root install completed." -elif ! $packaging; then +elif ! $without_systemd && ! $packaging; then systemctl --system daemon-reload fi diff --git a/scripts/create-relocatable-package.py b/scripts/create-relocatable-package.py index e07962e..182570f 100755 --- a/scripts/create-relocatable-package.py +++ b/scripts/create-relocatable-package.py @@ -45,9 +45,9 @@ args = ap.parse_args() output = args.dest ar = tarfile.open(output, mode='w|gz') -# relocatable package format version = 2 +# relocatable package format version = 2.2 with open('build/.relocatable_package_version', 'w') as f: - f.write('2\n') + f.write('2.2\n') ar.add('build/.relocatable_package_version', arcname='.relocatable_package_version') pathlib.Path('build/SCYLLA-RELOCATABLE-FILE').touch()