From 0cbf46b485dc6c30aac4a216f5234d0b7a61ec0a Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Wed, 21 Jun 2023 16:22:53 +0800 Subject: [PATCH] update edit --- install/install.sh | 24 ++------ install/update.sh | 119 ++++++++++++++++++++----------------- install/update_appstore.sh | 17 +++--- install/version.json | 12 +--- 4 files changed, 82 insertions(+), 90 deletions(-) diff --git a/install/install.sh b/install/install.sh index f4d6e429..df6cca69 100644 --- a/install/install.sh +++ b/install/install.sh @@ -266,19 +266,19 @@ sudo sed -i 's/ListenStream=9090/ListenStream=9000/' /lib/systemd/system/cockpit # install plugins # install appstore mkdir /usr/share/cockpit/appstore -cp -r /data/apps/stackhub/cockpit/appstore/build/* /usr/share/cockpit/appstore +cp -r /data/apps/stackhub-web/plugins/appstore/build/* /usr/share/cockpit/appstore # install portainer mkdir /usr/share/cockpit/container -cp -r /data/apps/stackhub/cockpit/portainer/build/* /usr/share/cockpit/container +cp -r /data/apps/stackhub-web/plugins/portainer/build/* /usr/share/cockpit/container ## install nginx mkdir /usr/share/cockpit/nginx -cp -r /data/apps/stackhub/cockpit/nginxproxymanager/build/* /usr/share/cockpit/nginx +cp -r /data/apps/stackhub-web/plugins/nginxproxymanager/build/* /usr/share/cockpit/nginx ## install settings mkdir /usr/share/cockpit/settings -cp -r /data/apps/stackhub/cockpit/settings/build/* /usr/share/cockpit/settings +cp -r /data/apps/stackhub-web/plugins/settings/build/* /usr/share/cockpit/settings ## install myapps mkdir /usr/share/cockpit/myapps -cp -r /data/apps/stackhub/cockpit/myapps/build/* /usr/share/cockpit/myapps +cp -r /data/apps/stackhub-web/plugins/myapps/build/* /usr/share/cockpit/myapps # install navigator if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then @@ -366,6 +366,7 @@ echo "fast url is: "$fasturl mkdir -p /data/apps clone_repo $fasturl/Websoft9/docker-library /data/library clone_repo $fasturl/Websoft9/StackHub /data/apps/stackhub +clone_repo $fasturl/Websoft9/stackhub-web /data/apps/stackhub-web cp -r /data/apps/stackhub/docker /data/apps/w9services } @@ -392,19 +393,6 @@ sudo sed -i 's/"PORTAINER_PASSWORD": ".*"/"PORTAINER_PASSWORD": "'$new_password' curl -X POST -H "Content-Type: application/json" -d '{"username":"admin", "Password":"'$new_password'"}' http://127.0.0.1:9091/api/users/admin/init } -StartKopia(){ - -echo "Start Kopia ..." -docker pull backplane/pwgen -new_password=$(docker run --name pwgen backplane/pwgen 15)! -docker rm -f pwgen -sudo sed -i "s/POWER_PASSWORD=.*/POWER_PASSWORD=$new_password/g" /data/apps/w9services/w9kopia/.env -cd /data/apps/w9services/w9kopia && sudo docker compose up -d - -sudo sed -i 's/"KOPIA_USERNAME": ".*"/"KOPIA_USERNAME": "admin"/g' /usr/share/cockpit/myapps/config.json -sudo sed -i 's/"KOPIA_PASSWORD": ".*"/"KOPIA_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/myapps/config.json -} - InstallNginx(){ echo "Install nginxproxymanager ..." diff --git a/install/update.sh b/install/update.sh index b8b327cb..b4e57aca 100644 --- a/install/update.sh +++ b/install/update.sh @@ -150,8 +150,6 @@ if [ "$old_version" \< "$release_version" ]; then mv StackHub* stackhub rm -f $release_version.zip fi - rm -rf /tmp/config.json - cp /usr/share/cockpit/myapps/config.json /tmp/config.json rm -rf /data/apps/stackhub cp -r /tmp/stackhub /data/apps @@ -255,79 +253,94 @@ UpdatePlugins(){ echo "Check plugins if have update ..." +rm -rf /tmp/config.json +cp /usr/share/cockpit/myapps/config.json /tmp/config.json + # update appstore old_appstore_version=$(cat /usr/share/cockpit/appstore/manifest.json | jq .version) new_appstore_version=$(cat /data/apps/stackhub/cockpit/appstore/build/manifest.json |jq .version) -if [ "$old_appstore_version" \< "$new_appstore_version" ]; then - echo "appstore plugin need to update" - rm -rf /usr/share/cockpit/appstore/* - cp -r /data/apps/stackhub/cockpit/appstore/build/* /usr/share/cockpit/appstore -else - echo "appstore is not need to update" -fi - # update settings old_settings_version=$(cat /usr/share/cockpit/settings/manifest.json | jq .version) new_settings_version=$(cat /data/apps/stackhub/cockpit/settings/build/manifest.json |jq .version) -if [ "$old_settings_version" \< "$new_settings_version" ]; then - echo "settings plugin need to update" - rm -rf /usr/share/cockpit/settings/* - cp -r /data/apps/stackhub/cockpit/settings/build/* /usr/share/cockpit/settings -else - echo "settings is not need to update" -fi - # update myapps old_myapps_version=$(cat /usr/share/cockpit/myapps/manifest.json | jq .version) new_myapp_version=$(cat /data/apps/stackhub/cockpit/myapps/build/manifest.json |jq .version) -if [ "$old_myapps_version" \< "$new_myapp_version" ]; then - echo "start to update myapps..." - rm -rf /usr/share/cockpit/myapps/* - cp -r /data/apps/stackhub/cockpit/myapps/build/* /usr/share/cockpit/myapps - rm -f /usr/share/cockpit/myapps/config.json - cp /tmp/config.json /usr/share/cockpit/myapps/config.json -else - echo "myapps is not need to update" -fi - ## update container old_container_version=$(cat /usr/share/cockpit/container/manifest.json | jq .version) new_container_version=$(cat /data/apps/stackhub/cockpit/portainer/build/manifest.json |jq .version) -if [ "$old_container_version" \< "$new_container_version" ]; then - echo "start to update portainer..." - rm -rf /usr/share/cockpit/container/* - cp -r /data/apps/stackhub/cockpit/portainer/build/* /usr/share/cockpit/container -else - echo "portainer is not need to update" -fi - ## update nginx old_nginx_version=$(cat /usr/share/cockpit/nginx/manifest.json | jq .version) new_nginx_version=$(cat /data/apps/stackhub/cockpit/nginxproxymanager/build/manifest.json |jq .version) -if [ "$old_nginx_version" \< "$new_nginx_version" ]; then - echo "start to update nginx..." - rm -rf /usr/share/cockpit/nginx/* - cp -r /data/apps/stackhub/cockpit/nginxproxymanager/build/* /usr/share/cockpit/nginx +if [ "$old_appstore_version" = "$new_appstore_version" ] && [ "$old_settings_version" = "$new_settings_version" ] && [ "$old_myapps_version" = "$new_myapp_version" ] && [ "$old_container_version" = "$new_container_version" ] && [ "$old_nginx_version" \< "$new_nginx_version" ]; then + echo "appstore all plugins is latest" else - echo "nginx is not need to update" + + release_version=$(curl https://websoft9.github.io/stackhub-web/CHANGELOG.md | head -n 1 |cut -d' ' -f2) + fastest=$(fastest_url "${urls[@]}") + echo "fasturl is: "$fastest + cd /tmp && rm -rf /tmp/stackhub-web + if [[ $fastest == *gitee.com* ]]; then + echo "update from gitee" + wget $fastest/websoft9/stackhub-web/repository/archive/$release_version + unzip $release_version + mv stackhub-web* stackhub-web + rm -f $release_version + else + echo "update from github" + wget $fastest/websoft9/stackhub-web/archive/refs/tags/$release_version.zip + unzip $release_version.zip + mv stackhub-web* stackhub-web + rm -f $release_version.zip + fi + rm -rf /data/apps/stackhub-web && cp -r /tmp/stackhub-web /data/apps + + if [ "$old_appstore_version" \< "$new_appstore_version" ]; then + echo "appstore plugin need to update" + rm -rf /usr/share/cockpit/appstore/* + cp -r /data/apps/stackhub-web/plugins/appstore/build/* /usr/share/cockpit/appstore + else + echo "appstore is not need to update" + fi + + if [ "$old_settings_version" \< "$new_settings_version" ]; then + echo "settings plugin need to update" + rm -rf /usr/share/cockpit/settings/* + cp -r /data/apps/stackhub-web/plugins/settings/build/* /usr/share/cockpit/settings + else + echo "settings is not need to update" + fi + + if [ "$old_myapps_version" \< "$new_myapp_version" ]; then + echo "start to update myapps..." + rm -rf /usr/share/cockpit/myapps/* + cp -r /data/apps/stackhub-web/plugins/myapps/build/* /usr/share/cockpit/myapps + rm -f /usr/share/cockpit/myapps/config.json + cp /tmp/config.json /usr/share/cockpit/myapps/config.json + else + echo "myapps is not need to update" + fi + + if [ "$old_container_version" \< "$new_container_version" ]; then + echo "start to update portainer..." + rm -rf /usr/share/cockpit/container/* + cp -r /data/apps/stackhub-web/plugins/portainer/build/* /usr/share/cockpit/container + else + echo "portainer is not need to update" + fi + + if [ "$old_nginx_version" \< "$new_nginx_version" ]; then + echo "start to update nginx..." + rm -rf /usr/share/cockpit/nginx/* + cp -r /data/apps/stackhub-web/plugins/nginxproxymanager/build/* /usr/share/cockpit/nginx + else + echo "nginx is not need to update" + fi fi - -## update kopia -# old_kopia_version=$(cat /usr/share/cockpit/backup/manifest.json | jq .version) -# new_kopia_version=$(cat /data/apps/stackhub/install/version.json|jq .KOPIA.KOPIA_PLUGIN_VERSION) - -# if [ "$old_kopia_version" \< "$new_kopia_version" ]; then -# echo "kopia plugin need to update" -# rm -rf /usr/share/cockpit/backup/* -# cp -r /data/apps/stackhub/cockpit/kopia/build/* /usr/share/cockpit/backup -# else -# echo "kopia is not need to update" -# fi } diff --git a/install/update_appstore.sh b/install/update_appstore.sh index 883caf56..8c1ad667 100644 --- a/install/update_appstore.sh +++ b/install/update_appstore.sh @@ -43,12 +43,13 @@ else old_library_version=$(cat /data/library/install/version.json | jq .VERSION | tr -d '"') fi latest_library_version=$(curl https://websoft9.github.io/docker-library/install/version.json | jq .VERSION | tr -d '"') -release_version=$(curl https://websoft9.github.io/StackHub/install/version.json | jq .VERSION | tr -d '"') + if [ "$old_library_version" \< "$latest_library_version" ]; then echo "start to update Library..." + release_version=$(curl https://websoft9.github.io/stackhub-web/CHANGELOG.md | head -n 1 |cut -d' ' -f2) fastest=$(fastest_url "${urls[@]}") echo "fasturl is: "$fastest - cd /tmp && rm -rf /tmp/library /tmp/stackhub + cd /tmp && rm -rf /tmp/library /tmp/stackhub-web if [[ $fastest == *gitee.com* ]]; then echo "update from gitee" wget $fastest/websoft9/docker-library/repository/archive/$latest_library_version @@ -56,9 +57,9 @@ if [ "$old_library_version" \< "$latest_library_version" ]; then mv docker-library* library rm -f $latest_library_version - wget $fastest/websoft9/StackHub/repository/archive/$release_version + wget $fastest/websoft9/stackhub-web/repository/archive/$release_version unzip $release_version - mv StackHub* stackhub + mv stackhub-web* stackhub-web rm -f $release_version else echo "update from github" @@ -67,14 +68,14 @@ if [ "$old_library_version" \< "$latest_library_version" ]; then mv docker-library* library rm -f $latest_library_version.zip - wget $fastest/websoft9/StackHub/archive/refs/tags/$release_version.zip + wget $fastest/websoft9/stackhub-web/archive/refs/tags/$release_version.zip unzip $release_version.zip - mv StackHub* stackhub + mv stackhub-web* stackhub-web rm -f $release_version.zip fi rm -rf /data/library && cp -r /tmp/library /data - rm -rf /usr/share/cockpit/appstore/static/data && cp -r /tmp/stackhub/cockpit/appstore/build/static/data /usr/share/cockpit/appstore/static - rm -rf /usr/share/cockpit/myapps/static/logos && cp -r /tmp/stackhub/cockpit/myapps/build/static/logos /usr/share/cockpit/myapps/static + rm -rf /usr/share/cockpit/appstore/static/data && cp -r /tmp/stackhub-web/plugins/appstore/build/static/data /usr/share/cockpit/appstore/static + rm -rf /usr/share/cockpit/myapps/static/logos && cp -r /tmp/stackhub-web/plugins/myapps/build/static/logos /usr/share/cockpit/myapps/static else echo "Library is not need to update" diff --git a/install/version.json b/install/version.json index 0cebccf0..99695e03 100644 --- a/install/version.json +++ b/install/version.json @@ -4,16 +4,6 @@ "NGINX": "2.10.3", "APPMANAGE": "0.7.1", "REDIS": "7.0.11" - }, - "PLUGINS": { - "PORTAINER": "1.0.0", - "NGINX": "1.0.0", - "SETTING": "1.0.0", - "MYAPPS": "1.0.2", - "APPSTORE": "1.0.1" - }, - "LIBRARY": { - "VERSION": "0.2.2" - }, + }, "VERSION": "0.7.1" } \ No newline at end of file