mirror of
https://github.com/YunoHost-Apps/cops_ynh.git
synced 2024-09-03 18:25:57 +02:00
Simpler test to check if user cops-ynh exists or not
This commit is contained in:
parent
5142190959
commit
061386e23a
3 changed files with 15 additions and 15 deletions
|
@ -151,14 +151,14 @@ 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
|
||||||
getent passwd $runninguser > /dev/null 2&>1
|
test="$(grep ^${tuser}: /etc/passwd)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "${test}" ]; then
|
||||||
echo "The user $runninguser exists, no need to create it"
|
echo "The user $runninguser does not exist, we can create it"
|
||||||
else
|
|
||||||
echo "No, the user $runninguser does not exist, we can create it"
|
|
||||||
sudo useradd -c "$runninguser system account" \
|
sudo useradd -c "$runninguser system account" \
|
||||||
-d $final_path --system --user-group $runninguser \
|
-d $final_path --system --user-group $runninguser \
|
||||||
|| ynh_die "Unable to create $runninguser system account"
|
|| ynh_die "Unable to create $runninguser system account"
|
||||||
|
else
|
||||||
|
echo "The user $runninguser exists, no need to create it"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_app_setting_set "$app" runninguser "$runninguser"
|
ynh_app_setting_set "$app" runninguser "$runninguser"
|
||||||
|
|
|
@ -45,14 +45,14 @@ 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
|
||||||
getent passwd $runninguser > /dev/null 2&>1
|
test="$(grep ^${tuser}: /etc/passwd)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "${test}" ]; then
|
||||||
echo "The user $runninguser exists, no need to create it"
|
echo "The user $runninguser does not exist, we can create it"
|
||||||
else
|
|
||||||
echo "No, the user $runninguser does not exist, we can create it"
|
|
||||||
sudo useradd -c "$runninguser system account" \
|
sudo useradd -c "$runninguser system account" \
|
||||||
-d $final_path --system --user-group $runninguser \
|
-d $final_path --system --user-group $runninguser \
|
||||||
|| ynh_die "Unable to create $runninguser system account"
|
|| ynh_die "Unable to create $runninguser system account"
|
||||||
|
else
|
||||||
|
echo "The user $runninguser exists, no need to create it"
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set "$app" runninguser "$runninguser"
|
ynh_app_setting_set "$app" runninguser "$runninguser"
|
||||||
|
|
||||||
|
|
|
@ -83,14 +83,14 @@ 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
|
||||||
getent passwd $runninguser > /dev/null 2&>1
|
test="$(grep ^${tuser}: /etc/passwd)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ -n "${test}" ]; then
|
||||||
echo "The user $runninguser exists, no need to create it"
|
echo "The user $runninguser does not exist, we can create it"
|
||||||
else
|
|
||||||
echo "No, the user $runninguser does not exist, we can create it"
|
|
||||||
sudo useradd -c "$runninguser system account" \
|
sudo useradd -c "$runninguser system account" \
|
||||||
-d $final_path --system --user-group $runninguser \
|
-d $final_path --system --user-group $runninguser \
|
||||||
|| ynh_die "Unable to create $runninguser system account"
|
|| ynh_die "Unable to create $runninguser system account"
|
||||||
|
else
|
||||||
|
echo "The user $runninguser exists, no need to create it"
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set "$app" runninguser "$runninguser"
|
ynh_app_setting_set "$app" runninguser "$runninguser"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue