Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 461 lines (376 sloc) 12.448 kb
75052c2 @falconindy initial commit
authored
1 #!/bin/bash
e5a8d5b @falconindy standardize file headers and add MIT licensee
authored
2 #
3 # geninit - modular initramfs creation tool
4 #
5 # Copyright (C) 2011 by Dave Reisner <d@falconindy.com>
6 #
7 # Permission is hereby granted, free of charge, to any person obtaining a copy
8 # of this software and associated documentation files (the "Software"), to deal
9 # in the Software without restriction, including without limitation the rights
10 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 # copies of the Software, and to permit persons to whom the Software is
12 # furnished to do so, subject to the following conditions:
13 #
14 # The above copyright notice and this permission notice shall be included in
15 # all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 # THE SOFTWARE.
24 #
75052c2 @falconindy initial commit
authored
25
26 shopt -s extglob
d51765f @falconindy fix linker resolution for i686 and multilib
authored
27 shopt -s nullglob
75052c2 @falconindy initial commit
authored
28
570ed43 @falconindy add -s option for saving the filelist. declare globals in an obvious …
authored
29 # tender vittles
cee912e @falconindy mark static variables as readonly
authored
30 declare -r _sysconfdir=/etc
31 declare -r _sharedir=.
32 declare -r builderdir=${_sharedir}/builders
33 declare -r baseconfig=${_sysconfdir}/geninit.conf
34 declare -r carch=$(uname -m)
ddb5e48 @falconindy use declare for all globals
authored
35 declare kernver=$(uname -r)
75052c2 @falconindy initial commit
authored
36
570ed43 @falconindy add -s option for saving the filelist. declare globals in an obvious …
authored
37 # error codes
cee912e @falconindy mark static variables as readonly
authored
38 declare -ri ENOENT=2
39 declare -ri EACCES=13
40 declare -ri EEXIST=17
41 declare -ri EINVAL=22
570ed43 @falconindy add -s option for saving the filelist. declare globals in an obvious …
authored
42
43 # globals
44 declare -i automods=0
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
45 declare -i savebuildroot=0
f1562ff @falconindy dryrun is an integer value
authored
46 declare -i dryrun=0
570ed43 @falconindy add -s option for saving the filelist. declare globals in an obvious …
authored
47 declare basedir=
48 declare config=
49 declare imagename=
50 declare preset=
51 declare skipbuilders=
52 declare ocompress=
53
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
54 # -------------------------- #
55 ## general util functions ##
56 # -------------------------- #
75052c2 @falconindy initial commit
authored
57
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
58 err() { # {{{
75052c2 @falconindy initial commit
authored
59 printf 'error: %s\n' "$*"
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
60 } >&2 # }}}
75052c2 @falconindy initial commit
authored
61
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
62 info() { # {{{
75052c2 @falconindy initial commit
authored
63 printf ':: %s\n' "$*"
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
64 } # }}}
75052c2 @falconindy initial commit
authored
65
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
66 die() { # {{{
75052c2 @falconindy initial commit
authored
67 err "$*"
68 cleanup 1
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
69 } # }}}
75052c2 @falconindy initial commit
authored
70
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
71 in_array() { # {{{
75052c2 @falconindy initial commit
authored
72 local item needle=$1; shift
73 [[ -z $1 ]] && return 1 # Not Found
74
75 for item; do
76 [[ $item = $needle ]] && return 0 # Found
77 done
78 return 1 # Not Found
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
79 } # }}}
75052c2 @falconindy initial commit
authored
80
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
81 cleanup() { # {{{
fd3a06c @falconindy dont save the build root if it was never created
authored
82 if (( savebuildroot )) && [[ -d $buildroot ]]; then
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
83 info "buildroot preserved at: $buildroot"
84 else
85 rm -rf "$tmpdir"
86 fi
75052c2 @falconindy initial commit
authored
87 exit $1
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
88 } # }}}
75052c2 @falconindy initial commit
authored
89
25a82f8 @falconindy add a usage function
authored
90 usage() { # {{{
91 cat<<USAGE
a113c0c @falconindy cleanup usage function
authored
92 usage: geninit [options]
25a82f8 @falconindy add a usage function
authored
93
94 Options:
95 -b <path> Use base directory (default: /)
96 -c <file> Specify a different config file (default: $_sysconfdir/geninit.conf)
97 -g <path> Path and name of generated image (dry-run if unspecified)
38f816a @falconindy add -H and -L options for getting help with builders
authored
98 -H <builder> Display help for a specified builder
25a82f8 @falconindy add a usage function
authored
99 -h Display this help message
a113c0c @falconindy cleanup usage function
authored
100 -k <kver> Specify a kernel version (default: $kernver)
38f816a @falconindy add -H and -L options for getting help with builders
authored
101 -L List available builders
a113c0c @falconindy cleanup usage function
authored
102 -p <preset> Build using a preset file (any of $_sysconfdir/geninit.d/*.preset)
25a82f8 @falconindy add a usage function
authored
103 -S <names> Skip the specified builders during the build process
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
104 -s Preserve buildroot after image creation
6dda899 @falconindy allow changing location of build dir
authored
105 -t <path> Specify an alternate location for temporary workspace
25a82f8 @falconindy add a usage function
authored
106 -z <method> Override compression method
107
108 USAGE
109 exit
110 } # }}}
111
38f816a @falconindy add -H and -L options for getting help with builders
authored
112 builderlist() { # {{{
113 local -a builders=("$_sharedir"/builders/*)
114
115 (( ${#builders[*]} )) || die "no builders found"
116
117 info "Available builders -- use -H <builder> for help with a specific builder"
118 printf '%s\n' "${builders[@]##*/}" | column -c$(tput cols)
119 cleanup 0
120 } # }}}
121
122 builderhelp() { # {{{
123 local builder=$1
124
125 [[ -f $_sharedir/builders/$builder ]] || die "no such builder: $builder"
126 . "$_sharedir/builders/$builder"
127 type -t helpmsg >/dev/null || die "no help for builder: $builder"
128 info "$builder"
129 helpmsg
130 cleanup 0
131 } # }}}
132
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
133 # --------------- #
134 ## private API ##
135 # --------------- #
75052c2 @falconindy initial commit
authored
136
137 __add_file() { # {{{
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
138 # add a file to $buildroot
75052c2 @falconindy initial commit
authored
139 # $1: pathname on initcpio
140 # $2: source on disk
141 # $3: mode
142
143 (( $# == 3 )) || return $EINVAL
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
144 [[ -e $buildroot$1 ]] && return $EEXIST
75052c2 @falconindy initial commit
authored
145
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
146 install -Dm$3 "$2" "$buildroot$1"
75052c2 @falconindy initial commit
authored
147 } # }}}
148
149 __add_dir() { # {{{
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
150 # add a directory (with parents) to $buildroot
75052c2 @falconindy initial commit
authored
151 # $1: pathname on initcpio
152 # $2: mode
153
154 (( $# == 2 )) || [[ $1 == /?* ]] || return $EINVAL
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
155 [[ -e $buildroot$1 ]] && return $EEXIST
75052c2 @falconindy initial commit
authored
156
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
157 install -dm$2 "$buildroot$1"
75052c2 @falconindy initial commit
authored
158 } # }}}
159
160 __add_pipe() { # {{{
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
161 # add a pipe to $buildroot
75052c2 @falconindy initial commit
authored
162 # $1: pathname on initcpio
163 # $2: mode
164
165 (( $# == 2 )) || return $EINVAL
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
166 [[ -e $buildroot$1 ]] && return $EEXIST
75052c2 @falconindy initial commit
authored
167
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
168 mkfifo -m$2 "$buildroot$1"
75052c2 @falconindy initial commit
authored
169 } # }}}
170
d1be2d7 @falconindy rename kmodinfo as __kmodinfo
authored
171 __add_slink() { # {{{
172 # add a symlink to $buildroot
173 # $1: name on initcpio
174 # $2: target of $1
175
176 (( $# == 2 )) || return $EINVAL
177 [[ -L $buildroot$1 ]] && return $EEXIST
178
179 ln -s "$2" "$buildroot$1"
180 } # }}}
181
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
182 __build_image() { # {{{
b6714ed @falconindy ARRRGH. always use local inside a function
authored
183 local -i modcount=0
184 local -a zopts pipesave
185 local builder= module= line= mod= file=
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
186
f6f7761 @falconindy refactor depmod creation
authored
187 # this must be resolved to an absolute path
1d41e24 @falconindy be less strict about checking imagename resolution during build
authored
188 if [[ $imagename && ${imagename:0:1} != / ]]; then
f6f7761 @falconindy refactor depmod creation
authored
189 imagename=$(readlink -f "$imagename")
1d41e24 @falconindy be less strict about checking imagename resolution during build
authored
190 [[ $imagename ]] || die "Failed to resolve path to imagename"
f6f7761 @falconindy refactor depmod creation
authored
191 fi
192
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
193 # parse builder array
194 for builder in "${builders[@]}"; do
195 in_array "$builder" "${skipbuilders[@]}" && continue
196
197 if [[ ! -f $builderdir/$builder ]]; then
198 err "cannot find builder '$builder': No such file"
199 continue
200 fi
201
f2136d7 @falconindy add quirks file for quirky modules
authored
202 # subshell to prevent namespace pollution
203 . "$builderdir/$builder"
204 if ! type -t build >/dev/null; then
205 err "no build function found in builder '$builder'"
206 continue
207 fi
208
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
209 info "Building: [$builder]"
f2136d7 @falconindy add quirks file for quirky modules
authored
210 build
7b78689 @falconindy implement module filtering for add_driver_classes
authored
211 unset modulefilter
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
212 done
213
214 # add extra modules from config
215 for mod in ${modules[@]}; do
69e7d7e @falconindy throw errors on user-specfied file/module not found
authored
216 add_module "$mod" || err "Module not found: $mod"
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
217 done
218
219 # add extra files from config
220 for file in "${files[@]}"; do
ff6854c @falconindy uphold geninit.conf's claim of multiple forms to files=()
authored
221 local src=${file%%::*}
222 local dest=${file##*::}
223 [[ $dest ]] || dest=$src
224 add_binary "$src" "$dest" || err "File not found: $file"
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
225 done
226
6f6f62b @falconindy resolved linker once, during image creation
authored
227 # we always need the linker
ebcbd8f @falconindy no need to check if the linker is there yet. it wont be. and it needs…
authored
228 file=$(readlink -e "$ld_so")
229 __add_slink "${ld_so#$basedir}" "${file#$basedir}"
230 __add_file "${file#$basedir}" "${file#$basedir}" 755
6f6f62b @falconindy resolved linker once, during image creation
authored
231
f6f7761 @falconindy refactor depmod creation
authored
232 # only create depmod files if there's modules added
e37a454 @falconindy avoid using public API from within the API itself
authored
233 if [[ -d $buildroot$moduledir ]]; then
f6f7761 @falconindy refactor depmod creation
authored
234 info "Generating module dependencies"
235 depmod -b "$buildroot" "$kernver"
77b1458 @falconindy trim excess depmod files. we dont need all of them
authored
236 # trim excess depmod files
e37a454 @falconindy avoid using public API from within the API itself
authored
237 rm "$buildroot$moduledir"/modules.!(dep|alias|symbols)
f6f7761 @falconindy refactor depmod creation
authored
238 fi
570ed43 @falconindy add -s option for saving the filelist. declare globals in an obvious …
authored
239
69e7d7e @falconindy throw errors on user-specfied file/module not found
authored
240 { # create delicious config
bac42f3 @falconindy move config creation to geninit
authored
241 printf '%s %d' '%MODULES%' "${#modules[*]}"
242 printf ' %s' "${modules[@]}"
243 printf '\n'
244
245 printf '%s' '%HOOKS%'
246 printf ' %s' "${builders[@]}"
247 printf '\n'
248 } > "$buildroot/config"
249
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
250 if (( dryrun )); then
251 info "Dry run complete. Use -g <path> to create an initramfs."
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
252 return
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
253 fi
254
255 if [[ $compress != cat ]]; then
256 zopts=('-9')
257 [[ $compress = xz ]] && zopts+=('--check=crc32')
258 fi
259
260 info "Creating$([[ $compress = cat ]] || printf " $compress") initramfs: $imagename"
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
261
262 pushd "$buildroot" &>/dev/null
263 find . -print0 | cpio -0oH newc | "$compress" "${zopts[@]}" > "$imagename"
264 popd &>/dev/null
265
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
266 pipesave=("${PIPESTATUS[@]}") # save immediately
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
267 (( pipesave[0] )) && die "failed to create filelist (find reported error)"
268 (( pipesave[1] )) && die "failed to create cpio archive (cpio reported error)"
269 (( pipesave[2] )) && die "$compress reported error compressing image"
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
270
271 info "Image creation completed successfully"
272
273 } # }}}
274
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
275 __build_preset() { # {{{
b6714ed @falconindy ARRRGH. always use local inside a function
authored
276 local preset= presetfile=$_sysconfdir/geninit.d/$1.preset
277 local var= cfg= opts= imagename=
278 local -a presets
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
279
280 if [[ ! -f $basedir$presetfile ]]; then
281 err "preset not found: $1"
282 return $ENOENT
283 fi
284
285 if ! . "$basedir$presetfile"; then
286 err "failed to read preset: $1"
287 return $EACCES
288 fi
289
290 # preset pulls in a known array 'presets'
291 for preset in "${presets[@]}"; do
ba1417a @falconindy allow disabling presets with a prefixed !
authored
292 if [[ ${preset:0:1} == ! ]]; then # marked disabled
293 continue;
294 fi
295
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
296 # resolve kernel version
297 if [[ -z $ALL_kver ]]; then
298 err "No kernel version defined for preset \`$1'"
299 return $EINVAL
300 fi
301
302 # resolve image name
303 var=${preset}_image
304 if [[ -z ${!var} ]]; then
305 err "No imagename defined for preset \`$1'"
306 return $EINVAL
307 fi
308 imagename=${!var}
309
310 # extra config
311 var=${preset}_config
312 if [[ -z ${!var} ]]; then
313 # fallback on $ALL_config if its available
314 cfg=${ALL_config:-$_sysconfigdir/geninit.conf}
315 else
316 cfg=${!var}
317 fi
318
319 # extra options are optional
320 var=${preset}_options
321 opts=${!var}
322
323 # this should always resolve to something (i hope)
324 if [[ ! -f $basedir$cfg ]]; then
325 err "preset config file not found: \`$basedir$cfg'"
326 return $ENOENT
327 fi
328
329 # we've got enough to relaunch geninit now
330 # TODO: don't relaunch. Do this the sane way.
331 info "Building image from preset: $1-$preset"
332 printf ' ==> %s\n' "-k $ALL_kver -c $cfg -g $basedir$imagename $opts"
333 "$0" -b "$basedir" -k "$ALL_kver" -c "$cfg" -g "$basedir$imagename" $opts || return 1
334 echo
335 done
336 } # }}}
337
d1be2d7 @falconindy rename kmodinfo as __kmodinfo
authored
338 __kmodinfo() { # {{{
339 modinfo -0k $kernver "$@"
340 } # }}}
341
342 __ldd() { # {{{
343 LD_TRACE_LOADED_OBJECTS=1 "$ld_so" "$@"
344 } # }}}
345
75052c2 @falconindy initial commit
authored
346 # its a trap!
347 trap 'cleanup 130' SIGINT
348 trap 'cleanup 143' SIGTERM
349
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
350 # source public API
5aad559 @falconindy cleanup commenting in main file, do a little reorg
authored
351 . "$_sharedir/geninit.api"
75052c2 @falconindy initial commit
authored
352
f2136d7 @falconindy add quirks file for quirky modules
authored
353 # source module quirks file
354 . "$_sharedir/geninit.quirks"
355
75052c2 @falconindy initial commit
authored
356 # ------------------ #
357 ## option parsing ##
358 # ------------------ #
359
6dda899 @falconindy allow changing location of build dir
authored
360 while getopts ':b:c:g:H:hk:LMp:S:st:z:' flag; do
75052c2 @falconindy initial commit
authored
361 case $flag in
362 b) basedir=$OPTARG ;;
363 c) config=$OPTARG ;;
364 g) imagename=$OPTARG ;;
38f816a @falconindy add -H and -L options for getting help with builders
authored
365 H) builderhelp $OPTARG ;;
25a82f8 @falconindy add a usage function
authored
366 h) usage ;;
75052c2 @falconindy initial commit
authored
367 k) kernver=$OPTARG ;;
38f816a @falconindy add -H and -L options for getting help with builders
authored
368 L) builderlist ;;
a7370a0 @falconindy add -M option for dumping autodetected modules
authored
369 M) automods=1 ;;
1f2aff1 @falconindy add support for kernel presets
authored
370 p) preset=$OPTARG ;;
371 S) skipbuilders=(${OPTARG//,/ }) ;;
61ed3b4 @falconindy use find|cpio instead of gen_init_cpio
authored
372 s) savebuildroot=1 ;;
54d2b38 @falconindy The -t option should set a base tmpdir, not the workdir itself
authored
373 t) otmpdir=$OPTARG ;;
75052c2 @falconindy initial commit
authored
374 z) ocompress=$OPTARG ;; # named differently to allow overriding
375 :) die "option requires an argument -- '$OPTARG'" ;;
376 \?) die "invalid option -- '$OPTARG'" ;;
377 esac
378 done
379
ddb5e48 @falconindy use declare for all globals
authored
380 # Alter PATH. We want to make sure that /bin and /sbin are favored, since
381 # we specifically rely on GNU coreutils
382 PATH=/sbin:/bin:$PATH
383
75052c2 @falconindy initial commit
authored
384 # ----------------- #
385 ## sanity checks ##
386 # ----------------- #
387
9c03a6d @falconindy fix linker resolution for multilib platforms
authored
388 # declared as an array to force expansion. we have to be careful that the wrong
389 # linker isn't picked for mulitlib systems, so we branch on $carch.
390 case $carch in
391 i686) ld_so=("$basedir"/lib/ld-linux.so.?*) ;;
392 x86_64) ld_so=("$basedir"/lib/ld-linux-${carch//_/-}.so.?*) ;;
393 *) die "unknown architecture: $carch" ;;
394 esac
395
75052c2 @falconindy initial commit
authored
396 if (( ${#ld_so[*]} != 1 )); then # uh oh...
397 die "failed to resolve the location of /lib/ld.so. Please report this bug."
398 fi
399
400 # make sure our config exists, and source it
401 config=${config:-$baseconfig}
402 [[ ! -f $config ]] && die "failed to find config file: \`$config'" || . "$config"
403
e17a205 @falconindy fix inaccurate comment wrt basedir
authored
404 # if specified, does the basedir exist? trim any trailing slash
75052c2 @falconindy initial commit
authored
405 if [[ $basedir ]]; then
406 basedir=${basedir%/}
929cb54 @falconindy make an unfortunate exception for passing -b /
authored
407 [[ $basedir ]] && { [[ -d $basedir ]] || die "basedir \`$basedir' not found"; }
75052c2 @falconindy initial commit
authored
408 fi
409
54d2b38 @falconindy The -t option should set a base tmpdir, not the workdir itself
authored
410 # mktemp takes care of our error handling here
411 otmpdir=${otmpdir%/}
412 tmpdir=$(readlink -e "$(mktemp -d "${otmpdir-/tmp}"/${0##*/}.XXXXXX)") || cleanup 1
6dda899 @falconindy allow changing location of build dir
authored
413
75052c2 @falconindy initial commit
authored
414 # does the kernel exist inside the basedir?
415 [[ -d $basedir/lib/modules/$kernver ]] || die "kernel \`$kernver' not found"
416
417 # is our supplied compression method (if supplied) valid?
418 compress=${ocompress:-$compress}
6048c99 @falconindy allow 'none' as a compression option
authored
419 if [[ -z $compress || $compress = none ]]; then
420 compress=cat # NOOP compressor
421 else
75052c2 @falconindy initial commit
authored
422 [[ $compress = @(gzip|bzip2|lzma|xz) ]] || die "unknown compression method: $compress"
423 type -P "$compress" >/dev/null || die "failed to find \`$compress' binary in PATH"
424 fi
425
340a7c4 @falconindy add support for dry runs
authored
426 # if $imagename is provided, its path needs to be valid
427 if [[ $imagename ]]; then
aeea626 @falconindy fail when imagepath's dirname isn't writeable
authored
428 imagepath=$(readlink -f "$imagename")
429 [[ $imagepath ]] || die "invalid path to imagename: $imagename"
430 [[ -w ${imagepath%/*} ]] || die "no permission to write to specified path: \`${imagepath%/*}'"
340a7c4 @falconindy add support for dry runs
authored
431 else # no $imagename, so we're doing a dry run
432 dryrun=1
433 fi
75052c2 @falconindy initial commit
authored
434
435 # ------------ #
436 ## int main ##
437 # ------------ #
438
6dda899 @falconindy allow changing location of build dir
authored
439 # define a few more paths for convenience
cee912e @falconindy mark static variables as readonly
authored
440 declare -r buildroot=$tmpdir/root
441 declare -r autodetect_cache=$tmpdir/autodetect.cache
442 declare -r moduledir=/lib/modules/$kernver
75052c2 @falconindy initial commit
authored
443
a7370a0 @falconindy add -M option for dumping autodetected modules
authored
444 if (( automods )); then
445 . "$_sharedir/builders/autodetect" || die "unable to source autodetect builder"
446 build
447 info "Autodetected modules"
448 [[ -s $autodetect_cache ]] && cat "$autodetect_cache"
449 cleanup 0
450 fi
451
1f2aff1 @falconindy add support for kernel presets
authored
452 if [[ $preset ]]; then
04d836e @falconindy relocate build_preset. rename it to __build_preset and declare a "pri…
authored
453 __build_preset "$preset"
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
454 else
80edf1c @falconindy dont report dry run when using a preset
authored
455 (( dryrun )) && info "Starting dry run"
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
456 __build_image
75052c2 @falconindy initial commit
authored
457 fi
458
2fa6276 @falconindy move main loop logic into its own function. localize variables
authored
459 cleanup $?
75052c2 @falconindy initial commit
authored
460
Something went wrong with that request. Please try again.