Mercurial > code > home > repos > infra
annotate packages.py @ 233:83573e3350bd
upgrades
author | drewp@bigasterisk.com |
---|---|
date | Sun, 29 Oct 2023 21:26:44 -0700 |
parents | f056421843da |
children | b58f05be720a |
rev | line source |
---|---|
12 | 1 from pyinfra import host |
2 from pyinfra.facts.server import LinuxDistribution | |
186 | 3 from pyinfra.operations import apt, files, server, systemd |
205 | 4 |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
5 import package_lists |
12 | 6 |
7 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
|
8 |
12 | 9 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
10 def kitty(): |
150 | 11 vers = '0.27.1' # 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
|
12 home = '/home/drewp' |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
13 local = f"{home}/.local/kitty" |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
14 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
|
15 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
|
16 files.directory(local) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
17 server.shell([ |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
18 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
|
19 f"aunpack --extract-to={local} {dl}", |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
20 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
21 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
|
22 |
12 | 23 |
174
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
24 def nodejs(): |
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
25 apt.packages(packages=['libnode72'], present=False, force=True) |
b6b11048d0fb
collect nodejs pkg install stuff together
drewp@bigasterisk.com
parents:
169
diff
changeset
|
26 apt.packages(packages=['nodejs'], latest=True) |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
27 server.shell([ |
169 | 28 "rm -f /usr/local/bin/pnp{m,x}", |
29 "corepack enable", | |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
30 # https://github.com/pnpm/pnpm/releases |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
31 # but also https://pnpm.io/installation#compatibility |
203 | 32 "corepack prepare 'pnpm@8.6.3' --activate", |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
33 ]) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
34 |
205 | 35 |
203 | 36 def pdm(): |
206 | 37 # https://github.com/pdm-project/pdm/blob/main/CHANGELOG.md |
233 | 38 server.shell(["pip install --break-system-packages 'pdm==2.10.0'"]) |
69 | 39 |
205 | 40 |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
41 def proper_locate(): |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
42 apt.packages(packages='mlocate', present=False) |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
43 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
|
44 apt.packages(packages='plocate') |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
45 |
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
46 |
131 | 47 def proper_man(): |
48 if host.name in ['pipe', 'prime'] or is_pi: | |
49 apt.packages(packages=['mandb'], present=False) | |
12 | 50 |
205 | 51 |
196
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
52 def no_unwanted_services(): |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
53 systemd.service(service='nginx', enabled=False, running=False) |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
54 |
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
55 |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
56 kw = dict(latest=True) |
12 | 57 |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
58 apt.packages(packages=package_lists.setup, **kw) |
131 | 59 |
12 | 60 if not is_pi: |
83 | 61 if host.name != 'pipe': |
131 | 62 apt.packages(packages=['reptyr']) |
103
8b8ef9d8f0fd
dead code and templates, reformat, maybe a little refactor
drewp@bigasterisk.com
parents:
93
diff
changeset
|
63 kitty() |
131 | 64 else: |
65 apt.packages(packages=package_lists.pi_setup) | |
12 | 66 |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
67 proper_locate() |
131 | 68 proper_man() |
69 | |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
70 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
|
71 apt.packages(packages=package_lists.debug, **kw) |
56 | 72 |
205 | 73 if host.name in ["bang", 'ditto']: |
146 | 74 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
|
75 |
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
76 if host.name == "pipe": |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
77 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
|
78 |
131 | 79 if host.name == "prime": |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
80 apt.packages(packages=package_lists.for_prime, **kw) |
131 | 81 |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
82 if host.name == 'plus': |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
83 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
|
84 |
189 | 85 desktop_env = host.name in ['dash', 'slash', 'plus', 'squib'] |
114
7e280bf26dba
package lists big update, pulling from /var/log/apt on a few hosts
drewp@bigasterisk.com
parents:
108
diff
changeset
|
86 if desktop_env: |
192 | 87 apt.packages(packages=package_lists.xorg + package_lists.desktop, **kw) |
187
466108f0a509
redo pkg keys and future podman 4.3.1 version
drewp@bigasterisk.com
parents:
186
diff
changeset
|
88 apt.deb(src="http://mirrors.kernel.org/ubuntu/pool/universe/libp/libpod/podman_4.3.1+ds1-5ubuntu1_amd64.deb") |
466108f0a509
redo pkg keys and future podman 4.3.1 version
drewp@bigasterisk.com
parents:
186
diff
changeset
|
89 apt.deb(src="http://mirrors.kernel.org/ubuntu/pool/universe/libp/libpod/podman-docker_4.3.1+ds1-5ubuntu1_amd64.deb") |
203 | 90 pdm() |
131 | 91 |
92 if not is_pi: | |
143
6b4226845254
actually update packages, and add google chrome to the sources
drewp@bigasterisk.com
parents:
138
diff
changeset
|
93 apt.packages(packages=package_lists.non_pi, **kw) |
205 | 94 if host.name != 'prime': # couldn't get prime to install a newer version than 18.7.0 |
186 | 95 nodejs() |
96 else: | |
97 # move to another file? | |
205 | 98 files.template(src="templates/pigpiod.service.j2", dest="/etc/systemd/system/pigpiod.service") |
186 | 99 systemd.service(service='pigpiod', daemon_reload=True, enabled=True) |
196
c409ea5a1d5c
don't tie up 80/443 with an unwanted nginx instance
drewp@bigasterisk.com
parents:
192
diff
changeset
|
100 |
205 | 101 no_unwanted_services() |