Mercurial > code > home > repos > infra
annotate apt/apt.py @ 326:5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
author | drewp@bigasterisk.com |
---|---|
date | Mon, 20 Jan 2025 21:55:08 -0800 |
parents | 11d3bcedb9f0 |
children |
rev | line source |
---|---|
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
1 import io |
320
11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
drewp@bigasterisk.com
parents:
309
diff
changeset
|
2 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
3 from pyinfra.context import host |
320
11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
drewp@bigasterisk.com
parents:
309
diff
changeset
|
4 from pyinfra.facts.server import Arch |
155 | 5 from pyinfra.operations import apt, files, server |
6 | |
7 TZ = 'America/Los_Angeles' | |
8 | |
282 | 9 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
10 def ubuntuReleases(): |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
11 if 'pi' not in host.groups: |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
12 files.line(path='/etc/update-manager/release-upgrades', line="^Prompt=", replace="Prompt=normal") |
203 | 13 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
14 def pkgKeys(): |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
15 files.directory(path='/etc/apt/keyrings/') # for raspi |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
16 files.sync(src='apt/keyrings/', dest='/usr/share/keyrings/', delete=False) |
195 | 17 |
211 | 18 # also these |
19 #-rw-r--r-- 1 root root 2794 Mar 26 2021 /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg | |
20 #-rw-r--r-- 1 root root 1733 Mar 26 2021 /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg | |
282 | 21 |
280 | 22 # raspi needs wget http://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add - |
195 | 23 |
249 | 24 |
320
11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
drewp@bigasterisk.com
parents:
309
diff
changeset
|
25 def arch386(): |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
26 if host.get_fact(Arch) != 'x86_64': |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
27 return |
320
11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
drewp@bigasterisk.com
parents:
309
diff
changeset
|
28 server.shell(commands=['dpkg --add-architecture i386']) |
195 | 29 |
30 | |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
31 def aptUpdate(): |
155 | 32 apt.packages(update=True, |
187
466108f0a509
redo pkg keys and future podman 4.3.1 version
drewp@bigasterisk.com
parents:
178
diff
changeset
|
33 cache_time=86400, |
178
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
34 packages=['tzdata'], |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
35 force=True, |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
36 _env={ |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
37 'TZ': TZ, |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
38 'LANG': 'en_US.UTF-8', |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
39 'DEBIAN_FRONTEND': 'noninteractive' |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
40 }) |
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
41 |
188 | 42 # squib 1st setup seemed to need more updates for node(nodesource) |
43 # and steam-launcher | |
178
6ec7cd3615f0
another try at apt.key, but it doesn't completely work because prime
drewp@bigasterisk.com
parents:
155
diff
changeset
|
44 |
283 | 45 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
46 def flatpakSources(): |
286 | 47 apt.packages(update=True, cache_time=86400, packages=['flatpak']) |
288 | 48 server.shell(commands='flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo') |
195 | 49 |
282 | 50 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
51 def sources(): |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
52 files.put(src=io.StringIO("# see .d\n"), dest="/etc/apt/sources.list") |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
53 if 'pi' in host.groups: |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
54 osName = "pi" |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
55 elif host.name == 'pipe': |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
56 osName = "odroid" |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
57 else: |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
58 osName = "ubuntu" |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
59 files.template(src=f'apt/templates/{osName}.sources.j2', dest=f'/etc/apt/sources.list.d/{osName}.sources') |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
60 files.template(src='apt/templates/more.sources.j2', dest='/etc/apt/sources.list.d/more.sources') |
282 | 61 |
320
11d3bcedb9f0
updates for tofu rebuild; some dead code; start moving tasks into subdirs with their files and templates
drewp@bigasterisk.com
parents:
309
diff
changeset
|
62 |
326
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
63 operations = [ |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
64 ubuntuReleases, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
65 arch386, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
66 pkgKeys, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
67 sources, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
68 aptUpdate, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
69 flatpakSources, |
5b88b38f2471
huge reorg, reog toplevel functions in preparation of a ui with nice task lists
drewp@bigasterisk.com
parents:
320
diff
changeset
|
70 ] |