diff --git a/cockpit/menu_override/sosreport.override.json b/cockpit/menu_override/sosreport.override.json new file mode 100644 index 00000000..437ef46f --- /dev/null +++ b/cockpit/menu_override/sosreport.override.json @@ -0,0 +1,4 @@ +{ + "menu": null, + "tools": null +} \ No newline at end of file diff --git a/docker/daemon.json b/docker/daemon.json new file mode 100644 index 00000000..ee4e5325 --- /dev/null +++ b/docker/daemon.json @@ -0,0 +1,7 @@ +{ + "log-driver": "json-file", + "log-opts": { + "max-size": "10m", + "max-file": "5" + } +} \ No newline at end of file diff --git a/install/install.sh b/install/install.sh index af15ef0c..dd0ba421 100644 --- a/install/install.sh +++ b/install/install.sh @@ -158,9 +158,10 @@ check_ports() { local ports=("$@") echo "Stop Websoft9 Proxy and Cockpit service for reserve ports..." - sudo docker stop websoft9-proxy || echo "docker stop websoft9-proxy failed " - sudo systemctl stop cockpit || echo "systemctl stop cockpit failed" - sudo systemctl stop cockpit.socket || echo "systemctl stop cockpit.socket failed" + sudo docker stop websoft9-proxy 2>/dev/null || echo "docker stop websoft9-proxy not need " + sudo systemctl stop cockpit 2>/dev/null || echo "systemctl stop cockpit not need" + sudo systemctl stop cockpit.socket 2>/dev/null || echo "systemctl stop cockpit.socket not need" + for port in "${ports[@]}"; do if netstat -tuln | grep ":$port " >/dev/null; then @@ -172,9 +173,51 @@ check_ports() { echo "All ports are available" } + +merge_daemon_files() { + remote_url="$1" + local_file="$2" + + python3 - < /dev/null 2>&1; then + sudo docker network create websoft9 + sudo systemctl restart docker + fi +} + install_backends() { echo_prefix_backends=$'\n[Backend] - ' echo "$echo_prefix_backends Install backend docker services" + set_docker cd "$install_path/docker" if [ $? -ne 0 ]; then diff --git a/install/install_cockpit.sh b/install/install_cockpit.sh index d5009c98..165e2729 100644 --- a/install/install_cockpit.sh +++ b/install/install_cockpit.sh @@ -56,7 +56,7 @@ echo_prefix_cockpit=$'\n[Cockpit] - ' cockpit_packages="cockpit cockpit-ws cockpit-bridge cockpit-system cockpit-pcp cockpit-storaged cockpit-networkmanager cockpit-session-recording cockpit-doc cockpit-packagekit cockpit-sosreport" menu_overrides_github_page_url="https://websoft9.github.io/websoft9/cockpit/menu_override" cockpit_config_github_page_url="https://websoft9.github.io/websoft9/cockpit/cockpit.conf" -cockpit_menu_overrides=(networkmanager.override.json shell.override.json storaged.override.json systemd.override.json users.override.json apps.override.json machines.override.json selinux.override.json subscriptions.override.json kdump.override.json updated.override.json playground.override.json packagekit.override.json session-recording.override.json) +cockpit_menu_overrides=() # export OS release environments if [ -f /etc/os-release ]; then . /etc/os-release @@ -207,7 +207,32 @@ Set_Cockpit(){ } +get_github_files() { + python3 - </dev/null 2>&1 ; do + echo "${lock_file} is locked by another process. Waiting..." + sleep 5 + done + done + + echo "APT locks are not held by any processes. You can proceed." } + docker_exist() { # 检查 `docker` 命令是否存在 if ! command -v docker &> /dev/null; then @@ -77,12 +83,9 @@ Install_Docker(){ # For Ubuntu, Debian, or Raspbian if type apt >/dev/null 2>&1; then + Wait_apt apt update # Wait for apt to be unlocked - while is_apt_locked; do - echo "Waiting for apt to be unlocked..." - sleep 5 - done curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh fi } @@ -112,39 +115,18 @@ else fi } - -Set_Firewall(){ - echo "$echo_prefix_cockpit Set Firewalld for Docker" - if command -v firewall-cmd &> /dev/null; then - if ! systemctl is-active --quiet firewalld; then - sudo systemctl start firewalld - sudo firewall-cmd --zone=trusted --remove-interface=docker0 --permanent - sudo firewall-cmd --reload - sudo systemctl stop firewalld - else - sudo firewall-cmd --zone=trusted --remove-interface=docker0 --permanent - sudo firewall-cmd --reload - fi - - fi -} - -Set_Docker(){ +Start_Docker(){ # should have Docker server and Docker cli if docker_exist; then - echo "$echo_prefix_docker Starting to Set docker..." + echo "$echo_prefix_docker Starting Docker" sudo systemctl enable docker sudo systemctl restart docker - if ! docker network inspect websoft9 > /dev/null 2>&1; then - sudo docker network create websoft9 - sudo systemctl restart docker - fi else - echo "Docker settings failed, exit..." + echo "Docker start failed, exit..." exit fi } + Upgrade_Docker -Set_Firewall -Set_Docker \ No newline at end of file +Start_Docker \ No newline at end of file diff --git a/install/install_podman.sh b/install/install_podman.sh index 925db230..fb78e25f 100644 --- a/install/install_podman.sh +++ b/install/install_podman.sh @@ -2,6 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH +# This script is on development, can not use now # to do diff --git a/install/uninstall.sh b/install/uninstall.sh index 7539a5c3..d67e13ad 100644 --- a/install/uninstall.sh +++ b/install/uninstall.sh @@ -27,8 +27,6 @@ systemd_path="/opt/websoft9/systemd" cockpit_plugin_path="/usr/share/cockpit" cockpit_packages="cockpit cockpit-ws cockpit-bridge cockpit-system cockpit-pcp cockpit-storaged cockpit-networkmanager cockpit-session-recording cockpit-doc cockpit-packagekit cockpit-sosreport" - - echo -e "\n---Remove Websoft9 backend service containers---" sudo docker compose -p websoft9 down -v @@ -39,15 +37,16 @@ rm -rf /lib/systemd/system/websoft9.service -handle_cockpit() { +remove_cockpit() { echo -e "\n---Remove Cockpit---" sudo systemctl stop cockpit.socket cockpit for package in $cockpit_packages; do sudo pkcon remove $package -y || true done + sudo rm -rf /etc/cockpit/* } -handle_files() { +remove_files() { echo -e "\n---Remove files---" sudo rm -rf $install_path/* $systemd_path/* $cockpit_plugin_path/* } @@ -56,11 +55,11 @@ for arg in "$@" do case $arg in --cockpit) - handle_cockpit + remove_cockpit shift ;; --files) - handle_files + remove_files shift ;; *)