mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# COMMON VARIABLES
|
|
#=================================================
|
|
|
|
# dependencies used by the app
|
|
#pkg_dependencies="ruby ruby-dev rails zlib1g-dev libsqlite3-dev default-libmysqlclient-dev libssl-dev libreadline-dev"
|
|
pkg_dependencies=" zlib1g-dev libsqlite3-dev default-libmysqlclient-dev libssl-dev libreadline-dev"
|
|
|
|
#=================================================
|
|
# PERSONAL HELPERS
|
|
#=================================================
|
|
|
|
# Execute a command as another user with login
|
|
# (hence in user home dir, with prior loading of .profile, etc.)
|
|
# usage: exec_login_as USER COMMAND [ARG ...]
|
|
exec_login_as() {
|
|
local user=$1
|
|
shift 1
|
|
exec_as $user --login "$@"
|
|
}
|
|
# 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
|
|
}
|
|
|
|
#================================================
|
|
# EXPERIMENTAL HELPERS
|
|
#=================================================
|
|
|
|
#=================================================
|
|
# FUTURE OFFICIAL HELPERS
|
|
#=================================================
|