aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-01-30 16:33:36 +0000
committerGitHub <noreply@github.com>2022-01-30 16:33:36 +0000
commite5ec7a086f649751f4496e69ea64ba18aecdb73d (patch)
treefa2c5f7eb294e2ddbdfbd6106d378edb676abf4a /modules/setting
parent246902cd635339e914a074b678f8ec6f6b954b59 (diff)
downloadgitea-e5ec7a086f649751f4496e69ea64ba18aecdb73d.tar.gz
gitea-e5ec7a086f649751f4496e69ea64ba18aecdb73d.zip
Warn at startup if the provided `SCRIPT_TYPE` is not on the PATH (#18467)
Several users run Gitea in situations whereby `bash` is not available. If the `SCRIPT_TYPE` is not changed this will cause hooks to fail. A simple test to check if the provided type is on the PATH should be sufficient to warn them about this problem. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/repository.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/setting/repository.go b/modules/setting/repository.go
index d2c0e205d5..f4a2f4ad66 100644
--- a/modules/setting/repository.go
+++ b/modules/setting/repository.go
@@ -5,6 +5,7 @@
package setting
import (
+ "os/exec"
"path"
"path/filepath"
"strings"
@@ -278,6 +279,10 @@ func newRepository() {
}
ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash")
+ if _, err := exec.LookPath(ScriptType); err != nil {
+ log.Warn("SCRIPT_TYPE %q is not on the current PATH. Are you sure that this is the correct SCRIPT_TYPE?", ScriptType)
+ }
+
if err = Cfg.Section("repository").MapTo(&Repository); err != nil {
log.Fatal("Failed to map Repository settings: %v", err)
} else if err = Cfg.Section("repository.editor").MapTo(&Repository.Editor); err != nil {