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:
commit
9ac9cb5b5f
4 changed files with 3 additions and 18 deletions
|
@ -12,21 +12,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php
|
||||||
# EXPERIMENTAL HELPERS
|
# 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
|
# Check if an URL is already handled
|
||||||
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI
|
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI
|
||||||
is_url_handled() {
|
is_url_handled() {
|
||||||
|
|
|
@ -101,7 +101,7 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..."
|
||||||
|
|
||||||
# Define a function to execute commands with `occ`
|
# Define a function to execute commands with `occ`
|
||||||
exec_occ() {
|
exec_occ() {
|
||||||
(cd "$final_path" && exec_as "$app" \
|
(cd "$final_path" && ynh_exec_as "$app" \
|
||||||
php${phpversion} occ --no-interaction --no-ansi "$@")
|
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`
|
# Define a function to execute commands with `occ`
|
||||||
exec_occ() {
|
exec_occ() {
|
||||||
(cd "$final_path" && exec_as "$app" \
|
(cd "$final_path" && ynh_exec_as "$app" \
|
||||||
php${phpversion} occ --no-interaction --no-ansi "$@")
|
php${phpversion} occ --no-interaction --no-ansi "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ exec_occ() {
|
||||||
else
|
else
|
||||||
NEXTCLOUD_PHP_VERSION="7.0"
|
NEXTCLOUD_PHP_VERSION="7.0"
|
||||||
fi
|
fi
|
||||||
(cd "$final_path" && exec_as "$app" \
|
(cd "$final_path" && ynh_exec_as "$app" \
|
||||||
php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@")
|
php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue