1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

feat: Fix the initialization errors of GeoIP (#7345)

This commit is contained in:
ssongliu 2024-12-12 14:55:49 +08:00 committed by GitHub
parent c35f55f70c
commit 82e9e72c70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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