From c8a2889c0a04e746dd9cba10d8e7bd81a48828f3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 10 Nov 2020 11:05:07 +0100 Subject: [PATCH] Fix --- README.md | 2 ++ README_fr.md | 2 ++ scripts/_common.sh | 13 +++++++++++++ scripts/upgrade | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5062c2a..cc0ab1b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Invidious is an alternative front-end to YouTube. ## Configuration +You can configure Invidious by modifying the configuration file `/var/www/invidious/config/config.yaml` with the help of this [documentation](https://github.com/iv-org/invidious/wiki/Configuration). + ## Documentation * Official documentation: https://github.com/iv-org/invidious/wiki diff --git a/README_fr.md b/README_fr.md index b88489b..1e19116 100644 --- a/README_fr.md +++ b/README_fr.md @@ -23,6 +23,8 @@ Invidious est une interface alternative à YouTube. ## Configuration +Vous pouvez configurer Invidious en modifiant le fichier de configuration `/var/www/invidious/config/config.yaml` avec l'aide de cette [documentation](https://github.com/iv-org/invidious/wiki/Configuration). + ## Documentation * Documentation officielle : https://github.com/iv-org/invidious/wiki diff --git a/scripts/_common.sh b/scripts/_common.sh index 50e0c9d..eddc170 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,3 +18,16 @@ pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp- #================================================= # FUTURE OFFICIAL HELPERS #================================================= + +# Execute a command as another user +# usage: ynh_exec_as USER COMMAND [ARG ...] +ynh_exec_as() { + local USER=$1 + shift 1 + + if [[ $USER = $(whoami) ]]; then + eval "$@" + else + sudo -u "$USER" "$@" + fi +} \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index ef21ea4..b8dfcde 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,7 +73,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 -pushd "$final_path" || ynh_die +ynh_exec_as $app ( + pushd "$final_path" || ynh_die currentVersion=$(git rev-list --max-count=1 --abbrev-commit HEAD) git pull for i in `git rev-list --reverse --abbrev-commit $currentVersion..HEAD` ; do file=./config/migrate-scripts/migrate-db-$i.sh ; [ -f $file ] && $file ; done @@ -82,6 +83,7 @@ pushd "$final_path" || ynh_die exit popd || ynh_die fi +) #================================================= # NGINX CONFIGURATION