-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
47 lines (35 loc) · 1.18 KB
/
install.py
File metadata and controls
47 lines (35 loc) · 1.18 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
import os
import shutil
import subprocess
exclude = ['README', 'install.py', 'starship.toml']
home = os.path.expanduser('~')
here = os.path.abspath('.')
# symlink all the files in this repo in the home directory
print("Symlinking dotfiles ...")
for f in os.listdir('.'):
if f in exclude or f[0] == '.':
continue
local_file = "%s/%s" % (here, f)
install_file = "%s/.%s" % (home, f)
if os.path.exists(install_file):
continue
cmd = 'ln -sf %s %s' % (local_file, install_file)
print(cmd)
os.system(cmd)
# starship prompt used by my zsh setup.
if shutil.which('starship'):
print('starship already installed, skipping')
else:
print('Installing starship...')
subprocess.run(
'curl -sS https://starship.rs/install.sh | sh -s -- --yes',
shell=True, check=True
)
starship_config_dir = os.path.join(home, '.config')
starship_config = os.path.join(starship_config_dir, 'starship.toml')
starship_source = os.path.join(here, 'starship.toml')
if not os.path.islink(starship_config):
os.makedirs(starship_config_dir, exist_ok=True)
cmd = 'ln -sf %s %s' % (starship_source, starship_config)
print(cmd)
os.system(cmd)