Skip to content

Commit

Permalink
Fix upgrade.sh script error with su -c (go-gitea#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
2 people authored and AbdulrhmnGhanem committed Aug 23, 2022
1 parent 905109f commit dd19865
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 dd19865

Please sign in to comment.