-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyalda
executable file
·99 lines (75 loc) · 2.01 KB
/
yalda
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
93
94
95
96
97
98
99
#!/usr/bin/env bash
export environment="$1"
export component="$2"
export action="$3"
source "$environment"
function get_conf_var {
local conf="$1"
local comp="${component}"
if [ ! "$2" == "" ]; then
comp="$2"
fi
local component_varname="${comp^^}_${conf^^}"
echo "${!component_varname}"
}
component_dir="$(get_conf_var dir)"
component_git="$(get_conf_var git)"
component_branch="$(get_conf_var branch)"
component_source="$(get_conf_var source)"
component_patch="$(get_conf_var patch)"
component_patches_dir="$(get_conf_var patches_dir)"
component_configure="$(get_conf_var configure)"
component_build="$(get_conf_var build)"
component_run="$(get_conf_var run)"
component_out="$(get_conf_var out_${component} yalda)"
# TODO: redesign rootfs output
component_out_rootfs="${component_out}/rootfs"
if [ "${component}" == "rootfs" ]; then
component_out_rootfs="${component_out}"
fi
function component_fetch {
if [ -d "${component_dir}" ]; then
rm -rf "${component_dir}"
fi
git clone -b "${component_branch}" --depth 1 "${component_git}" "${component_dir}"
}
function component_patch {
export QUILT_PATCHES=${component_patches_dir}
echo 'Patching...'
quilt unapplied && quilt push -a
}
function component_build {
if [ ! "${component_build}" == "y" ]; then
return
fi
if [ "${component_source}" == "git" ]; then
component_fetch
fi
if [ ! -d "${component_dir}" ]; then
echo "WARNING! ${component_dir} does not exist, skipping"
exit 1
fi
chdir "${component_dir}"
if [ "${component_configure}" == "y" ]; then
_configure
fi
if [ "${component_patch}" == "y" ]; then
component_patch
fi
_build
rm -rf "${component_out}"
mkdir -pv "${component_out}" "${component_out_rootfs}"
_install
}
function component_run {
_run
}
function component_clean {
chdir "${component_dir}"
_clean
}
function command_execute {
component_${action}
return
}
command_execute