#!/bin/bash #================================================= # COMMON VARIABLES #================================================= # dependencies used by the app pkg_dependencies="php-cli php-mysql php-json php-gd php-tidy php-curl php-gettext php-redis" #================================================= # PERSONAL HELPERS #================================================= function set_permissions { # Set permissions to app files chown -R $app:www-data $final_path chmod -R g=u,g-w,o-rwx $final_path # Restrict rights to Wallabag user only chmod 600 $wb_conf if [ -e $final_path/var/cache/prod/appProdProjectContainer.php ]; then chmod 700 $final_path/var/cache/prod/appProdProjectContainer.php fi } #================================================= # EXPERIMENTAL HELPERS #================================================= # Execute a command as another user # usage: exec_as USER COMMAND [ARG ...] ynh_exec_as() { local USER=$1 shift 1 if [[ $USER = $(whoami) ]]; then eval "$@" else sudo -u "$USER" "$@" fi }