-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrestore.sh
More file actions
executable file
·135 lines (112 loc) · 3.32 KB
/
restore.sh
File metadata and controls
executable file
·135 lines (112 loc) · 3.32 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env bash
set -e
set -x
cd $HOME
mkdir -p $HOME/.config
DIR="git/serverconfig"
mkdir -p $HOME/.lc
ln -sf "../$DIR/lc/config.json" $HOME/.lc/
configs=(
.globalrc
.clang_complete
.editorconfig
.gdbinit
.gdbinit.d
.cgdb
.docker
.jelly-conky
.direnvrc
.clang-format
.ctags
.gitconfig
.Xresources
.xprofile
.xinitrc
.gtkrc-2.0
.stalonetrayrc
.bashrc
.perltidyrc
.wgetrc
.npmrc
.prettierrc
.bash_profile
.chisels
.gitignore_global
.fakevimrc
.terminfo
.xsettingsd
.proxychains
.ideavimrc
.lldbinit
scripts
)
for config in "${configs[@]}"; do
rm -rf "$HOME/$config"
ln -sf "$DIR/$config" $HOME/
done
for dotconfig in "$DIR/.config/"*; do
rm -rf "$HOME/.config/$(basename "$dotconfig")"
ln -sf "../$dotconfig" $HOME/.config/
done
if [[ ! -f "$HOME/.config/fish/fish_variables" ]]; then
printf '# VERSION: 3.0\nSETUVAR __fish_initialized:4300\n' > "$HOME/.config/fish/fish_variables"
fi
mkdir -p $HOME/.local/share/
ln -sf /tmp/gentoo/usr/share/grc $HOME/.local/share/
for share in "$DIR/.local/share/"*; do
rm -rf "$HOME/.local/share/$(basename "$share")"
ln -sf "../../$share" $HOME/.local/share/
done
rm -rf $HOME/.tmux
rm -rf $HOME/.tmux.conf
ln -sf "$DIR/.tmux" $HOME/
ln -sf "$DIR/.tmux/.tmux.conf" $HOME/
ln -sf "/tmp/gentoo/emacs" $HOME/.emacs.d
ln -sf "$DIR/.abemacs" $HOME/
lesskey "$DIR/lesskey"
mkdir -p -m 700 $HOME/.ssh
cp "$DIR"/id_rsa.pub $HOME/.ssh/
if [[ $# == 0 ]]; then
if [ ! -d $HOME/.password-store/.git ]; then
rm -rf $HOME/.password-store
git clone git@github.com:amosbird/pass-store $HOME/.password-store
fi
(cd $HOME/.password-store && git pull)
gpg --keyserver keyserver.ubuntu.com --recv-keys 80D430DCBECFEDB4
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key 80D430DCBECFEDB4 trust
gpg --keyserver keyserver.ubuntu.com --recv-keys C3BFA922206F41DA
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key C3BFA922206F41DA trust
fi
MISE_BIN="$HOME/.local/bin/mise"
export GITHUB_TOKEN=${GITHUB_TOKEN:-$(pass show github/api-token 2>/dev/null)}
if [[ -x "$MISE_BIN" ]]; then
"$MISE_BIN" self-update -y
else
mkdir -p "$HOME/.local/bin"
curl -fsSL https://mise.run | MISE_INSTALL_PATH="$MISE_BIN" sh
fi
"$MISE_BIN" install -y
"$MISE_BIN" upgrade -y
"$MISE_BIN" prune -y
# Link mise-installed binaries directly to ~/.local/bin (bypass shims)
"$MISE_BIN" bin-paths | while read -r bin; do
for f in "$bin"/*; do
[[ -f "$f" && -x "$f" ]] && ln -sf "$f" "$HOME/.local/bin/"
done
done
if [[ -n $GUI ]]; then
update-desktop-database "$HOME/.local/share/applications"
sudo cp -r "$DIR"/xkb/* /usr/share/X11/xkb/symbols/
setxkbmap us
sudo mkdir -p /etc/pacman.d/hooks
sudo cp "$DIR"/xkb-restore.hook /etc/pacman.d/hooks/xkb-restore.hook
sudo cp "$DIR"/90-amos-dhcp /usr/lib/dhcpcd/dhcpcd-hooks/90-amos
sudo cp "$DIR"/udev/rules.d/90-wired-netctl.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo cp "$DIR"/gpu-switch/gpu-switch.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable gpu-switch.service
# Setup kitty desktop-ui portal (replaces xdg-desktop-portal-termfilechooser)
kitten desktop-ui enable-portal
fi
echo 'Restored!'