Browse Source
Merge pull request #412 from YunoHost-Apps/use-official-helper-ynh_exec_as
Use ynh_exec_as
pull/125/merge
Kayou
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
3 additions and
18 deletions
-
scripts/_common.sh
-
scripts/change_url
-
scripts/install
-
scripts/upgrade
|
|
|
@ -12,21 +12,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php |
|
|
|
# EXPERIMENTAL HELPERS |
|
|
|
#================================================= |
|
|
|
|
|
|
|
# Execute a command as another user |
|
|
|
# usage: exec_as USER COMMAND [ARG ...] |
|
|
|
exec_as() { |
|
|
|
local USER=$1 |
|
|
|
shift 1 |
|
|
|
|
|
|
|
if [[ $USER = $(whoami) ]]; then |
|
|
|
eval "$@" |
|
|
|
else |
|
|
|
sudo -u "$USER" "$@" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
#================================================= |
|
|
|
|
|
|
|
# Check if an URL is already handled |
|
|
|
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI |
|
|
|
is_url_handled() { |
|
|
|
|
|
|
|
@ -101,7 +101,7 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..." |
|
|
|
|
|
|
|
# Define a function to execute commands with `occ` |
|
|
|
exec_occ() { |
|
|
|
(cd "$final_path" && exec_as "$app" \ |
|
|
|
(cd "$final_path" && ynh_exec_as "$app" \ |
|
|
|
php${phpversion} occ --no-interaction --no-ansi "$@") |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -142,7 +142,7 @@ ynh_script_progression --message="Installing Nextcloud..." --weight=30 |
|
|
|
|
|
|
|
# Define a function to execute commands with `occ` |
|
|
|
exec_occ() { |
|
|
|
(cd "$final_path" && exec_as "$app" \ |
|
|
|
(cd "$final_path" && ynh_exec_as "$app" \ |
|
|
|
php${phpversion} occ --no-interaction --no-ansi "$@") |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -193,7 +193,7 @@ exec_occ() { |
|
|
|
else |
|
|
|
NEXTCLOUD_PHP_VERSION="7.0" |
|
|
|
fi |
|
|
|
(cd "$final_path" && exec_as "$app" \ |
|
|
|
(cd "$final_path" && ynh_exec_as "$app" \ |
|
|
|
php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") |
|
|
|
} |
|
|
|
|
|
|
|
|