diff --git a/bootstrap.sh b/bootstrap.sh index 931d432..79a281a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -146,10 +146,14 @@ create_directories() { _loop_wrapper "${SCRIPT_DIR}/directories.txt" \ 'Creating directory $(echo $x | cut -d"," -f1)' \ ' + set -e dir=$(echo $x | cut -d"," -f1) mod=$(echo $x | cut -d"," -f2) + [ "$dir" = "$mod" ] && mod="755" + [ -d "${user_home}/${dir}" ] || mkdir -p "${user_home}/${dir}" sudo -u "$username" mkdir -p "${user_home}/${dir}" chmod "${mod}" "${user_home}/${dir}" + set +e ' info "Done!" } @@ -191,6 +195,7 @@ enable_services() { finalize() { gid=$(getent passwd "$username" | cut -d ':' -f 4) groupname=$(getent group "$gid" | cut -d ':' -f 1) + info "Setting ownership of home directories..." chown "$username:$groupname" -R "$user_home" info "Done!" } diff --git a/directories.txt b/directories.txt index 61d117c..5fac2ab 100644 --- a/directories.txt +++ b/directories.txt @@ -1,14 +1,14 @@ -.cache,755 +.cache .config -.config/dwm/autorun.d,755 -.local/libexec/,755 -.local/log,755 -.local/share/,755 -.local/state,755 -.local/sv,755 +.config/dwm/autorun.d +.local/libexec/ +.local/log +.local/share/ +.local/state +.local/sv +Desktop +Documents/dev +Downloads +Pictures/Screenshots +Videos .ssh,700 -Desktop,755 -Documents/dev,755 -Downloads,755 -Pictures/Screenshots,755 -Videos,755