From 9eb650b44432998adf306f23a6d286f1b120d7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=AB=AD=E5=8A=9B?= Date: Thu, 5 Jan 2023 10:47:44 +0800 Subject: [PATCH 1/5] Add download triage for download migration-tool (#793) Co-authored-by: Tiger Wang --- .../migration/script.d/03-migrate-casaos.sh | 47 +++++++++++++------ .../migration/service.d/casaos/migration.list | 6 +-- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/build/scripts/migration/script.d/03-migrate-casaos.sh b/build/scripts/migration/script.d/03-migrate-casaos.sh index 719ff60..0901568 100644 --- a/build/scripts/migration/script.d/03-migrate-casaos.sh +++ b/build/scripts/migration/script.d/03-migrate-casaos.sh @@ -56,6 +56,22 @@ __is_migration_needed() { __is_version_gt "${version2}" "${version1}" } +__get_download_domain(){ + local region + # Use ipconfig.io/country and https://ifconfig.io/country_code to get the country code + region=$(curl --connect-timeout 2 -s ipconfig.io/country || echo "") + if [ "${region}" = "" ]; then + region=$(curl --connect-timeout 2 -s https://ifconfig.io/country_code || echo "") + fi + if [[ "${region}" = "China" ]] || [[ "${region}" = "CN" ]]; then + echo "https://casaos.oss-cn-shanghai.aliyuncs.com/" + else + echo "https://github.com/" + fi +} + +DOWNLOAD_DOMAIN=$(__get_download_domain) + BUILD_PATH=$(dirname "${BASH_SOURCE[0]}")/../../.. SOURCE_ROOT=${BUILD_PATH}/sysroot @@ -71,7 +87,7 @@ CURRENT_BIN_FILE=${CURRENT_BIN_PATH}/${APP_NAME} CURRENT_BIN_FILE_LEGACY=$(realpath -e ${CURRENT_BIN_PATH_LEGACY}/${APP_NAME} || which ${APP_NAME} || echo CURRENT_BIN_FILE_LEGACY_NOT_FOUND) SOURCE_VERSION="$(${SOURCE_BIN_FILE} -v)" -CURRENT_VERSION="$(${CURRENT_BIN_FILE} -v || ${CURRENT_BIN_FILE_LEGACY} -v || (stat "${CURRENT_BIN_FILE_LEGACY}" > /dev/null && echo LEGACY_WITHOUT_VERSION) || echo CURRENT_VERSION_NOT_FOUND)" +CURRENT_VERSION="$(${CURRENT_BIN_FILE} -v || ${CURRENT_BIN_FILE_LEGACY} -v || (stat "${CURRENT_BIN_FILE_LEGACY}" >/dev/null && echo LEGACY_WITHOUT_VERSION) || echo CURRENT_VERSION_NOT_FOUND)" __info_done "CURRENT_VERSION: ${CURRENT_VERSION}" __info_done "SOURCE_VERSION: ${SOURCE_VERSION}" @@ -86,18 +102,18 @@ fi ARCH="unknown" case $(uname -m) in - x86_64) - ARCH="amd64" - ;; - aarch64) - ARCH="arm64" - ;; - armv7l) - ARCH="arm-7" - ;; - *) - __error "Unsupported architecture" - ;; +x86_64) + ARCH="amd64" + ;; +aarch64) + ARCH="arm64" + ;; +armv7l) + ARCH="arm-7" + ;; +*) + __error "Unsupported architecture" + ;; esac __info "ARCH: ${ARCH}" @@ -134,7 +150,7 @@ while read -r VERSION_PAIR; do if [ "${CURRENT_VERSION_FOUND}" = "true" ]; then MIGRATION_PATH+=("${URL// /}") fi -done < "${MIGRATION_LIST_FILE}" +done <"${MIGRATION_LIST_FILE}" if [ ${#MIGRATION_PATH[@]} -eq 0 ]; then __warning "No migration path found from ${CURRENT_VERSION} to ${SOURCE_VERSION}" @@ -143,7 +159,8 @@ fi pushd "${MIGRATION_SERVICE_DIR}" -{ for URL in "${MIGRATION_PATH[@]}"; do +{ + for URL in "${MIGRATION_PATH[@]}"; do MIGRATION_TOOL_FILE=$(basename "${URL}") if [ -f "${MIGRATION_TOOL_FILE}" ]; then diff --git a/build/scripts/migration/service.d/casaos/migration.list b/build/scripts/migration/service.d/casaos/migration.list index c780280..758088f 100644 --- a/build/scripts/migration/service.d/casaos/migration.list +++ b/build/scripts/migration/service.d/casaos/migration.list @@ -1,3 +1,3 @@ -LEGACY_WITHOUT_VERSION https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz -v0.3.5 https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz -v0.3.5.1 https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz +LEGACY_WITHOUT_VERSION ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz +v0.3.5 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz +v0.3.5.1 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz \ No newline at end of file From b9946db8542c9a73d9edfbb189c941fddd1d0811 Mon Sep 17 00:00:00 2001 From: link Date: Thu, 5 Jan 2023 15:16:54 +0800 Subject: [PATCH 2/5] repair the error of version number display after successful update (#805) --- service/system.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/service/system.go b/service/system.go index bc3c076..1986745 100644 --- a/service/system.go +++ b/service/system.go @@ -232,6 +232,8 @@ func (c *systemService) GetNet(physics bool) []string { } func (s *systemService) UpdateSystemVersion(version string) { + keyName := "casa_version" + Cache.Delete(keyName) if file.Exists(config.AppInfo.LogPath + "/upgrade.log") { os.Remove(config.AppInfo.LogPath + "/upgrade.log") } From 91bb0cba6f4a9022f6ab6d796989857f81832138 Mon Sep 17 00:00:00 2001 From: link Date: Sun, 8 Jan 2023 15:33:48 +0800 Subject: [PATCH 3/5] Update CHANGELOG.md Signed-off-by: link --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 364322b..f5e6d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## [0.4.1-alpha] - 2023-1-8 + +### Added +- [Disj] Added disk merging feature in storage management (beta) that allows for multiple disks to be merged into a single storage space +- [System] Added option for startpage.com search engine +- [APP] Added app cloning feature in the app's context menu. +- +### Changed +- [APP] Improved app installation process, including display of the installation process, checks for successful installation, and prompts + + ## [0.4.0] - 2022-12-13 ### Added From be505795442d465263f566bf04884eddd3b1b925 Mon Sep 17 00:00:00 2001 From: link Date: Mon, 9 Jan 2023 15:16:04 +0800 Subject: [PATCH 4/5] add update type (#812) --- go.mod | 2 +- go.sum | 4 ++-- service/system.go | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index caa4be7..556d251 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d - github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha2 + github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha3 github.com/benbjohnson/clock v1.3.0 // indirect github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/disintegration/imaging v1.6.2 diff --git a/go.sum b/go.sum index ff80f22..f343921 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0 github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d h1:62lEBImTxZ83pgzywgDNIrPPuQ+j4ep9QjqrWBn1hrU= github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ= -github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha2 h1:O6vDvIy+wFBj6DuUN4ZDLa6M7Cg80SXXpMsM9t2EqpA= -github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha2/go.mod h1:xcemiRsXcs1zrmQxYMyExDjZ7UHYwkJqYE71IDIV0xA= +github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha3 h1:jQfIty6u06fPJCutpS+97qr8uho3RpQX+B/CwHPCv/Q= +github.com/IceWhaleTech/CasaOS-Common v0.4.1-alpha3/go.mod h1:xcemiRsXcs1zrmQxYMyExDjZ7UHYwkJqYE71IDIV0xA= github.com/andybalholm/brotli v1.0.1 h1:KqhlKozYbRtJvsPrrEeXcO+N2l6NYT5A2QAFmSULpEc= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= diff --git a/service/system.go b/service/system.go index 1986745..f821413 100644 --- a/service/system.go +++ b/service/system.go @@ -13,12 +13,13 @@ import ( "strings" "time" + "github.com/IceWhaleTech/CasaOS-Common/utils/file" "github.com/IceWhaleTech/CasaOS-Common/utils/logger" "github.com/IceWhaleTech/CasaOS/model" "github.com/IceWhaleTech/CasaOS/pkg/config" command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command" "github.com/IceWhaleTech/CasaOS/pkg/utils/common_err" - "github.com/IceWhaleTech/CasaOS/pkg/utils/file" + "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/disk" "github.com/shirou/gopsutil/v3/host" @@ -242,7 +243,8 @@ func (s *systemService) UpdateSystemVersion(version string) { if len(config.ServerInfo.UpdateUrl) > 0 { go command2.OnlyExec("curl -fsSL " + config.ServerInfo.UpdateUrl + " | bash") } else { - go command2.OnlyExec("curl -fsSL https://get.casaos.io/update | bash") + osRelease, _ := file.ReadOSRelease() + go command2.OnlyExec("curl -fsSL https://get.casaos.io/update?t=" + osRelease["MANUFACTURER"] + " | bash") } // s.log.Error(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version) From 9123974811cdee4eaeb84520d2536672bf2ef30c Mon Sep 17 00:00:00 2001 From: link Date: Mon, 9 Jan 2023 18:08:47 +0800 Subject: [PATCH 5/5] Update CHANGELOG.md Signed-off-by: link --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5e6d2d..6e0eb85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security + ## [0.4.1-alpha] - 2023-1-8 ### Added