blob: 1d2b08f0f7c0c1d11326805ce2d018785029eb05 (
plain)
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
|
#!/bin/bash
[[ -d "$1" ]] || {
echo "Usage: $(basename $0) <busybox_sourcedir>"
exit 1
}
bbsrc="$(realpath $1)"
cd $(dirname $0)
[[ -e config.new ]] && {
echo -n "config.new exists already. delete? [y|n] "
read ans
case "$ans" in
y|Y)
rm -rf config.new
;;
n|N)
;;
*)
echo "what is '$ans'?"
exit 1
esac
}
mkdir -p config.new
# store config paths relative to $bbsrc into an array
readarray -t configs <<< $(cd "$bbsrc"; find . -type f -name Config.in)
# copy each config into config.new
for config in "${configs[@]}"; do
mkdir -p config.new/$(dirname $config)
cp "$bbsrc/$config" "config.new/$config"
done
# store defined config symbols into an array
readarray -t symbols <<< $(grep -hr '^config ' config.new | cut -d' ' -f2)
### customize busybox config system for OpenADK
cd config.new
# no extra mainmenu, allow replacing PREFIX
sed -i -e 's/^mainmenu/# mainmenu/' -e 's,./_install,@IDIR@,' Config.in
# prefix all symbols with BUSYBOX_ to create a namespace
# limit replacement to lines containing given keywords to
# not mess up help texts and prompts too much
keywords='\(config\|depends\|range\|select\|default\|^if \)'
sympipe=$(IFS='|'; echo "${symbols[*]}" | sed -e 's/|/\\|/g')
sympipe_s='/'$keywords'/s/\b\('$sympipe'\)\b/BUSYBOX_\1/g'
# fix path of all sourced files
source_s='s,^\(source *\)\([^ ]*\)$,\1package/busybox/config/\2,'
sed -i -e "$sympipe_s" -e "$source_s" "${configs[@]}"
|