-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·66 lines (57 loc) · 1.65 KB
/
install.py
File metadata and controls
executable file
·66 lines (57 loc) · 1.65 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
#!/usr/bin/python
from pathlib import Path
from sys import argv
home_configs = {
".gitconfig": "~/.gitconfig",
".xinitrc": "~/.xinitrc",
".zshrc": "~/.zshrc",
".gtkrc-2.0": "~/.gtkrc-2.0",
".tmux.conf": "~/.tmux.conf",
".p10k.zsh": "~/.p10k.zsh",
"dunst": "~/.config/dunst",
"yamllint": "~/.config/yamllint",
"gpg-agent.conf": "~/.gnupg/gpg-agent.conf",
"gtk-3.0": "~/.config/gtk-3.0",
"gtk-4.0": "~/.config/gtk-4.0",
"htop": "~/.config/htop",
"i3": "~/.config/i3",
"nvim": "~/.config/nvim",
"picom": "~/.config/picom",
"polybar": "~/.config/polybar",
"alacritty": "~/.config/alacritty",
"zathura": "~/.config/zathura",
"feh": "~/.config/feh",
"rofi": "~/.config/rofi",
"qt5ct": "~/.config/qt5ct",
"mpv": "~/.config/mpv",
"layout.service": "~/.config/systemd/user/layout.service",
"ssh/config": "~/.ssh/config",
}
server_part = [
".zshrc",
".tmux.conf",
".p10k.zsh",
"nvim",
"htop",
"yamllint",
]
server_option = len(argv) > 1 and argv[1] == "--server"
configs = (
{config: home_configs[config] for config in server_part}
if server_option
else home_configs
)
for config, dest in configs.items():
source = Path.cwd() / config
target = Path(dest).expanduser()
if not source.exists():
print(f"missing source: {source}")
continue
if target.is_symlink() or target.is_file():
target.unlink()
elif target.is_dir():
print(f"[WARN] remove directory manually: {target}")
continue
target.parent.mkdir(parents=True, exist_ok=True)
target.symlink_to(source)
print(f"installed: {target}")