|
|
@ -43,16 +43,15 @@ function fix_users_bashrc { |
|
|
|
|
|
|
|
|
local first_change |
|
|
local first_change |
|
|
if first_change=$(diff /etc/skel/.bashrc "$user_bashrc" | head -n1); then |
|
|
if first_change=$(diff /etc/skel/.bashrc "$user_bashrc" | head -n1); then |
|
|
: |
|
|
|
|
|
|
|
|
echo 'no change' |
|
|
|
|
|
sudo -u "$user" -- cp "$MIAOU_BASH_DIR"/etc/skel/.bashrc "$user_bashrc" |
|
|
else |
|
|
else |
|
|
if [[ $first_change =~ $appended_regex ]]; then |
|
|
if [[ $first_change =~ $appended_regex ]]; then |
|
|
if new_lines=$(diff /etc/skel/.bashrc "$user_bashrc" | grep '^> ' | sed 's/^> //'); then |
|
|
if new_lines=$(diff /etc/skel/.bashrc "$user_bashrc" | grep '^> ' | sed 's/^> //'); then |
|
|
: |
|
|
|
|
|
|
|
|
echo 'no new lines' |
|
|
else |
|
|
else |
|
|
# echo -e "$new_lines" |
|
|
|
|
|
|
|
|
|
|
|
sudo -u "$user" -- cp "$MIAOU_BASH_DIR"/etc/skel/.bashrc "$user_bashrc" |
|
|
sudo -u "$user" -- cp "$MIAOU_BASH_DIR"/etc/skel/.bashrc "$user_bashrc" |
|
|
echo -e "$new_lines" | sudo -u $user -- tee -a "$user_bashrc" |
|
|
|
|
|
|
|
|
echo -e "$new_lines" | sudo -u "$user" -- tee -a "$user_bashrc" |
|
|
echo "INFO: .bashrc for user <$user> merged succesfully" |
|
|
echo "INFO: .bashrc for user <$user> merged succesfully" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
|