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
parent
commit
9ac9cb5b5f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      scripts/_common.sh
  2. 2
      scripts/change_url
  3. 2
      scripts/install
  4. 2
      scripts/upgrade

15
scripts/_common.sh

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

2
scripts/change_url

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

2
scripts/install

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

2
scripts/upgrade

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

Loading…
Cancel
Save