Skip to content

Commit d06621d

Browse files
authored
Merge pull request #636 from go-debos/wip/daissi/pacstrap-extra-packages
pacstrap_action: add an option to install extra packages
2 parents 1065c3c + f39776f commit d06621d

5 files changed

Lines changed: 128 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ jobs:
222222
test: { name: "raw (4096 sector size)", case: "raw", variables: "-t sectorsize:4096" }
223223
- backend: kvm
224224
test: { name: "arch", case: "arch" }
225+
- backend: kvm
226+
test: { name: "arch (pacstrap with extra packages)", case: "arch-pacstrap-extra-packages" }
225227
- backend: kvm
226228
test: { name: "apertis", case: "apertis" }
227229
- backend: kvm

actions/pacstrap_action.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ Construct the target rootfs with pacstrap tool.
77
- action: pacstrap
88
config: <in-tree pacman.conf file>
99
mirror: <in-tree mirrorlist file>
10+
packages: <list of packages to install>
1011
1112
Mandatory properties:
1213
1314
- config -- the pacman.conf file which will be used through the process
1415
- mirror -- the mirrorlist file which will be used through the process
16+
17+
Optional properties:
18+
19+
- packages -- list of packages to install
20+
If no packages are specified to be installed, pacstrap will install
21+
the base metapackage by default. The base metapackage is only automatically
22+
installed when this list is empty, this means that it must be added to the
23+
list when adding packages.
1524
*/
1625
package actions
1726

@@ -27,8 +36,9 @@ import (
2736

2837
type PacstrapAction struct {
2938
debos.BaseAction `yaml:",inline"`
30-
Config string `yaml:"config"`
31-
Mirror string `yaml:"mirror"`
39+
Config string `yaml:"config"`
40+
Mirror string `yaml:"mirror"`
41+
Packages []string `yaml:"packages"`
3242
}
3343

3444
func (d *PacstrapAction) listOptionFiles(context *debos.Context) ([]string, error) {
@@ -121,6 +131,11 @@ func (d *PacstrapAction) Run(context *debos.Context) error {
121131

122132
// Run pacstrap
123133
cmdline = []string{"pacstrap", context.Rootdir}
134+
135+
if d.Packages != nil {
136+
cmdline = append(cmdline, d.Packages...)
137+
}
138+
124139
if err := (debos.Command{}.Run("pacstrap", cmdline...)); err != nil {
125140
log := path.Join(context.Rootdir, "var/log/pacman.log")
126141
_ = debos.Command{}.Run("pacstrap.log", "cat", log)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
2+
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch
3+
Server = https://mirror.leaseweb.net/archlinux/$repo/os/$arch
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#
2+
# /etc/pacman.conf
3+
#
4+
# See the pacman.conf(5) manpage for option and repository directives
5+
6+
#
7+
# GENERAL OPTIONS
8+
#
9+
[options]
10+
# The following paths are commented out with their default values listed.
11+
# If you wish to use different paths, uncomment and update the paths.
12+
#RootDir = /
13+
#DBPath = /var/lib/pacman/
14+
#CacheDir = /var/cache/pacman/pkg/
15+
#LogFile = /var/log/pacman.log
16+
#GPGDir = /etc/pacman.d/gnupg/
17+
#HookDir = /etc/pacman.d/hooks/
18+
HoldPkg = pacman glibc
19+
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
20+
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
21+
#CleanMethod = KeepInstalled
22+
Architecture = auto
23+
24+
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
25+
#IgnorePkg =
26+
#IgnoreGroup =
27+
28+
#NoUpgrade =
29+
#NoExtract =
30+
31+
# Misc options
32+
#UseSyslog
33+
#Color
34+
#NoProgressBar
35+
CheckSpace
36+
#VerbosePkgLists
37+
#ParallelDownloads = 5
38+
39+
# By default, pacman accepts packages signed by keys that its local keyring
40+
# trusts (see pacman-key and its man page), as well as unsigned packages.
41+
SigLevel = Required DatabaseOptional
42+
LocalFileSigLevel = Optional
43+
#RemoteFileSigLevel = Required
44+
45+
# NOTE: You must run `pacman-key --init` before first using pacman; the local
46+
# keyring can then be populated with the keys of all official Arch Linux
47+
# packagers with `pacman-key --populate archlinux`.
48+
49+
#
50+
# REPOSITORIES
51+
# - can be defined here or included from another file
52+
# - pacman will search repositories in the order defined here
53+
# - local/custom mirrors can be added here or in separate files
54+
# - repositories listed first will take precedence when packages
55+
# have identical names, regardless of version number
56+
# - URLs will have $repo replaced by the name of the current repo
57+
# - URLs will have $arch replaced by the name of the architecture
58+
#
59+
# Repository entries are of the format:
60+
# [repo-name]
61+
# Server = ServerName
62+
# Include = IncludePath
63+
#
64+
# The header [repo-name] is crucial - it must be present and
65+
# uncommented to enable the repo.
66+
#
67+
68+
# The testing repositories are disabled by default. To enable, uncomment the
69+
# repo name header and Include lines. You can add preferred servers immediately
70+
# after the header, and they will be used before the default mirrors.
71+
72+
#[testing]
73+
#Include = /etc/pacman.d/mirrorlist
74+
75+
[core]
76+
Include = /etc/pacman.d/mirrorlist
77+
78+
[extra]
79+
Include = /etc/pacman.d/mirrorlist
80+
81+
# If you want to run 32 bit applications on your x86_64 system,
82+
# enable the multilib repositories as required here.
83+
84+
#[multilib-testing]
85+
#Include = /etc/pacman.d/mirrorlist
86+
87+
#[multilib]
88+
#Include = /etc/pacman.d/mirrorlist
89+
90+
# An example of a custom package repository. See the pacman manpage for
91+
# tips on creating your own repositories.
92+
#[custom]
93+
#SigLevel = Required DatabaseTrustedOnly
94+
#SigLevel = Optional TrustAll
95+
#Server = file:///home/custompkgs
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
{{- $architecture := or .architecture "amd64"}}
3+
architecture: {{$architecture}}
4+
5+
actions:
6+
- action: pacstrap
7+
config: pacman.conf
8+
mirror: mirrorlist
9+
packages:
10+
- base
11+
- procps

0 commit comments

Comments
 (0)