Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
To: gentoo-catalyst@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-catalyst] [PATCH 37/37] targets: Use double-brackets in kmerge.sh
Date: Wed, 21 Oct 2020 00:25:03
Message-Id: 20201021002344.378131-37-mattst88@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code by Matt Turner
1 Signed-off-by: Matt Turner <mattst88@g.o>
2 ---
3 targets/support/kmerge.sh | 50 ++++++++++++---------------------------
4 1 file changed, 15 insertions(+), 35 deletions(-)
5
6 diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
7 index 5e284183..fb67aba6 100755
8 --- a/targets/support/kmerge.sh
9 +++ b/targets/support/kmerge.sh
10 @@ -15,71 +15,51 @@ genkernel_compile() {
11 --minkernpackage=/tmp/kerncache/${kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 all
12 )
13 # extra genkernel options that we have to test for
14 - if [ -n "${clst_gk_mainargs}" ]
15 - then
16 + if [[ -n ${clst_gk_mainargs} ]]; then
17 GK_ARGS+=(${clst_gk_mainargs})
18 fi
19 - if [ -n "${clst_KERNCACHE}" ]
20 - then
21 + if [[ -n ${clst_KERNCACHE} ]]; then
22 GK_ARGS+=(--kerncache=/tmp/kerncache/${kname}-kerncache-${clst_version_stamp}.tar.bz2)
23 fi
24 - if [ -e /var/tmp/${kname}.config ]
25 - then
26 + if [[ -e /var/tmp/${kname}.config ]]; then
27 GK_ARGS+=(--kernel-config=/var/tmp/${kname}.config)
28 fi
29 -
30 - if [ -d "/tmp/initramfs_overlay/${initramfs_overlay}" ]
31 - then
32 + if [[ -d /tmp/initramfs_overlay/${initramfs_overlay} ]]; then
33 GK_ARGS+=(--initramfs-overlay=/tmp/initramfs_overlay/${initramfs_overlay})
34 fi
35 - if [ -n "${clst_CCACHE}" ]
36 - then
37 + if [[ -n ${clst_CCACHE} ]]; then
38 GK_ARGS+=(--kernel-cc=/usr/lib/ccache/bin/gcc --utils-cc=/usr/lib/ccache/bin/gcc)
39 fi
40 -
41 - if [ -n "${clst_linuxrc}" ]
42 - then
43 + if [[ -n ${clst_linuxrc} ]]; then
44 GK_ARGS+=(--linuxrc=/tmp/linuxrc)
45 fi
46 -
47 - if [ -n "${clst_busybox_config}" ]
48 - then
49 + if [[ -n ${clst_busybox_config} ]]; then
50 GK_ARGS+=(--busybox-config=/tmp/busy-config)
51 fi
52 -
53 - if [ "${clst_target}" == "netboot" ]
54 - then
55 + if [[ ${clst_target} == netboot ]]; then
56 GK_ARGS+=(--netboot)
57
58 - if [ -n "${clst_merge_path}" ]
59 - then
60 + if [[ -n ${clst_merge_path} ]]; then
61 GK_ARGS+=(--initramfs-overlay="${clst_merge_path}")
62 fi
63 fi
64 -
65 - if [ -n "${clst_VERBOSE}" ]
66 - then
67 + if [[ -n ${clst_VERBOSE} ]]; then
68 GK_ARGS+=(--loglevel=2)
69 fi
70
71 - # Build with genkernel using the set options
72 - # callback is put here to avoid escaping issues
73 - if [ -n "${clst_VERBOSE}" ]
74 - then
75 + if [[ -n ${clst_VERBOSE} ]]; then
76 gk_callback_opts=(-vN)
77 else
78 gk_callback_opts=(-qN)
79 fi
80 - if [ -n "${clst_KERNCACHE}" ]
81 - then
82 + if [[ -n ${clst_KERNCACHE} ]]; then
83 gk_callback_opts+=(-kb)
84 fi
85 - if [ -n "${clst_FETCH}" ]
86 - then
87 + if [[ -n ${clst_FETCH} ]]; then
88 gk_callback_opts+=(-f)
89 fi
90 - if [ "${kernel_merge}" != "" ]
91 - then
92 +
93 + if [[ -n ${kernel_merge} ]]; then
94 genkernel --callback="emerge ${gk_callback_opts[@]} ${kernel_merge}" \
95 "${GK_ARGS[@]}" || exit 1
96 else
97 --
98 2.26.2