-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup2.sh
executable file
·53 lines (51 loc) · 1.45 KB
/
backup2.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env sh
# ___ ______ __
# / | __ _______/ ____/_ __/ /_ ___ _____
# / /| |/ / / / ___/ / / / / / __ \/ _ \/ ___/
# / ___ / /_/ (__ ) /___/ /_/ / /_/ / __/ /
# /_/ |_\__,_/____/\____/\__, /_.___/\___/_/
# /____/
set -e
DEST=~/dotfiles
cd $DEST
sync () {
if [[ -n $3 ]]; then
rsync -avhr "$1" "$DEST/$2" --exclude="$3" --delete
else
rsync -avhr "$1" "$DEST/$2" --delete
fi
}
{
#Test Distro
eval "$(cat /etc/os-release | head)"
dis=$NAME
if grep -q 'Gentoo' <<< "$dis"; then
sync /etc/portage/ portage/etc/
sync /var/lib/portage/world portage/world
cp /usr/src/linux/.config $DEST/kernel/
elif grep -q 'NixOS' <<< "$dis" ; then
sync /etc/nixos/ nixos/config
sync ~/.config/nixpkgs/ .config/nixpkgs
fi
if ! grep -q 'NixOS' <<< "$dis" ; then
sync ~/st rice .git
sync ~/.config/polybar .config
sync ~/.config/nvim .config
sync ~/.config/alacritty/alacritty.yml .config
sync ~/.config/picom .config
fi
sync ~/.config/fish .config
sync ~/.emacs.d . "elpa/*"
sync ~/.xmonad rice "{.venv,*.o}"
#sync ~/st rice .git
sync ~/.config/starship.toml .config
sync ~/.config/polybar .config
sync ~/.config/rofi .config
cp ~/.zshrc .zshrc
cp ~/.xinitrc $DEST/rice/
cp ~/.Xresources $DEST/rice/
cd ~/dotfiles
git add --all
git commit -a -m "$(date "+%a %d %b %I:%M%P") backup"
git push origin master -q
}