1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/openproject_ynh.git synced 2024-09-03 19:56:10 +02:00
openproject_ynh/scripts/_common.sh
2019-10-01 22:36:58 +02:00

42 lines
1.2 KiB
Bash

#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev git curl poppler-utils unrtf tesseract-ocr catdoc libxml2 libxml2-dev libxslt1-dev memcached rbenv postgresql postgresql-contrib libpq-dev apt-transport-https ca-certificates nginx"
#=================================================
# PERSONAL HELPERS
#=================================================
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" sh -c ". ~/.profile && $@"
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
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================