feat: install.vsh 32-bit repo support
@@ -27,7 +27,9 @@ vpac s -r linux-lts # search the sync databases
27```
128
229`install.vsh` also asks whether to keep vpac's database, cache, keys and hooks
3-in pacman's directories, and whether to turn libalpm's download sandbox off.
30+in pacman's directories, whether to add the distro's repo of 32-bit libraries
31+(`multilib` on arch, `lib32` on artix), and whether to turn libalpm's download
32+sandbox off.
433Answer no to the first only if you mean to keep vpac's state apart from
534pacman's: a separate database does not know the packages pacman installed.
635
@@ -20,6 +20,10 @@ struct Distro {
2020 name string
2121 repos []string
2222 src string
23+ // lib32 is the distro's repo of 32-bit libraries, '' when it ships none:
24+ // the shared mirror list serves it, the url's $repo picks the repo.
25+ // cachyos builds a monorepo, so it has none and its question is skipped
26+ lib32 string
2327}
2428
2529fn distros() []Distro {
@@ -28,16 +32,19 @@ fn distros() []Distro {
2832 name: 'arch'
2933 repos: ['core', 'extra']
3034 src: 'https://geo.mirror.pkgbuild.com/\$repo/os/\$arch'
35+ lib32: 'multilib'
3136 },
3237 Distro{
3338 name: 'artix'
3439 repos: ['system', 'world', 'galaxy']
3540 src: 'https://mirror1.artixlinux.org/repos/\$repo/os/\$arch'
41+ lib32: 'lib32'
3642 },
3743 Distro{
3844 name: 'cachyos'
3945 repos: ['cachyos']
4046 src: 'https://mirror.cachyos.org/repo/\$arch/\$repo'
47+ lib32: ''
4148 },
4249 ]
4350}
@@ -80,6 +87,7 @@ fn own_paths() Paths {
8087struct Answers {
8188 distro string
8289 aur bool
90+ lib32 bool
8391 root string
8492 parallel int
8593 color string
@@ -121,7 +129,13 @@ fn run() ! {
121129 }
122130
123131 distro := ask_choice('mirrors for which os', distros().map(it.name), detect_distro())!
132+ d := distro_named(distro)
124133 aur := ask_yes('add the AUR as a pkgbuild repo', true)!
134+ mut lib32 := false
135+ if d.lib32 != '' {
136+ // pacman.conf ships multilib commented out, so off is the default here too
137+ lib32 = ask_yes('add the ${d.lib32} repo for 32-bit libraries', false)!
138+ }
125139 providers := ['doas', 'sudo', 'pkexec', 'su']
126140 root := ask_choice('the command vpac gets root with', providers, root_default())!
127141 parallel := ask_count('parallel downloads', 3, 1)!
@@ -138,13 +152,13 @@ fn run() ! {
138152 a := Answers{
139153 distro: distro
140154 aur: aur
155+ lib32: lib32
141156 root: root
142157 parallel: parallel
143158 color: color
144159 sandbox: sandbox
145160 arch: os.uname().machine
146161 }
147- d := distro_named(distro)
148162 mirror := os.join_path(etc, 'mirrors', '${d.name}.lip')
149163 write_mirror := !os.exists(mirror)
150164
@@ -314,6 +328,9 @@ fn config_text(a Answers, p Paths, d Distro) string {
314328 for name in d.repos {
315329 repos << '(repo\n :name "${name}"\n :src mirrors-${d.name})'
316330 }
331+ if a.lib32 {
332+ repos << '(repo\n :name "${d.lib32}"\n :src mirrors-${d.name})'
333+ }
317334 if a.aur {
318335 repos << '(repo\n :name "aur"\n :type "pkgbuild"\n :src "https://aur.archlinux.org")'
319336 }
@@ -336,8 +353,8 @@ fn config_text(a Answers, p Paths, d Distro) string {
336353 :parallel ${a.parallel}
337354 :protocols ["https"]
338355 :user "alpm"' +
339- if a.sandbox { ' :disable-sandbox true' } else { '' } +
340-')
356+ if a.sandbox { ' :disable-sandbox true' } else { '' } +
357+ ')
341358
342359(options
343360 :root "${a.root}"