From e9c73a1006a4c657e08f3128f4810880b1191494 Mon Sep 17 00:00:00 2001 From: CorrectRoad Date: Fri, 24 Jan 2025 17:18:51 +0800 Subject: [PATCH] fix: fix lose migrate (#207) --- .../service.d/app-management/migration.list | 1 + cmd/migration-tool/main.go | 2 +- ..._and_older.go => migration_0415_and_older.go} | 16 ++++++++-------- common/constants.go | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) rename cmd/migration-tool/{migration_044_and_older.go => migration_0415_and_older.go} (82%) diff --git a/build/scripts/migration/service.d/app-management/migration.list b/build/scripts/migration/service.d/app-management/migration.list index 513f76c5..895f4751 100644 --- a/build/scripts/migration/service.d/app-management/migration.list +++ b/build/scripts/migration/service.d/app-management/migration.list @@ -4,3 +4,4 @@ v0.3.5.1 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS-AppManagement/releases/download/v v0.3.6 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS-AppManagement/releases/download/v0.4.0-alpha7/linux-${ARCH}-casaos-app-management-migration-tool-v0.4.0-alpha7.tar.gz v0.3.7 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS-AppManagement/releases/download/v0.4.0-alpha7/linux-${ARCH}-casaos-app-management-migration-tool-v0.4.0-alpha7.tar.gz v0.3.8 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS-AppManagement/releases/download/v0.4.0-alpha7/linux-${ARCH}-casaos-app-management-migration-tool-v0.4.0-alpha7.tar.gz +v0.4.5 ${DOWNLOAD_DOMAIN}IceWhaleTech/CasaOS-AppManagement/releases/download/v0.4.16/linux-${ARCH}-casaos-app-management-migration-tool-v0.4.16.tar.gz diff --git a/cmd/migration-tool/main.go b/cmd/migration-tool/main.go index 4ba5a43b..fcb687e0 100644 --- a/cmd/migration-tool/main.go +++ b/cmd/migration-tool/main.go @@ -69,7 +69,7 @@ func main() { migrationTools := []interfaces.MigrationTool{ // NewMigrationDummy(), - NewMigration044AndOlder(), + NewMigration0415AndOlder(), NewMigration0412AndOlder(), } diff --git a/cmd/migration-tool/migration_044_and_older.go b/cmd/migration-tool/migration_0415_and_older.go similarity index 82% rename from cmd/migration-tool/migration_044_and_older.go rename to cmd/migration-tool/migration_0415_and_older.go index 66dffcff..4cb16342 100644 --- a/cmd/migration-tool/migration_044_and_older.go +++ b/cmd/migration-tool/migration_0415_and_older.go @@ -22,13 +22,13 @@ var replaceUrl = []UrlReplacement{ }, { OldUrl: "https://casaos.oss-cn-shanghai.aliyuncs.com/IceWhaleTech/_appstore/archive/refs/heads/main.zip", - NewUrl: "https://casaos.oss-cn-shanghai.aliyuncs.com/store/main.zip", + NewUrl: "https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@gh-pages/store/main.zip", }, } -type migrationTool044AndOlder struct{} +type migrationTool0415AndOlder struct{} -func (u *migrationTool044AndOlder) IsMigrationNeeded() (bool, error) { +func (u *migrationTool0415AndOlder) IsMigrationNeeded() (bool, error) { _logger.Info("Checking if migration is needed...") // read string from AppManagementConfigFilePath @@ -53,11 +53,11 @@ func (u *migrationTool044AndOlder) IsMigrationNeeded() (bool, error) { return false, nil } -func (u *migrationTool044AndOlder) PreMigrate() error { +func (u *migrationTool0415AndOlder) PreMigrate() error { return nil } -func (u *migrationTool044AndOlder) Migrate() error { +func (u *migrationTool0415AndOlder) Migrate() error { // replace string in AppManagementConfigFilePath // replace https://github.com/IceWhaleTech/_appstore/archive/refs/heads/main.zip to https://casaos-appstore.github.io/casaos-appstore/linux-all-appstore.zip file, err := os.OpenFile(config.AppManagementConfigFilePath, os.O_RDWR, 0644) @@ -92,10 +92,10 @@ func (u *migrationTool044AndOlder) Migrate() error { return nil } -func (u *migrationTool044AndOlder) PostMigrate() error { +func (u *migrationTool0415AndOlder) PostMigrate() error { return nil } -func NewMigration044AndOlder() interfaces.MigrationTool { - return &migrationTool044AndOlder{} +func NewMigration0415AndOlder() interfaces.MigrationTool { + return &migrationTool0415AndOlder{} } diff --git a/common/constants.go b/common/constants.go index fdbd1b6b..eae053e6 100644 --- a/common/constants.go +++ b/common/constants.go @@ -2,7 +2,7 @@ package common const ( AppManagementServiceName = "app-management" - AppManagementVersion = "0.4.5" + AppManagementVersion = "0.4.16" AppsDirectoryName = "Apps"