1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moodle_ynh.git synced 2024-09-03 19:46:23 +02:00
moodle_ynh/scripts/_common.sh

38 lines
1.1 KiB
Bash
Raw Normal View History

2017-12-14 18:03:01 +01:00
#!/bin/bash
2020-03-24 02:27:29 +01:00
#=================================================
# COMMON VARIABLES
#=================================================
2017-12-14 18:03:01 +01:00
2020-03-24 02:27:29 +01:00
# dependencies used by the app
pkg_dependencies="postgresql"
2019-11-05 17:56:49 +01:00
2020-06-13 23:58:57 +02:00
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php$YNH_PHP_VERSION-common php$YNH_PHP_VERSION-mbstring php$YNH_PHP_VERSION-curl php$YNH_PHP_VERSION-xmlrpc php$YNH_PHP_VERSION-soap php$YNH_PHP_VERSION-zip php$YNH_PHP_VERSION-gd php$YNH_PHP_VERSION-xml php$YNH_PHP_VERSION-intl php$YNH_PHP_VERSION-json php$YNH_PHP_VERSION-pgsql php$YNH_PHP_VERSION-ldap"
#=================================================
# PERSONAL HELPERS
#=================================================
2020-03-24 02:27:29 +01:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
2017-12-14 18:51:55 +01:00
2020-03-24 02:27:29 +01:00
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
2017-12-14 18:51:55 +01:00
2020-03-24 02:27:29 +01:00
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
2020-06-13 23:58:57 +02:00
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================