From d00031f92d6b52ca5f199339aaefc8e69edc5e25 Mon Sep 17 00:00:00 2001 From: Darren <27513732@qq.com> Date: Sun, 8 Oct 2023 18:40:19 +0800 Subject: [PATCH] fix install --- changelog_latest.md | 3 +- install/install.sh | 11 ++++-- install/install_cockpit.sh | 68 ++++++++++++++++++++++---------------- version.json | 2 +- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/changelog_latest.md b/changelog_latest.md index 8bb6b2d5..657ed0ec 100644 --- a/changelog_latest.md +++ b/changelog_latest.md @@ -1,2 +1 @@ -1. Fix install error: Cockpit override files -2. Fix install: Docker error then exit 1 +1. Fix install error: Cockpit port diff --git a/install/install.sh b/install/install.sh index 814228a3..2f31a88d 100644 --- a/install/install.sh +++ b/install/install.sh @@ -33,7 +33,6 @@ export PATH # 设置参数的默认值 version="latest" -port="9000" channel="release" path="/data/websoft9/source" @@ -62,6 +61,13 @@ while [[ $# -gt 0 ]]; do esac done +if [ -n "$port" ]; then + export port +else + port=9000 +fi + + # 输出参数值 echo -e "\n------ Welcome to install Websoft9, it will take 3-5 minutes ------" echo -e "\nYour installation parameters are as follows: " @@ -78,7 +84,6 @@ cat /etc/os-release | head -n 3 2>/dev/null export http_port=80 export https_port=443 -export cockpit_port=$port export install_path=$path export channel export version @@ -346,7 +351,7 @@ install_systemd() { #--------------- main----------------------------------------- -check_ports $http_port $https_port $cockpit_port +check_ports $http_port $https_port $port install_tools download_source diff --git a/install/install_cockpit.sh b/install/install_cockpit.sh index d7131971..ef7e64ac 100644 --- a/install/install_cockpit.sh +++ b/install/install_cockpit.sh @@ -23,22 +23,14 @@ export PATH # # $ sudo sh install_cockpit.sh --port 9001 - - ############################################################ # Below vars export from install.sh -# $cockpit_port +# $port # $install_path ############################################################ + echo -e "\n\n-------- Cockpit --------" -echo "cockpit_port:$cockpit_port" -echo "install_path:$install_path" -# Install Cockpit at this port -# If Cockpit installed, maintain its origin port -port="9000" - -# 获取参数值 while [[ $# -gt 0 ]]; do case $1 in --port) @@ -51,6 +43,43 @@ while [[ $# -gt 0 ]]; do esac done +# Port priority: --port > ListenStream= > 9000 + +cockpit_exist() { + systemctl list-unit-files | grep -q "cockpit.service" + return $? +} + +if cockpit_exist; then + cockpit_now_port=$(grep -oP "(?<=^ListenStream=).*" "/lib/systemd/system/cockpit.socket") + if [ -z "${cockpit_now_port// }" ]; then + echo "cockpit port is null,set it to 9000" + cockpit_now_port=9000 + else + echo "$cockpit_now_port at cockpit.socket" + fi + +else + cockpit_now_port=9000 +fi + +if [ -n "$port" ]; then + cockpit_port=$port +else + cockpit_port=$cockpit_now_port +fi + + +if [ -n "$install_path" ]; then + echo "Have found install files" +else + install_path="/data/websoft9/source" +fi + +echo -e "\nYour installation parameters are as follows: " +echo "cockpit_port:$cockpit_port" +echo "install_path:$install_path" + echo_prefix_cockpit=$'\n[Cockpit] - ' # package cockpit depends_on [cockpit-bridge,cockpit-ws,cockpit-system], but update cockpit the depends don't update @@ -73,23 +102,6 @@ Pin: release a=$VERSION_CODENAME-backports Pin-Priority: 1000 " -cockpit_exist() { - systemctl list-unit-files | grep -q "cockpit.service" - return $? -} - - -if cockpit_exist && [ -n "${cockpit_port// }" ]; then - cockpit_port=$(grep -oP "(?<=^ListenStream=).*" "/lib/systemd/system/cockpit.socket") - echo "$cockpit_port at cockpit.socket" -fi - -if [ -z "${cockpit_port// }" ]; then - cockpit_port=$port - echo "Confirm the port: $cockpit_port" -fi - - check_ports() { local ports=("$@") @@ -311,7 +323,7 @@ Install_Cockpit(){ Test_Cockpit(){ echo "$echo_prefix_cockpit Test Cockpit console accessibility" test_cmd="curl localhost:$cockpit_port" - + echo test_cmd start_time=$(date +%s) timeout=30 while true; do diff --git a/version.json b/version.json index 5bb77020..ffb6b3a9 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "0.8.26-rc2", + "version": "0.8.26-rc3", "plugins": { "portainer": "0.0.6", "nginx": "0.0.5",