Unverified Commit fbdc4556 authored by Levin Winter's avatar Levin Winter Committed by GitHub

[common-utils] Fix nonempty .bashrc being restored (#421)

* [common-utils] Fix nonempty .bashrc being restored
The user's dotfiles shall only be restored to their defaults if they do
not exist or are empty. A missing negation caused the files to be
overwritten even when they were nonempty.

* [common-utils] Bump patch version after fix
Go from 2.0.7 to 2.0.8 because of backwards-compatible fix.
parent 258d5029
......@@ -393,7 +393,7 @@ fi
possible_rc_files=( ".bashrc" ".profile" ".zshrc" )
for rc_file in "${possible_rc_files[@]}"; do
if [ -f "/etc/skel/${rc_file}" ]; then
if [ ! -e "${user_rc_path}/${rc_file}" ] || [ -s "${user_rc_path}/${rc_file}" ]; then
if [ ! -e "${user_rc_path}/${rc_file}" ] || [ ! -s "${user_rc_path}/${rc_file}" ]; then
cp "/etc/skel/${rc_file}" "${user_rc_path}/${rc_file}"
chown ${USERNAME}:${group_name} "${user_rc_path}/${rc_file}"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment