1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

Merge pull request #412 from YunoHost-Apps/use-official-helper-ynh_exec_as

Use ynh_exec_as
This commit is contained in:
Kayou 2021-05-27 16:46:10 +02:00 committed by GitHub
commit 9ac9cb5b5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 18 deletions

View file

@ -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() {

View file

@ -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 "$@")
}

View file

@ -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 "$@")
}

View file

@ -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 "$@")
}