From cb0cf9f7582d1ce8269dff57d028c4b281e36069 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Thu, 20 Jul 2023 16:49:16 +0800 Subject: [PATCH] override menu --- .../networkmanager.override.json | 43 +++++++ cockpit/menu_override/shell.override.json | 33 +++++ cockpit/menu_override/storaged.override.json | 75 ++++++++++++ cockpit/menu_override/systemd.override.json | 115 ++++++++++++++++++ cockpit/menu_override/users.override.json | 19 +++ install/install.sh | 51 +------- 6 files changed, 289 insertions(+), 47 deletions(-) create mode 100644 cockpit/menu_override/networkmanager.override.json create mode 100644 cockpit/menu_override/shell.override.json create mode 100644 cockpit/menu_override/storaged.override.json create mode 100644 cockpit/menu_override/systemd.override.json create mode 100644 cockpit/menu_override/users.override.json diff --git a/cockpit/menu_override/networkmanager.override.json b/cockpit/menu_override/networkmanager.override.json new file mode 100644 index 00000000..3151a0a0 --- /dev/null +++ b/cockpit/menu_override/networkmanager.override.json @@ -0,0 +1,43 @@ +{ + "name": "network", + "conditions": [ + {"path-exists": "/usr/share/dbus-1/system.d/org.freedesktop.NetworkManager.conf"} + ], + "tools": { + "index": { + "label": "Networking", + "order": 40, + "docs": [ + { + "label": "Managing networking bonds", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/configuring-network-bonds-using-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing networking teams", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/configuring-network-teams-using-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing networking bridges", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/configuring-network-bridges-in-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing VLANs", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/configuring-vlans-in-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing firewall", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/managing_firewall_using_the_web_console" + } + ], + "keywords": [ + { + "matches": ["network", "interface", "bridge", "vlan", "bond", "team", "port", "mac", "ipv4", "ipv6"] + }, + { + "matches": ["firewall", "firewalld", "zone", "tcp", "udp"], + "goto": "/network/firewall" + } + ] + } + } +} diff --git a/cockpit/menu_override/shell.override.json b/cockpit/menu_override/shell.override.json new file mode 100644 index 00000000..45a3dd4f --- /dev/null +++ b/cockpit/menu_override/shell.override.json @@ -0,0 +1,33 @@ +{ + "requires": { + "cockpit": "239" + }, + "locales": { + "en-us": "English", + "zh-cn": "中文(中国)" + }, + "bridges": [ + { + "privileged": true, + "environ": [ + "SUDO_ASKPASS=${libexecdir}/cockpit-askpass" + ], + "spawn": [ + "sudo", + "-k", + "-A", + "cockpit-bridge", + "--privileged" + ] + }, + { + "privileged": true, + "spawn": [ + "pkexec", + "--disable-internal-agent", + "cockpit-bridge", + "--privileged" + ] + } + ] +} diff --git a/cockpit/menu_override/storaged.override.json b/cockpit/menu_override/storaged.override.json new file mode 100644 index 00000000..eb1c4887 --- /dev/null +++ b/cockpit/menu_override/storaged.override.json @@ -0,0 +1,75 @@ +{ + "name": "storage", + "requires": { + "cockpit": "266" + }, + "conditions": [ + {"path-exists": "/usr/share/dbus-1/system.d/org.freedesktop.UDisks2.conf"} + ], + + "tools": { + "index": { + "label": "Storage", + "order": 30, + "docs": [ + { + "label": "Managing partitions", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/managing-partitions-using-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing NFS mounts", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/managing-nfs-mounts-in-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing RAIDs", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/managing-redundant-arrays-of-independent-disks-in-the-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing LVMs", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/using-the-web-console-for-configuring-lvm-logical-volumes_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing physical drives", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/using-the-web-console-for-changing-physical-drives-in-volume-groups_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Managing VDOs", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/using-the-web-console-for-managing-virtual-data-optimizer-volumes_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Using LUKS encryption", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/locking-data-with-luks-password-in-the-rhel-web-console_system-management-using-the-rhel-8-web-console" + }, + { + "label": "Using Tang server", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/configuring-automated-unlocking-using-a-tang-key-in-the-web-console_system-management-using-the-rhel-8-web-console" + } + ], + "keywords": [ + { + "matches": ["filesystem", "partition", "nfs", "raid", "volume", "disk", "vdo", "iscsi", "drive", "mount", "unmount", "udisks", "mkfs", "format", "fstab", "lvm2", "luks", "encryption", "nbde", "tang"] + } + ] + } + }, + + "config": { + "nfs_client_package": { + "rhel": "nfs-utils", "fedora": "nfs-utils", + "opensuse": "nfs-client", "opensuse-leap": "nfs-client", + "debian": "nfs-common", "ubuntu": "nfs-common", + "arch": "nfs-utils" + }, + "vdo_package": { "rhel": "vdo", "centos": "vdo" }, + "stratis_package": { "fedora": "stratisd", + "centos": "stratisd", + "arch": "stratisd", + "platform:el9": "stratisd" + }, + "nbde_root_help": { "fedora": true, + "centos": true, + "rhel": true + } + }, + "content-security-policy": "img-src 'self' data:" +} diff --git a/cockpit/menu_override/systemd.override.json b/cockpit/menu_override/systemd.override.json new file mode 100644 index 00000000..1ef0c870 --- /dev/null +++ b/cockpit/menu_override/systemd.override.json @@ -0,0 +1,115 @@ +{ + "name": "system", + "requires": { + "cockpit": "265" + }, + "menu": { + "terminal": { + "label": "Terminal", + "keywords": [ + { + "matches": [ + "console", + "command", + "bash", + "shell" + ] + } + ] + }, + "index": { + "label": "Overview", + "order": -2, + "docs": [ + { + "label": "Configuring system settings", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/getting-started-with-the-rhel-8-web-console_system-management-using-the-rhel-8-web-console" + } + ], + "keywords": [ + { + "matches": [ + "time", + "date", + "restart", + "shut", + "domain", + "machine", + "operating system", + "os", + "asset tag", + "ssh", + "power", + "version", + "host" + ] + }, + { + "matches": [ + "hardware", + "mitigation", + "pci", + "memory", + "cpu", + "bios", + "ram", + "dimm", + "serial" + ], + "goto": "/system/hwinfo" + }, + { + "matches": [ + "graphs", + "metrics", + "history", + "pcp", + "cpu", + "memory", + "disks", + "network", + "cgroups", + "performance" + ], + "goto": "/metrics" + } + ] + } + }, + "tools": { + "logs": { + "label": "Logs", + "order": 20, + "docs": [ + { + "label": "Reviewing logs", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/reviewing-logs_system-management-using-the-rhel-8-web-console" + } + ], + "keywords": [ + { + "matches": [ + "journal", + "warning", + "error", + "debug" + ] + }, + { + "matches": [ + "abrt", + "crash", + "coredump" + ], + "goto": "?tag=abrt-notification" + } + ] + } + }, + "libexecdir": "${libexecdir}", + "preload": [ + "index", + "services" + ], + "content-security-policy": "img-src 'self' data:" +} diff --git a/cockpit/menu_override/users.override.json b/cockpit/menu_override/users.override.json new file mode 100644 index 00000000..403b139b --- /dev/null +++ b/cockpit/menu_override/users.override.json @@ -0,0 +1,19 @@ +{ + "tools": { + "index": { + "label": "Accounts", + "order": 70, + "docs": [ + { + "label": "Managing user accounts", + "url": "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console/managing-user-accounts-in-the-web-console_system-management-using-the-rhel-8-web-console" + } + ], + "keywords": [ + { + "matches": ["user", "password", "useradd", "passwd", "username", "login", "access", "roles", "ssh", "keys"] + } + ] + } + } +} diff --git a/install/install.sh b/install/install.sh index 916eaf73..3a284107 100644 --- a/install/install.sh +++ b/install/install.sh @@ -375,7 +375,8 @@ else echo "install from artifact" fi - +sudo systemctl stop firewalld +sudo systemctl restart cockpit sudo systemctl daemon-reload sudo systemctl enable --now cockpit sudo systemctl enable --now cockpit.socket @@ -513,53 +514,9 @@ sudo docker restart websoft9-nginxproxymanager EditMenu(){ echo "Start to Edit Cockpit Menu ..." -if command -v jq > /dev/null; then - if [ -e /usr/share/cockpit/systemd ]; then - jq '. | .tools as $menu | .menu as $tools | .tools=$tools | .menu=$menu | del(.tools.services) | del(.menu.preload.services) | .menu.index = .tools.index | del(.tools.index) | .menu.index.order = -2' /usr/share/cockpit/systemd/manifest.json > /usr/share/cockpit/systemd/manifest.json.tmp - rm -rf /usr/share/cockpit/systemd/manifest.json - mv /usr/share/cockpit/systemd/manifest.json.tmp /usr/share/cockpit/systemd/manifest.json - cd /usr/share/cockpit/systemd && rm -rf services.js.gz services.html.gz services.css.gz services.js services.html services.css - fi - if [ -e /usr/share/cockpit/networkmanager ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/networkmanager/manifest.json - fi - if [ -e /usr/share/cockpit/storaged ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/storaged/manifest.json - fi - if [ -e /usr/share/cockpit/users ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/users/manifest.json - fi +cp -r /data/apps/websoft9/cockpit/menu_override/* /etc/cockpit +cd /usr/share/cockpit/systemd && rm -rf services.js.gz services.html.gz services.css.gz services.js services.html services.css - jq '. | del(.locales."ca-es") | del(.locales."nb-no") | del(.locales."sk-sk") | del(.locales."tr-tr")| del(.locales."cs-cz") | del(.locales."de-de") | del(.locales."es-es") | del(.locales."fi-fi") | del(.locales."fr-fr") | del(.locales."it-it") | del(.locales."ja-jp") | del(.locales."pl-pl") | del(.locales."pt-br") | del(.locales."ru-ru") | del(.locales."sv-se") | del(.locales."uk-ua") | del(.locales."zh-tw") | del(.locales."he-il") | del(.locales."nl-nl") | del(.locales."ko-kr") | del(.locales."ka-ge")' /usr/share/cockpit/shell/manifest.json > /usr/share/cockpit/shell/manifest.json.tmp - rm -rf /usr/share/cockpit/shell/manifest.json - mv /usr/share/cockpit/shell/manifest.json.tmp /usr/share/cockpit/shell/manifest.json -else - echo "system have no jq, use cockpit menu ..." - if [ "$os_type" == 'CentOS' ] || [ "$os_type" == 'CentOS Stream' ] || [ "$os_type" == 'Fedora' ] || [ "$os_type" == 'OracleLinux' ] || [ "$os_type" == 'Redhat' ];then - sudo yum install epel-release -y 1>/dev/null 2>&1 - sudo yum install jq -y 1>/dev/null 2>&1 - if [ -e /usr/share/cockpit/systemd ]; then - jq '. | .tools as $menu | .menu as $tools | .tools=$tools | .menu=$menu | del(.tools.services) | del(.menu.preload.services) | .menu.index = .tools.index | del(.tools.index) | .menu.index.order = -2' /usr/share/cockpit/systemd/manifest.json > /usr/share/cockpit/systemd/manifest.json.tmp - rm -rf /usr/share/cockpit/systemd/manifest.json - mv /usr/share/cockpit/systemd/manifest.json.tmp /usr/share/cockpit/systemd/manifest.json - cd /usr/share/cockpit/systemd && rm -rf services.js.gz services.html.gz services.css.gz - fi - if [ -e /usr/share/cockpit/networkmanager ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/networkmanager/manifest.json - fi - if [ -e /usr/share/cockpit/storaged ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/storaged/manifest.json - fi - if [ -e /usr/share/cockpit/users ]; then - sudo sed -i 's/menu/tools/g' /usr/share/cockpit/users/manifest.json - fi - - jq '. | del(.locales."ca-es") | del(.locales."nb-no") | del(.locales."sk-sk") | del(.locales."tr-tr")| del(.locales."cs-cz") | del(.locales."de-de") | del(.locales."es-es") | del(.locales."fi-fi") | del(.locales."fr-fr") | del(.locales."it-it") | del(.locales."ja-jp") | del(.locales."pl-pl") | del(.locales."pt-br") | del(.locales."ru-ru") | del(.locales."sv-se") | del(.locales."uk-ua") | del(.locales."zh-tw") | del(.locales."he-il") | del(.locales."nl-nl") | del(.locales."ko-kr") | del(.locales."ka-ge")' /usr/share/cockpit/shell/manifest.json > /usr/share/cockpit/shell/manifest.json.tmp - rm -rf /usr/share/cockpit/shell/manifest.json - mv /usr/share/cockpit/shell/manifest.json.tmp /usr/share/cockpit/shell/manifest.json - fi - -fi echo "---------------------------------- Install success! you can install a app by websoft9's appstore -------------------------------------------------------" }