From 8798babe074430abf7ffe08869ba1f433b163f96 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 23 May 2024 10:14:49 +0800 Subject: [PATCH] =?UTF-8?q?pref:=201pctl=20=E5=BC=95=E7=94=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E4=BD=BF=E7=94=A8=E6=BA=90=E6=96=87=E4=BB=B6=E4=BB=A3?= =?UTF-8?q?=E6=9B=BF=E8=BD=AF=E9=93=BE=E5=9C=B0=E5=9D=80=20(#5105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #4930 --- backend/init/viper/viper.go | 6 +++--- cmd/server/cmd/restore.go | 2 +- cmd/server/cmd/root.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/init/viper/viper.go b/backend/init/viper/viper.go index 1a631e88d..7cae3824b 100644 --- a/backend/init/viper/viper.go +++ b/backend/init/viper/viper.go @@ -101,19 +101,19 @@ func Init() { } func loadParams(param string) string { - stdout, err := cmd.Execf("grep '^%s=' /usr/bin/1pctl | cut -d'=' -f2", param) + stdout, err := cmd.Execf("grep '^%s=' /usr/local/bin/1pctl | cut -d'=' -f2", param) if err != nil { panic(err) } info := strings.ReplaceAll(stdout, "\n", "") if len(info) == 0 || info == `""` { - panic(fmt.Sprintf("error `%s` find in /usr/bin/1pctl", param)) + panic(fmt.Sprintf("error `%s` find in /usr/local/bin/1pctl", param)) } return info } func loadChangeInfo() string { - stdout, err := cmd.Exec("grep '^CHANGE_USER_INFO=' /usr/bin/1pctl | cut -d'=' -f2") + stdout, err := cmd.Exec("grep '^CHANGE_USER_INFO=' /usr/local/bin/1pctl | cut -d'=' -f2") if err != nil { return "" } diff --git a/cmd/server/cmd/restore.go b/cmd/server/cmd/restore.go index c59fba859..ba04c0fae 100644 --- a/cmd/server/cmd/restore.go +++ b/cmd/server/cmd/restore.go @@ -27,7 +27,7 @@ var restoreCmd = &cobra.Command{ fmt.Println("请使用 sudo 1pctl restore 或者切换到 root 用户") return nil } - stdout, err := cmdUtils.Exec("grep '^BASE_DIR=' /usr/bin/1pctl | cut -d'=' -f2") + stdout, err := cmdUtils.Exec("grep '^BASE_DIR=' /usr/local/bin/1pctl | cut -d'=' -f2") if err != nil { return fmt.Errorf("handle load `BASE_DIR` failed, err: %v", err) } diff --git a/cmd/server/cmd/root.go b/cmd/server/cmd/root.go index 2968f9e91..78023bd3b 100644 --- a/cmd/server/cmd/root.go +++ b/cmd/server/cmd/root.go @@ -34,13 +34,13 @@ type setting struct { } func loadDBConn() (*gorm.DB, error) { - stdout, err := cmdUtils.Exec("grep '^BASE_DIR=' /usr/bin/1pctl | cut -d'=' -f2") + stdout, err := cmdUtils.Exec("grep '^BASE_DIR=' /usr/local/bin/1pctl | cut -d'=' -f2") if err != nil { return nil, fmt.Errorf("handle load `BASE_DIR` failed, err: %v", err) } baseDir := strings.ReplaceAll(stdout, "\n", "") if len(baseDir) == 0 { - return nil, fmt.Errorf("error `BASE_DIR` find in /usr/bin/1pctl \n") + return nil, fmt.Errorf("error `BASE_DIR` find in /usr/local/bin/1pctl \n") } if strings.HasSuffix(baseDir, "/") { baseDir = baseDir[:strings.LastIndex(baseDir, "/")]