mirror of
https://github.com/YunoHost-Apps/cops_ynh.git
synced 2024-09-03 18:25:57 +02:00
Check if user exists using ynh helpers
This commit is contained in:
parent
d2811d9103
commit
db35f2396c
3 changed files with 3 additions and 6 deletions
|
@ -151,8 +151,7 @@ sudo cp ../conf/robots.txt $final_path
|
|||
runninguser="${app}-ynh"
|
||||
# 1. Create the user
|
||||
# Create a system account for COPS if it doesn't already exists
|
||||
check_user="$(sudo grep ^${runninguser}: /etc/passwd)"
|
||||
if [ -z "${check_user}" ];
|
||||
if ! ynh_system_user_exists "$runninguser" ;
|
||||
then
|
||||
echo "The user $runninguser does not exist, we can create it"
|
||||
sudo useradd -c "$runninguser system account" \
|
||||
|
|
|
@ -45,8 +45,7 @@ sudo cp -a ./sources/* $final_path/
|
|||
runninguser="${app}-ynh"
|
||||
# 1. Create the user
|
||||
# Create a system account for COPS if it doesn't already exists
|
||||
check_user="$(sudo grep ^${runninguser}: /etc/passwd)"
|
||||
if [ -z "${check_user}" ];
|
||||
if ! ynh_system_user_exists "$runninguser" ;
|
||||
then
|
||||
echo "The user $runninguser does not exist, we can create it"
|
||||
sudo useradd -c "$runninguser system account" \
|
||||
|
|
|
@ -83,8 +83,7 @@ sudo cp ../conf/robots.txt $final_path
|
|||
runninguser="${app}-ynh"
|
||||
# 1. Create the user
|
||||
# Create a system account for COPS if it doesn't already exists
|
||||
check_user="$(sudo grep ^${runninguser}: /etc/passwd)"
|
||||
if [ -z "${check_user}" ];
|
||||
if ! ynh_system_user_exists "$runninguser" ;
|
||||
then
|
||||
echo "The user $runninguser does not exist, we can create it"
|
||||
sudo useradd -c "$runninguser system account" \
|
||||
|
|
Loading…
Reference in a new issue