Mercurial > code > home > repos > infra
annotate packages.py @ 146:2065998876e4
add host 'ditto'
author | drewp@bigasterisk.com |
---|---|
date | Sat, 11 Mar 2023 12:17:56 -0800 |
parents | 6b4226845254 |
children | 51a48aeca8ba |
rev | line source |
---|---|
12 | 1 from pyinfra import host |
2 from pyinfra.facts.server import LinuxDistribution | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
3 from pyinfra.operations import apt, files, server |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
4 import package_lists |
12 | 5 |
6 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
7 |
12 | 8 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
9 def kitty(): |
131 | 10 vers = '0.26.5' # see https://github.com/kovidgoyal/kitty/releases |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
11 home = '/home/drewp' |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
12 local = f"{home}/.local/kitty" |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
13 dl = f'/tmp/kitty-{vers}-x86_64.txz' |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
14 files.download(src=f"https://github.com/kovidgoyal/kitty/releases/download/v{vers}/kitty-{vers}-x86_64.txz", dest=dl) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
15 files.directory(local) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
16 server.shell([ |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
17 f"mkdir -p {local}", # https://github.com/Fizzadar/pyinfra/issues/777 |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
18 f"aunpack --extract-to={local} {dl}", |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
19 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
20 files.link(target="{local}/bin/kitty", path="{home}/bin/kitty") |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
21 |
12 | 22 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
23 def pnpm(): |
138 | 24 if host not in ['plus', 'prime', 'slash', 'bang', 'dot']: |
25 return | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
26 server.shell([ |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
27 # https://github.com/pnpm/pnpm/releases |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
28 # but also https://pnpm.io/installation#compatibility |
131 | 29 "npm install -g pnpm@6.35.1", |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
30 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
31 |
69 | 32 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
33 def proper_locate(): |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
34 apt.packages(packages='mlocate', present=False) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
35 if not is_pi and host.name not in ['prime', 'pipe']: |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
36 apt.packages(packages='plocate') |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
37 |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
38 |
131 | 39 def proper_man(): |
40 if host.name in ['pipe', 'prime'] or is_pi: | |
41 apt.packages(packages=['mandb'], present=False) | |
12 | 42 |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
43 kw = dict(latest=True) |
12 | 44 |
138 | 45 apt.packages(packages=['libnode72'], present=False, force=True) |
12 | 46 |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
47 apt.packages(packages=package_lists.setup, **kw) |
131 | 48 |
12 | 49 if not is_pi: |
83 | 50 if host.name != 'pipe': |
131 | 51 apt.packages(packages=['reptyr']) |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
52 kitty() |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
53 pnpm() |
131 | 54 else: |
55 apt.packages(packages=package_lists.pi_setup) | |
12 | 56 |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
57 proper_locate() |
131 | 58 proper_man() |
59 | |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
60 |
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
61 apt.packages(packages=package_lists.general, **kw) |
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
62 apt.packages(packages=package_lists.debug, **kw) |
56 | 63 |
146 | 64 if host.name in ["bang" ,'ditto']: |
65 apt.packages(packages=package_lists.for_bang_ditto, **kw) | |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
66 |
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
67 if host.name == "pipe": |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
68 apt.packages(packages=package_lists.for_pipe, **kw) |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
69 |
131 | 70 if host.name == "prime": |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
71 apt.packages(packages=package_lists.for_prime, **kw) |
131 | 72 |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
73 if host.name == 'plus': |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
74 apt.packages(packages=package_lists.laptop, **kw) |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
75 |
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
76 desktop_env = host.name in ['dash', 'slash', 'plus'] |
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
77 if desktop_env: |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
78 apt.packages(packages=package_lists.xorg + package_lists.desktop, **kw) |
131 | 79 |
80 if not is_pi: | |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
81 apt.packages(packages=package_lists.non_pi, **kw) |