goldilocks.js/installer/my-user-my-group.sh

18 lines
440 B
Bash

if [ -n "$(type -p adduser)" ]; then
$sudo_cmd adduser --home /opt/$my_app_name --gecos '' --disabled-password $my_app_name
my_user=$my_app_name
my_group=$my_app_name
elif [ -n "$(cat /etc/passwd | grep www-data:)" ]; then
# Linux (Ubuntu)
my_user=www-data
my_group=www-data
elif [ -n "$(cat /etc/passwd | grep _www:)" ]; then
# Mac
my_user=_www
my_group=_www
else
# Unsure
my_user=$(whoami)
my_group=$(id -g -n)
fi