diff options
author | Stephen A. Imhoff <clockwork-muse@outlook.com> | 2023-01-13 22:05:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 22:05:53 +0300 |
commit | 1726222515e9d03c05f48bb4a03895afd09525a7 (patch) | |
tree | 814c2ee52630e55c93c2df385ae919b5c10b16dc /src/common-utils/main.sh | |
parent | 74dd2710dc77b85d6ad72c4534f4c7d7f67b86b2 (diff) |
CommonUtils - ensure home directory exists. (#398)
* CommonUtils - ensure home directory exists.
* Only create non-root home directory
Root directory will always exist.
* Bump version
Diffstat (limited to 'src/common-utils/main.sh')
-rw-r--r-- | src/common-utils/main.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index ff2c54c..893f53a 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -383,6 +383,10 @@ if [ "${USERNAME}" = "root" ]; then user_rc_path="/root" else user_rc_path="/home/${USERNAME}" + if [ ! -d "${user_rc_path}" ]; then + mkdir -p "${user_rc_path}" + chown ${USERNAME}:${group_name} "${user_rc_path}" + fi fi # Restore user .bashrc / .profile / .zshrc defaults from skeleton file if it doesn't exist or is empty |