Skip to content

Commit

Permalink
feat: delete wrong latest dir (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH authored Jan 2, 2025
1 parent ba077c5 commit b91bf21
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

MigrateOrFixOldVersion()

mux := &util_http.HandlerMultiplexer{
HandlerMap: map[string]http.Handler{
"v2": route.InitV2Router(),
Expand Down Expand Up @@ -259,3 +261,18 @@ func registerRouter(listener net.Listener) {
time.Sleep(1 * time.Second)
}
}

func MigrateOrFixOldVersion() {
Fix130WrongLatestDir()
}

func Fix130WrongLatestDir() {
// bug ref: https://icewhale.feishu.cn/wiki/J9KBwpgmFiqjt8kv17DcAz1gnch

if _, err := os.Stat(filepath.Join(config.SysRoot, filepath.Dir(config.RAUC_RELEASE_PATH), "latest")); err == nil {
err := os.Remove(filepath.Join(config.SysRoot, filepath.Dir(config.RAUC_RELEASE_PATH), "latest"))
if err != nil {
logger.Error("error when trying to remove latest dir", zap.Error(err))
}
}
}

0 comments on commit b91bf21

Please sign in to comment.