Check if dir already exists
This way it's avoid the chown/chmod on an existing home/work directory.
This commit is contained in:
parent
574d1fc318
commit
7ce55bcce1
|
@ -27,6 +27,15 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# }}}
|
||||
# Check if homedir already exist {{{
|
||||
if [ $(ls -1d "${user_homedir_path}" 2> /dev/null) ]; then
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : homedir check — ${user_homedir_path} already exists. Abord this script."
|
||||
exit 1
|
||||
else
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : homedir check — ${user_homedir_path} doesn't exists. Continue."
|
||||
fi
|
||||
|
||||
# }}}
|
||||
# Check group exist {{{
|
||||
if [ "${user_primary_group}" ]; then
|
||||
|
|
|
@ -27,6 +27,15 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# }}}
|
||||
# Check if workdir already exist {{{
|
||||
if [ $(ls -1d "${user_workdir_path}" 2> /dev/null) ]; then
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : workdir check — ${user_workdir_path} already exists. Abord this script."
|
||||
exit 1
|
||||
else
|
||||
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : workdir check — ${user_workdir_path} doesn't exists. Continue."
|
||||
fi
|
||||
|
||||
# }}}
|
||||
# Check group exist {{{
|
||||
if [ "${user_primary_group}" ]; then
|
||||
|
|
Loading…
Reference in New Issue