From 5b7125e4a87832f69340d425b89de5fb39692cf1 Mon Sep 17 00:00:00 2001 From: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:58:27 +0800 Subject: [PATCH] fix: no systemd detected (#266) * fix: no systemd detected * format * fix ci for OpenSUSE * drop ci for OpenSUSE since the newer image does not come with the systemd; and the EOL OSes need extra hack to get the script work --- .github/workflows/sh-checker.yml | 6 +----- install-release.sh | 13 +++++-------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sh-checker.yml b/.github/workflows/sh-checker.yml index 2df19f9..909195d 100644 --- a/.github/workflows/sh-checker.yml +++ b/.github/workflows/sh-checker.yml @@ -36,11 +36,7 @@ jobs: sudo bash install-release.sh --check sudo bash install-dat-release.sh - name: Filed-test on Rocky Linux 8.6 - uses: docker://rockylinux:8.6-minimal - with: - args: bash install-release.sh - - name: Filed-test on OpenSUSE 42.1 - uses: docker://opensuse/archive:42.1 + uses: docker://rockylinux:8.6 with: args: bash install-release.sh - name: Filed-test on Arch Linux diff --git a/install-release.sh b/install-release.sh index 72c4077..0313525 100644 --- a/install-release.sh +++ b/install-release.sh @@ -217,7 +217,7 @@ install_software() { } get_current_version() { - if /usr/local/bin/v2ray -version >/dev/null 2>&1;then + if /usr/local/bin/v2ray -version > /dev/null 2>&1; then VERSION="$(/usr/local/bin/v2ray -version | awk 'NR==1 {print $2}')" else VERSION="$(/usr/local/bin/v2ray version | awk 'NR==1 {print $2}')" @@ -380,7 +380,7 @@ install_v2ray() { install_startup_service_file() { get_current_version - if [[ "$(echo "${CURRENT_VERSION#v}" | sed 's/-.*//' | awk -F'.' '{print $1}')" -gt "4" ]];then + if [[ "$(echo "${CURRENT_VERSION#v}" | sed 's/-.*//' | awk -F'.' '{print $1}')" -gt "4" ]]; then START_COMMAND="/usr/local/bin/v2ray run" else START_COMMAND="/usr/local/bin/v2ray" @@ -397,8 +397,7 @@ install_startup_service_file() { [Service] ExecStart= ExecStart=${START_COMMAND} -confdir $JSONS_PATH" | - tee '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' > \ - '/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf' + tee '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' > '/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf' else "rm" -f '/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf' \ '/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf' @@ -406,14 +405,12 @@ ExecStart=${START_COMMAND} -confdir $JSONS_PATH" | # Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html [Service] ExecStart= -ExecStart=${START_COMMAND} -config ${JSON_PATH}/config.json" > \ - '/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf' +ExecStart=${START_COMMAND} -config ${JSON_PATH}/config.json" > '/etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf' echo "# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there. # Or all changes you made will be lost! # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html [Service] ExecStart= -ExecStart=${START_COMMAND} -config ${JSON_PATH}/%i.json" > \ - '/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf' +ExecStart=${START_COMMAND} -config ${JSON_PATH}/%i.json" > '/etc/systemd/system/v2ray@.service.d/10-donot_touch_single_conf.conf' fi echo "info: Systemd service files have been installed successfully!" echo "${red}warning: ${green}The following are the actual parameters for the v2ray service startup."