dotfiles/backup.sh

108 lines
3 KiB
Bash
Raw Normal View History

2023-10-08 22:26:07 -05:00
#!/usr/bin/env bash
GIT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
command_exists() { type "$1" &>/dev/null; }
# fish
2023-10-08 22:26:07 -05:00
rm -rf $GIT_DIR/fish
cp -r $HOME/.config/fish/ $GIT_DIR
if command_exists "nixos-rebuild"; then
rm $GIT_DIR/fish/config.fish
mv $GIT_DIR/fish/config.fish.backup $GIT_DIR/fish/config.fish
fi
2023-11-20 00:48:36 -06:00
# kitty
rm -rf $GIT_DIR/kitty
2023-10-08 22:26:07 -05:00
cp -r $HOME/.config/kitty/ $GIT_DIR
cp -r $HOME/.config/nvim/ $GIT_DIR
2023-11-20 00:48:36 -06:00
# nvim
rm -rf $GIT_DIR/nvim
cp -r $HOME/.config/nvim/ $GIT_DIR
# gpg
rm -rf $GIT_DIR/gnupg
mkdir $GIT_DIR/gnupg
cp $HOME/.gnupg/gpg.conf $GIT_DIR/gnupg/
cp $HOME/.gnupg/gpg-agent.conf $GIT_DIR/gnupg/
2023-11-20 00:48:36 -06:00
# Vesktop
2024-03-06 20:18:13 -06:00
rm -rf $GIT_DIR/vesktop
cp -r $HOME/.config/vesktop/ $GIT_DIR
rm -rf $GIT_DIR/vesktop/sessionData
rm -rf $GIT_DIR/vesktop/Crashpad
2024-04-17 21:41:22 -05:00
rm -rf $GIT_DIR/vesktop/vencordDist
2024-03-06 20:18:13 -06:00
rm -f $GIT_DIR/vesktop/Singleton*
rm -f $GIT_DIR/vesktop/state.json
rm -f $GIT_DIR/vesktop/.updaterId
2023-11-20 00:48:36 -06:00
# VS code
2023-11-20 00:48:36 -06:00
rm -rf $GIT_DIR/vscode
mkdir $GIT_DIR/vscode
if command_exists "code"; then
code --list-extensions >$GIT_DIR/vscode/extensions.txt
cp $HOME/.config/Code/User/keybindings.json $GIT_DIR/vscode/keybindings.json
cp $HOME/.config/Code/User/settings.json $GIT_DIR/vscode/settings.json
cp $HOME/.vscode/argv.json $GIT_DIR/vscode/argv.json
elif command_exists "code-oss"; then
code-oss --list-extensions >$GIT_DIR/vscode/extensions.txt
cp $HOME/.config/Code/User/keybindings.json $GIT_DIR/vscode/keybindings.json
cp $HOME/.config/Code/User/settings.json $GIT_DIR/vscode/settings.json
cp $HOME/.vscode-oss/argv.json $GIT_DIR/vscode/argv.json
fi
2023-11-20 00:48:36 -06:00
# i3
rm -rf $GIT_DIR/i3
cp -r $HOME/.config/i3/ .
# sway
rm -rf $GIT_DIR/sway
cp -r $HOME/.config/sway/ .
outputs=$(swaymsg -t get_outputs)
width=$(echo $outputs | jq -r .[0].modes.[0].width)
height=$(echo $outputs | jq -r .[0].modes.[0].height)
sed -i "s/set \$lockwall \"swaylock -i ~\/\.config\/sway\/backgrounds\/${width}x${height}\.png\"/set \$lockwall \"swaylock -i ~\/\.config\/sway\/backgrounds\/widthxheight\.png\"/g" $GIT_DIR/sway/config
2023-11-20 12:09:00 -06:00
# greetd (for sway)
if [ -d /etc/greetd ]; then
rm -rf $GIT_DIR/greetd/
cp -r /etc/greetd/ $GIT_DIR/
2023-11-20 12:09:00 -06:00
fi
2023-12-06 21:46:34 -06:00
# Claws Mail configs
rm -rf $GIT_DIR/claws-mail
mkdir $GIT_DIR/claws-mail
cp $HOME/.claws-mail/clawsrc $GIT_DIR/claws-mail/clawsrc
cp $HOME/.claws-mail/matcherrc $GIT_DIR/claws-mail/matcherrc
2023-12-06 21:46:34 -06:00
# xinitrc
cp $HOME/.xinitrc $GIT_DIR/other-files/.xinitrc
2024-03-06 20:26:26 -06:00
2024-03-18 20:53:52 -05:00
# fix-gamepad.service
if ! command_exists "nixos-rebuild" && command_exists "systemctl"; then
cp /etc/systemd/system/fix-gamepad.service $GIT_DIR/systemd/fix-gamepad.service
fi
2024-03-06 20:26:26 -06:00
# rofi
rm -rf $GIT_DIR/rofi/
2024-03-22 12:55:56 -05:00
cp -r $HOME/.config/rofi/ $GIT_DIR/rofi/
# fontconfig
rm -rf $GIT_DIR/fontconfig
mkdir $GIT_DIR/fontconfig
cp -r $HOME/.config/fontconfig/conf.d/* $GIT_DIR/fontconfig/
# waybar
rm -rf $GIT_DIR/waybar/
mkdir $GIT_DIR/waybar/
cp -r $HOME/.config/waybar/* $GIT_DIR/waybar/
# sway runner
# TODO: make this work on nix stuff
if command_exists "xbps-install"; then
cp /usr/bin/sway-runner $GIT_DIR/
sudo chown $(whoami) sway-runner
fi
2024-08-16 11:18:15 -05:00
# Wezterm
cp ~/.wezterm.lua $GIT_DIR/wezterm.lua