forked from BunsenLabs/bunsen-configs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbl-user-setup
executable file
·38 lines (29 loc) · 1.03 KB
/
bl-user-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# BunsenLabs User Set-up
# USER="$1" USER is exported by lightdm
[[ "$USER" = root || ! -d /home/"$USER" ]] && { echo "$0: variable USER has not been set correctly." >&2; exit 1;}
[ -f "/home/$USER/.config/bunsen/bl-setup" ] && exit 0
bkp_sfx="~$( date +%FT%T )~"
rsync -rltb --suffix="$bkp_sfx" --safe-links /usr/share/bunsen/skel/ /home/$USER
for i in "/home/$USER/.gtk-bookmarks" "/home/$USER/.config/nitrogen/nitrogen.cfg"
do
[ -f "${i}.template" ] || continue
sed --in-place "s/%USERNAME%/$USER/g" "${i}.template"
if [ -f "$i" ]
then
if diff -BEbZ "$i" "${i}.template" >/dev/null
then
rm "${i}.template"
else
mv "$i" "${i}${bkp_sfx}"
mv "${i}.template" "$i"
fi
else
mv "${i}.template" "$i"
fi
done
ln -sTf /usr/share/backgrounds "/home/$USER/Pictures/wallpapers/shared"
mkdir -p "/home/$USER/.config/bunsen" # this should already exist
touch "/home/$USER/.config/bunsen/bl-setup"
chown -R "$USER":"$USER" "/home/$USER"
exit