Skip to content

Commit

Permalink
feat: Fix the initialization errors of GeoIP (#7345)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Dec 12, 2024
1 parent c35f55f commit 82e9e72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/app/service/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ func (u *UpgradeService) handleRollback(originalDir string, errStep int) {
global.LOG.Errorf("rollback 1panel failed, err: %v", err)
}
_, _ = cmd.Execf("cp -r %s /usr/local/bin", path.Join(originalDir, "lang"))
_, _ = cmd.Execf("cp %s %s", path.Join(originalDir, "GeoIP.mmdb"), path.Join(global.CONF.System.BaseDir, "1panel/geo/"))
geoPath := path.Join(global.CONF.System.BaseDir, "1panel/geo")
_, _ = cmd.Execf("mkdir %s && cp %s %s/", geoPath, path.Join(originalDir, "GeoIP.mmdb"), geoPath)

if errStep == 2 {
return
Expand Down
2 changes: 1 addition & 1 deletion backend/init/lang/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func initLang() {
downloadGeoFromRemote(fileOp, geoPath)
return
}
std, err := cmd.Execf("cp %s %s/", path.Join(tmpPath, "GeoIP.mmdb"), path.Dir(geoPath))
std, err := cmd.Execf("mkdir %s && cp %s %s/", path.Dir(geoPath), path.Join(tmpPath, "GeoIP.mmdb"), path.Dir(geoPath))
if err != nil {
global.LOG.Errorf("load geo ip from package failed, std: %s, err: %v", std, err)
return
Expand Down
3 changes: 2 additions & 1 deletion cmd/server/cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ var restoreCmd = &cobra.Command{
return err
}
_, _ = cmdUtils.Execf("cp -r %s /usr/local/bin", path.Join(tmpPath, "lang"))
_, _ = cmdUtils.Execf("cp %s %s", path.Join(tmpPath, "GeoIP.mmdb"), path.Join(global.CONF.System.BaseDir, "1panel/geo/"))
geoPath := path.Join(global.CONF.System.BaseDir, "1panel/geo")
_, _ = cmdUtils.Execf("mkdir %s && cp %s %s/", geoPath, path.Join(tmpPath, "GeoIP.mmdb"), geoPath)
fmt.Println(i18n.GetMsgByKeyForCmd("RestoreStep3"))
if err := common.CopyFile(path.Join(tmpPath, "1panel.service"), "/etc/systemd/system"); err != nil {
return err
Expand Down

0 comments on commit 82e9e72

Please sign in to comment.