-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
quiz-build-zfs
executable file
·92 lines (75 loc) · 1.69 KB
/
quiz-build-zfs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2023, Rob Norris <robn@despairlabs.com>
set -uo pipefail
usage() {
cat <<EOF
build OpenZFS with options to work well with quiz
usage: quiz-build-zfs [opts] <configure|make> [program args...]
options:
-k <kernel>
kernel to use for this run
-h this help
EOF
exit 1
}
trace() {
local STAMP=$(date +%Y%m%d-%H:%M:%S)
echo "[quiz-build-zfs] $STAMP $@" >&2
}
fail() {
trace "FATAL $@"
exit 1
}
trap fail ERR
do_configure() {
exec ./configure \
--with-linux=$RUNDIR/build/kernel/linux-$_quiz_ksrcver \
--with-linux-obj=$RUNDIR/build/kernel/linux-$_quiz_ksrcver \
--prefix=/usr/local \
--disable-sysvinit \
--disable-systemd \
--disable-pam \
'lt_cv_sys_lib_dlsearch_path_spec=/lib /usr/lib /lib/i686-linux-gnu /usr/lib/x86_64-linux-gnu' \
"$@"
}
do_make() {
exec make "$@"
}
do_make_install() {
exec make install \
DESTDIR=$RUNDIR/system/work \
"$@"
}
RUNDIR=$(realpath $(dirname $0))
source $RUNDIR/quiz-config
source $RUNDIR/quiz-lib
opt_new=0
opt_kernel=""
OPTIND=1
while getopts "k:h" opt
do
case "$opt" in
'k') opt_kernel=$OPTARG ;;
'h') usage ;;
*) exit 1 ;;
esac
done
shift $(expr $OPTIND - 1)
if [[ $# -lt 1 ]] ; then
usage
fi
quiz_kernel_vars ${opt_kernel:-$QUIZ_KERNEL_VERSION}
case "$1" in
configure) do_configure "${@:2}" ;;
make)
if [[ $# -ge 2 && $2 == install ]] ; then
do_make_install "${@:3}"
fi
do_make "${@:2}"
;;
*) usage ;;
esac
# vim: ft=bash