From fbdc4556d519512736a8e2abfb3e03fcb2c9e0c7 Mon Sep 17 00:00:00 2001 From: Levin Winter <33220502+levinwinter@users.noreply.github.com> Date: Thu, 26 Jan 2023 00:57:31 +0100 Subject: [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. --- src/common-utils/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index c8541cd..2a8cd28 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -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 -- cgit v1.2.3