Skip to content

Commit

Permalink
Fix upgrade.sh script error with su -c (#19483)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mokeyish and wxiaoguang authored Apr 27, 2022
1 parent 5651c65 commit af09136
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af09136

Please sign in to comment.