aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorYISH2022-04-27 11:30:29 +0800
committerGitHub2022-04-26 23:30:29 -0400
commitaf09136b95486e41ebd458e5209fd53a3b308447 (patch)
treec6d4682b9403f6006487756eeb7e93d77178634f /contrib
parent5651c650c09accbb01bfe21e268f7d289a3b5d19 (diff)
Fix `upgrade.sh` script error with `su -c` (#19483)
* Fix scirpt err with `su -c`, add env auto loading. * Update upgrade.sh * Update upgrade.sh * Update contrib/upgrade.sh Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/upgrade.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/upgrade.sh b/contrib/upgrade.sh
index 9a5e903b6..3a98c277d 100755
--- a/contrib/upgrade.sh
+++ b/contrib/upgrade.sh
@@ -24,7 +24,8 @@
function giteacmd {
if [[ $sudocmd = "su" ]]; then
- "$sudocmd" - "$giteauser" -c "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
+ # `-c` only accept one string as argument.
+ "$sudocmd" - "$giteauser" -c "$(printf "%q " "$giteabin" "--config" "$giteaconf" "--work-path" "$giteahome" "$@")"
else
"$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
fi