1
0
Fork 0
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:
polytan02 2017-02-24 17:47:00 +00:00
parent d2811d9103
commit db35f2396c
3 changed files with 3 additions and 6 deletions

View file

@ -151,8 +151,7 @@ sudo cp ../conf/robots.txt $final_path
runninguser="${app}-ynh" runninguser="${app}-ynh"
# 1. Create the user # 1. Create the user
# Create a system account for COPS if it doesn't already exists # Create a system account for COPS if it doesn't already exists
check_user="$(sudo grep ^${runninguser}: /etc/passwd)" if ! ynh_system_user_exists "$runninguser" ;
if [ -z "${check_user}" ];
then then
echo "The user $runninguser does not exist, we can create it" echo "The user $runninguser does not exist, we can create it"
sudo useradd -c "$runninguser system account" \ sudo useradd -c "$runninguser system account" \

View file

@ -45,8 +45,7 @@ sudo cp -a ./sources/* $final_path/
runninguser="${app}-ynh" runninguser="${app}-ynh"
# 1. Create the user # 1. Create the user
# Create a system account for COPS if it doesn't already exists # Create a system account for COPS if it doesn't already exists
check_user="$(sudo grep ^${runninguser}: /etc/passwd)" if ! ynh_system_user_exists "$runninguser" ;
if [ -z "${check_user}" ];
then then
echo "The user $runninguser does not exist, we can create it" echo "The user $runninguser does not exist, we can create it"
sudo useradd -c "$runninguser system account" \ sudo useradd -c "$runninguser system account" \

View file

@ -83,8 +83,7 @@ sudo cp ../conf/robots.txt $final_path
runninguser="${app}-ynh" runninguser="${app}-ynh"
# 1. Create the user # 1. Create the user
# Create a system account for COPS if it doesn't already exists # Create a system account for COPS if it doesn't already exists
check_user="$(sudo grep ^${runninguser}: /etc/passwd)" if ! ynh_system_user_exists "$runninguser" ;
if [ -z "${check_user}" ];
then then
echo "The user $runninguser does not exist, we can create it" echo "The user $runninguser does not exist, we can create it"
sudo useradd -c "$runninguser system account" \ sudo useradd -c "$runninguser system account" \