diff --git a/install/install.sh b/install/install.sh index 107de236..6f357fa2 100644 --- a/install/install.sh +++ b/install/install.sh @@ -379,6 +379,8 @@ if [ $? -ne 0 ]; then exit 1 fi +install_backends + bash $install_path/install/install_cockpit.sh if [ $? -ne 0 ]; then echo "install_cockpit failed with error $?. Exiting." @@ -391,7 +393,6 @@ if [ $? -ne 0 ]; then exit 1 fi -install_backends install_systemd echo -e "\n-- Install success! ------" diff --git a/install/install_cockpit.sh b/install/install_cockpit.sh index 9a906c0c..58cfba47 100644 --- a/install/install_cockpit.sh +++ b/install/install_cockpit.sh @@ -80,7 +80,7 @@ echo -e "\nYour installation parameters are as follows: " echo "cockpit_port:$cockpit_port" echo "install_path:$install_path" - +related_containers=("websoft9-apphub") echo_prefix_cockpit=$'\n[Cockpit] - ' # package cockpit depends_on [cockpit-bridge,cockpit-ws,cockpit-system], but update cockpit the depends don't update cockpit_packages="cockpit cockpit-ws cockpit-bridge cockpit-system cockpit-pcp cockpit-storaged cockpit-networkmanager cockpit-session-recording cockpit-doc cockpit-packagekit cockpit-sosreport" @@ -162,7 +162,7 @@ Restart_Cockpit(){ echo "$echo_prefix_cockpit Restart Cockpit" sudo systemctl daemon-reload sudo systemctl restart cockpit.socket 2> /dev/null - sudo systemctl restart cockpit + sudo systemctl restart cockpit || exit 1 } Add_Firewalld(){ @@ -216,9 +216,19 @@ Set_Cockpit(){ curl -sSL $cockpit_config_github_page_url | sudo tee /etc/cockpit/cockpit.conf > /dev/null fi + echo "Change cockpit default port to $cockpit_port ..." sudo sed -i "s/ListenStream=[0-9]*/ListenStream=${cockpit_port}/" /lib/systemd/system/cockpit.socket + + if docker ps --format '{{.Names}}' | grep -wq "${related_containers[0]}"; then + echo "Try to change cockpit port at ${related_containers[0]} container..." + sudo docker exec -i ${related_containers[0]} apphub setconfig --section cockpit --key port --value $cockpit_port || true + else + echo "Not found ${related_containers[0]} container" + fi + + # fwupd-refresh.service may push error for Cockpit menu, so disable it if sudo systemctl is-active --quiet fwupd-refresh.service; then echo "fwupd-refresh.service is already running. Stopping and disabling it..."