@@ -31,13 +31,16 @@ Usage: $0 [options]
31
31
-p <package>
32
32
Install the named Void Linux package in the container
33
33
before building. May be specified more than once to
34
- install more than one package. (This triggers a full
35
- XBPS package upgrade before installation.)
34
+ install more than one package.
36
35
37
36
-t <tag>
38
37
Specify specific tag or commit hash to fetch
39
38
(Ignored if /zbm already contains a ZFSBootMenu tree)
40
39
40
+ -u
41
+ Update all Void packages, except kernels and zfs, in the container
42
+ (Specify more than once to attempt kernel and zfs updates as well)
43
+
41
44
-V
42
45
Do not attempt to update the version recorded in the source tree
43
46
@@ -54,13 +57,43 @@ Usage: $0 [options]
54
57
EOF
55
58
}
56
59
60
+ hold_kern_zfs () {
61
+ local kernels zpkg
62
+
63
+ # Hold all kernel packages
64
+ kernels=" $( xbps-query -p pkgname --regex -s ' linux[0-9]+\.[0-9]' ) " || kernels=
65
+ if [ -n " ${kernels} " ]; then
66
+ cut -d' ' -f2 <<< " ${kernels}" | xargs xbps-pkgdb -m hold
67
+ fi
68
+
69
+ # Hold ZFS packages
70
+ for zpkg in zfs libzfs zfs-lts libzfs-lts; do
71
+ xbps-query -p pkgname " ${zpkg} " > /dev/null 2>&1 || continue
72
+ xbps-pkgdb -m hold " ${zpkg} "
73
+ done
74
+ }
75
+
76
+ update_packages () {
77
+ case " ${1,,} " in
78
+ full) ;;
79
+ * ) hold_kern_zfs ;;
80
+ esac
81
+
82
+ # Attempt to update xbps first
83
+ xbps-install -Syu xbps || return 1
84
+
85
+ # Update all other packages
86
+ xbps-install -Syu || return 1
87
+ }
88
+
57
89
PACKAGES=()
58
90
CONFIGEVALS=()
59
91
GENARGS=()
60
92
93
+ UPDATE=
61
94
SKIP_VERSIONING=
62
95
63
- while getopts " hb:o:t:e:p:V " opt; do
96
+ while getopts " hb:o:t:e:p:uV " opt; do
64
97
case " ${opt} " in
65
98
b)
66
99
BUILDROOT=" ${OPTARG} "
@@ -77,6 +110,13 @@ while getopts "hb:o:t:e:p:V" opt; do
77
110
e)
78
111
CONFIGEVALS+=( " ${OPTARG} " )
79
112
;;
113
+ u)
114
+ if [ -n " ${UPDATE} " ]; then
115
+ UPDATE=" full"
116
+ else
117
+ UPDATE=" yes"
118
+ fi
119
+ ;;
80
120
V)
81
121
SKIP_VERSIONING=" yes"
82
122
;;
@@ -110,12 +150,14 @@ if [ -z "${ZBMTAG}" ]; then
110
150
fi
111
151
fi
112
152
113
- if [ " ${# PACKAGES[@]} " -gt 0 ]; then
114
- # Trigger a sync and upgrade to make sure the package is installable
115
- xbps-install -Syu xbps
153
+ # Update packages, if desired
154
+ if [ -n " ${UPDATE} " ]; then
155
+ update_packages " ${UPDATE} " || error " failed to update packages"
156
+ fi
116
157
158
+ if [ " ${# PACKAGES[@]} " -gt 0 ]; then
117
159
# Install all requested packages
118
- xbps-install -Sy " ${PACKAGES[@]} "
160
+ xbps-install -Sy " ${PACKAGES[@]} " || error " failed to install requested packages "
119
161
fi
120
162
121
163
# If a custom rc.pre.d exists, run every executable file therein
0 commit comments