-
Notifications
You must be signed in to change notification settings - Fork 44
/
build.package
647 lines (560 loc) · 23.9 KB
/
build.package
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
##
## Copyright (C) 2012 - 2018 XBian
##
## Find us at: http://www.xbian.org http://github.com/xbianonpi/xbian
##
## This Program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This Program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with XBMC; see the file COPYING. If not, see
## <http://www.gnu.org/licenses/>.
##
##
config_patch_fuzzy=5
opt_arch=''
opt_action=''
result=0
export use_debug=no
export use_silent=no
if [ -e $XBIANROOT/common.functions ]; then
. $XBIANROOT/common.functions
else
echo "Wrong setup. Open folder containing xbianonpi/xbian clone and rerun \"./run.me prepare\""
exit 500
fi
do_prep()
{
dir="$1"
( rexp $dir/env; do_hooks pre-configure.d )
cd "$dir/working"
[ "$2" = force ] && runprepare=1 || runprepare=0
if [ -n "$config_source_prepare" ]; then
if [ -e configure ]; then
[ "$( find ./ -maxdepth 1 -iname configure.\* -newer configure | grep -c .; )" -gt 0 ] && runprepare=1 || :
else
runprepare=1
fi
# [ $runprepare -eq 1 ] && ( rexp ../env; do_run $config_build_env $config_source_prepare; )
[ $runprepare -eq 1 ] && ( do_run $config_source_prepare; ) || :
fi
[ "$2" = force ] && runconfigure=1 || runconfigure=0
if [ -n "$config_source_configure" ]; then
if [ -e configure ]; then
if [ -e Makefile ]; then
[ "$( find ./ -maxdepth 1 -iname Makefile\* ! -newer configure | grep -c .; )" -gt 0 ] && runconfigure=1 || :
else
runconfigure=1
fi
else
runconfigure=1
fi
[ $runconfigure -eq 1 ] && ( rexp ../env && do_run $config_build_env $config_source_configure; )
fi
( rexp ../env; do_hooks post-configure.d )
}
do_make()
{
dir="$1"
( rexp $dir/env; do_hooks pre-build.d )
cd "$dir/working"
if [ -n "$config_build_targets" ]; then
for t in $config_build_targets; do
( rexp ../env; do_run $config_build_env $config_build_make $t; )
done
else
( rexp ../env; do_run $config_build_env $config_build_make; )
fi
( rexp ../env; do_hooks post-build.d )
}
do_patch()
{
dir=$(basename "$1")
if [ -e build/$dir/working/.force.nopatch -a "$2" = fullrun ]; then
rm -f build/$dir/working/.force.nopatch
return 0
fi
[ ! -d ./patches ] && return 0
cd ./patches
for p in $({ find -L ./ -maxdepth 1 -iname \*.patch -type f 2>/dev/null | sort; find -L ./ -name "$dir" -type d 2>/dev/null| sort | xargs -L1 -I%% sh -c 'find -L %% -maxdepth 1 -iname \*.patch -type f | sort'; }); do
(
cd ../build/$dir/working
[ $use_silent = yes ] || echo "checking $p"
if patch -p1 --dry-run -F $config_patch_fuzzy < ../../../patches/$p &>/dev/null; then
[ $use_silent = yes ] || echo "Patching with $p"
do_run patch -p1 -F $config_patch_fuzzy < ../../../patches/$p
elif git apply --check < ../../../patches/$p &>/dev/null; then
[ $use_silent = yes ] || echo "Patching (git apply) with $p"
do_run git apply --whitespace=nowarn < ../../../patches/$p >/dev/null
else
echo "! won't patch with $p" >/dev/stderr
fi
echo "-----------------"
)
done
cd ..
if [ -d extra-files/$dir ]; then
(
cd extra-files/$dir
if command -v rsync >/dev/null; then
find . \( -type f -o -type l \) -exec rsync -a --info=name --relative --copy-unsafe-links {} ../../$1/working \;
else
find ./ -type f -print0 | xargs -0 cp -avr --parents --target-directory="../../$1/working" 2>/dev/null|| :
find ./ -type l -print0 | xargs -0 cp -avr --parents --target-directory="../../$1/working" 2>/dev/null|| :
fi
)
fi
}
do_wipe()
{
dir="$1"
if [ -n "$config_use_workspace" ] && mountpoint -q "$dir/working"; then
do_run rm -fr "$dir/working" 2>/dev/null || :
else
mountpoint -q "$dir/working" && while sudo /bin/umount "$dir/working"; do :; done
do_run rm -fr "$dir/working"
fi
}
do_clean()
{
dir="$1"
cd "$dir/working"
do_run $config_build_env $config_build_make clean
do_hooks post-clean.d
}
do_clone()
{
do_hooks pre-clone.d
dir="$1"
if [ "$config_source_keep" != yes ]; then
do_wipe "$dir"
fi
if [ -n "$WORKSPACE" ]; then
do_wipe "$dir" && mkdir -p "$dir/working"
sudo /bin/mount -o bind "$WORKSPACE" "$dir/working"
(
if [ -d "$dir/working/.git" ]; then
cd "$dir/working"
do_run git fetch --all
do_run git checkout "$config_source_branch"
do_run git reset --hard "origin/$config_source_branch"
do_run git clean -dfx
else
cd "$dir"
config_branch=''
[ -n "$config_source_branch" ] && export config_branch="-b "
do_run git clone $config_branch$config_source_branch $config_source_type_extra $config_source_addr working
cd working
fi
do_hooks post-clone.d
)
return 0
fi
initialrun=no
cd "$dir" || { mkdir -p "$dir" && cd "$dir"; }
if [ ! -d "./working/.git" ]; then
initialrun=yes
case "$config_source_type" in
git)
config_branch=''
[ -n "$config_source_branch" ] && export config_branch="-b "
do_run git clone $config_branch$config_source_branch $config_source_type_extra $config_source_addr working
[ -n "$config_checkout_commit" ] && { cd ./working; do_run git checkout $config_checkout_commit; }
[ -n "$config_source_tag" ] && { cd ./working; do_run git checkout tags/$config_source_tag -b $config_source_tag; }
;;
tar)
do_run wget $config_source_addr -O $(basename $config_source_addr)
mkdir -p working
tar -xf $(basename $config_source_addr) -C ./working --strip-components 1
cd ./working
;;
*)
mkdir -p working
cd ./working
;;
esac
else
cd ./working
if [ "$config_source_reset" = yes ]; then
case "$config_source_type" in
git)
do_run git clean -xdf -e .force*
do_run git reset --hard origin/$config_source_branch
[ -n "$config_source_tag" ] && do_run git checkout tags/$config_source_tag -b $config_source_tag
;;
tar)
rm -fr ./*
( cd ../; tar -zxf $(basename $config_source_addr) -C ./working --strip-components 1; )
;;
*)
;;
esac
fi
if [ "$config_source_branch" = yes ]; then
case "$config_source_type" in
git)
do_run git checkout -t -b "$config_source_branch"
[ -n "$config_source_tag" ] && do_run git checkout tags/$config_source_tag -b $config_source_tag
;;
*)
;;
esac
fi
if [ "$config_source_refresh" = yes -a $initialrun = no ] || [ "$config_source_refresh" = full -a $initialrun = no]; then
[ "$config_source_reset" = yes ] || touch .force.nopatch
case "$config_source_type" in
git)
ep=''; cmtnr=''
if git status | grep -q 'Changes not staged\|Untracked files'; then
echo "Commit local changes into new tmp branch ..."
git add --all .; sync
git commit -m "$(echo auto commit on action clone at - $(date))" --no-edit || :
fi
### reset main branch and pull changes from upstream
#grep -qi 'url = git://' -m1 .git/config && ep='--depth=1'
#git pull $ep origin $config_source_branch 2>&1 || :
[ "$config_source_refresh" = full ] && br='' || br=$config_source_branch
echo "Trying pull from remote ($br) ..."
do_run git pull origin $br
;;
*)
;;
esac
fi
fi
do_hooks post-clone.d
}
do_install()
{
# export MAKEFLAGS=-j1
dir="$1"
( rexp $dir/env; do_hooks pre-install.d )
export INSTALL_MOD_PATH=$(readlink -f ./content)
export INSTALL_FW_PATH=$(readlink -f ./content)
export DESTDIR=$(readlink -f ./content)
if [ "$config_deb_contentclean" = yes -a -e ./content ]; then
find ./content/ -mindepth 1 -maxdepth 1 ! -regex '.*/DEBIAN' -print0 | \
xargs -0 -L1 rm -r >/dev/null 2>&1|| :
fi
mkdir -p ./content
cd "$dir/working"
for t in $config_install_targets; do
( rexp ../env; do_run $config_build_env $config_build_make $t; )
done
unset DESTDIR
( rexp ../env; do_hooks post-install.d )
}
do_deb()
{
if echo $config_build_make | grep -q ^dpkg-buildpackage; then
do_hooks post-deb.d
return $?
fi
DESTDIR=$(pwd)/build/$config_platform_branch
[ -d "$dir/working" ] && \
(
cd "$dir/working"
commit_src=$(git log -n1 --format=oneline --remotes= | awk '{print $1}')
echo "commit_src=$commit_src" > $DESTDIR/src_repo_hash_HEAD
)
mkdir -p ./content
rm -f ./content/DEBIAN/* "$dir"/*.deb
# backcompatibility only, should be removed
[ -e ./content-tpl ] && cp -ar ./content-tpl/* ./content
[ -e build/content-tpl ] && cp -ar build/content-tpl/* ./content
[ -n "$config_platform_branch" ] && \
[ -e build/$config_platform_branch/content-tpl ] && cp -ar build/$config_platform_branch/content-tpl/* ./content
export MAKEFLAGS=-j1
rexp $dir/env
do_readconfig "$dir"
if [ "$config_deb_pkgcreatenative" = yes ] || [ "$config_deb_pkgcreatenative" = auto ]; then
[ -d "$dir/working" ] || return 0
cd "$dir/working"
do_hooks '##withbuildenv##' pre-deb.d
if [ "$config_deb_pkgcreatenative" = auto ] && [ -x debian/rules ]; then
do_run $config_build_env fakeroot debian/rules binary
DATE=$(date +%s)
for cl in $(find ./debian/ -maxdepth 1 -mindepth 1 -type f -name \*changelog\*); do
ver=$(grep . -m1 $cl | awk '{print $2}'); ver=${ver#\(}; ver=${ver%\)};
xbiantag=${ver#*~}
if [ "$xbiantag" != "$ver" -a "$xbiantag" = "xbian" ]; then
vernew="$ver$config_deb_version"
elif [ -z "$config_distro" ]; then
vernew="$ver-$DATE"
fi
for d in $(find ./debian/ -maxdepth 2 -mindepth 2 -type d -name DEBIAN); do
sed -i "s%^Version: $ver.*%Version: $vernew%g" $d/control
done
done
else
for h in dh_auto_install dh_install dh_installdocs dh_installchangelogs dh_installman \
dh_perl dh_link dh_compress dh_fixperms dh_strip dh_makeshlibs dh_shlibdeps \
dh_installdeb dh_gencontrol dh_md5sums; do
echo "Running $h"
do_run $config_build_env fakeroot $h -O--parallel \
$([ $h = dh_shlibdeps ] && echo '-- --ignore-missing-info') \
$([ $h = dh_autoinstall ] && echo "-O=-j$MAKEFLAGS")
done
ver=$(grep . -m1 debian/changelog | awk '{print $2}'); ver=${ver#\(}; ver=${ver%\)};
[ -z "$config_distro" ] && vernew="$ver-$(date +%s)" || vernew=$ver
for d in $(find ./debian/ -maxdepth 2 -mindepth 2 -type d -name DEBIAN); do
sed -i "s%$ver%$vernew%g" $d/control
done
fi
do_run $config_build_env fakeroot dh_builddeb
do_hooks post-deb.d
return 0
fi
[ -e content/DEBIAN/control-dbg ] && ctrldbg=content/DEBIAN/control-dbg
[ -z "$config_distro" ] && config_deb_version="$config_deb_version-$(date +%s)"
sed -i "s%__VERSION__%$config_deb_version%" content/DEBIAN/control $ctrldbg
sed -i "s%__ARCHBRANCH__%$config_platform/$config_branch%" content/DEBIAN/control $ctrldbg
[ -z "$config_deb_arch" ] && config_deb_arch=$(do_run $config_build_env dpkg-architecture -q DEB_TARGET_ARCH 2>/dev/null | grep -E "armhf|arm64") || :
sed -i "s%__ARCHITECTURE__%$config_deb_arch%" content/DEBIAN/control $ctrldbg
sed -i "s%__PKGNAME__%$config_deb_pkgname%" content/DEBIAN/control $ctrldbg
sed -i "s%__PKGDEPS__%Depends: $config_deb_depends%" content/DEBIAN/control $ctrldbg
if [ -n "$config_deb_ctrlextra" ]; then
sed -i "s%__CTRLEXTRA__%$config_deb_ctrlextra%" content/DEBIAN/control
printf "%b\n" "$(cat content/DEBIAN/control)" > content/DEBIAN/control.new
mv content/DEBIAN/control.new content/DEBIAN/control
else
sed -i '/__CTRLEXTRA__/d' content/DEBIAN/control $ctrldbg
fi
if [ -n "$config_deb_replaces" ]; then
sed -i "s%__REPLACES__%$config_deb_replaces,%" content/DEBIAN/control
printf "%b\n" "$(cat content/DEBIAN/control)" > content/DEBIAN/control.new
mv content/DEBIAN/control.new content/DEBIAN/control
fi
sed -i "s%__REPLACES__%%;s% % %" content/DEBIAN/control
if [ -d hooks.d/pre-deb.d ]; then
for f in $(ls hooks.d/pre-deb.d); do
(
echo "### Running hook $f from $1 ###"
cd "./content"; do_run sh ../hooks.d/pre-deb.d/$f; [ $? -ne 0 ] && res=FAILED || res=OK
echo "### Running hook $f from $1 finished $res ###"
)
done
fi
### git log -n1 --format=oneline | awk '{print $1}'
### git ls-remote $config_source_addr -h master | awk '{print $1}'
[ ! -e $DESTDIR/src_repo_hash_HEAD ] || . $DESTDIR/src_repo_hash_HEAD
rm -f $DESTDIR/src_repo_hash_HEAD
[ -n "$commit_src" ] && commit_src="at commit src $commit_src,"
echo " ($commit_src commit xbian repo $( [ -e .git ] && git log -n1 --format=oneline --remotes= | awk '{print $1}'))" >> content/DEBIAN/control
eval export $config_build_env 2>/dev/null && eval export $config_build_env
[ -e ./content/DEBIAN/control-dbg ] || find ./content -type f \( -executable -o -iname \*.so -o -iname \*.ko -o -iname \*.a \) -print0 | eval $config_build_env xargs -0 ${CROSS_COMPILE}strip --strip-unneeded -p 2>/dev/null || :
sync
do_run $SHELL $XBIANROOT/gen.package
do_hooks post-deb.d
mv *.deb "$dir"
[ ! -d $(pwd)/build/$config_platform_branch/working ] || touch $(pwd)/build/$config_platform_branch/working/.force.aptonly
}
do_release()
{
if [ -n "$config_use_workspace" ]; then
echo -e "\nRelease userworkspace $config_use_workspace"
for d in "$dir/working" ./content ./content-dbg; do
if mountpoint -q "$d"; then
m=umount
[ "$2" = fullrun -o "$2" = flush ] && { m='flush and umount'; rm -rf "$d" 2>/dev/null || :; }
echo "$m $d"; sudo /bin/umount "$d" && rm -rf "$d"
fi
done
fi
}
do_show_help()
{
echo "
Usage summary:
--arch, -m [platform/buildconfig] existing configurations as listed by --list
--action, -a [action[,action[,action[,...]]]] action to perform:
wipe - will completely remove working directory (including git clone of src repository)
clean - will run "make clean" in the working tree
clone - will run "git clone". if source is already cloned then reset/pull is part of this action
and finer control is allowed through three paramters - look at "patch" description
patch - will try to re-apply patches. if source is not reset to HEAD, nothing will be applied
(git reset operation is running in "clone" action as it is needed for correct auto
git pull. wheter reset is performed is controled by parameters config_source_keep,
config_source_reset and config_source_refresh - default values is YES)
prepare - will prepare sources for compilation. usually ./autogen.sh or ./bootstrap is started,
then ./configure. controlled via parameters config_source_prepare and
config_source_configure
make - runs "make". if finishes successfully, package is compiled and ready to be packaged
install - will run "make install". this will copy binaries into ./content folder, in final folder
structure
deb - will build package out of ./content folder. part of this action is also updating the
control files (version, commits, etc). binaries will be also stripped and final
.deb package will be moved into ./build/platform
--list, -l - list all available configured platforms / branches
--debug, -d - debug output
"
}
# ----------------------
GETOPT=$(getopt \
--longoptions=action:,list,arch:,config_source_refresh:,help,debug,silent \
--options=a:m:hlo:ds \
-- "$@" ) \
|| exit 128
export XBIANPKGDIR="$(pwd)"
if [ -e $XBIANPKGDIR/build.~lock ]; then
echo "another process running... or stale lock exists at $XBIANPKGDIR/build.~lock"
exit 100
fi
do_readconfig "$(pwd)/build"
[ $config_source_type = raw ] && { rm -fr "$(pwd)/content/"* && do_deb "$(pwd)/build"; exit 0; }
unset $(env | grep config_ | awk -F'=' '{print $1}'); opt_arch=''
for dir in $(find build/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | grep -vw content-tpl |sort); do
export XBIANARCHDIR=$(readlink -f "$dir")
unset $(env | grep config_ | awk -F'=' '{print $1}'); opt_arch=''
result=0
eval set -- ${GETOPT}
do_readconfig "$dir"
while [ "$#" -gt '0' ]; do
case "$1" in
(-l|--list)
cbe=$(eval echo $config_build_env | sed "s/\${config_os_version}/${config_os_version}/g;s/ARCH=.*//g" | sed "s/-c//g;s/schroot//g")
printf "ConfigName: %s\n\tTarget: %s\n\tBranch: %s\n\t URL: %s\n\n" "${dir#*build/}" "$(printf "%s" "$cbe" | grep -ow \
['amd64bookworm_gcc49'\|'armhfbookwormv6'\|'amd64bullseye_gcc49'\|'armhfbullseyev6'\|'amd64buster_gcc49'\|'armhfbusterv6'\|\
'amd64stretch_gcc49'\|'armhstretchv6'\|'armhfjessiev6'\|'armhfwheezyv6'\|'cross']\*)" $config_source_branch $config_source_addr
continue 2
;;
(--action|-a)
opt_action=$2
shift 2
;;
(--arch|-m)
opt_arch=$2
shift 2
;;
(-o)
do_run export $2
shift 2
;;
(--help|-h)
do_show_help
exit 0
;;
(-d|--debug)
export use_debug=yes
shift
;;
(-s|--silent)
export use_silent=yes
shift
;;
(-o|--sources)
source_branch="$2"
shift 2
;;
*)
shift 1
;;
esac
done
[ "$use_debug" = no ] || set -x
if [ -n "$opt_arch" -a "$opt_arch" != $(basename "$dir") ]; then
if [ -n "$source_branch" ]; then
! grep -q "^config_source_branch=$source_branch" "$dir/config" && continue
fi
continue
fi
[ "$opt_action" = '' ] && opt_action="build" || opt_action=$(echo $opt_action | tr ',' ' ')
if [ -z "$config_platforms" -o "$opt_action" != build ]; then
platforms=($config_platforms)
export config_platforms=none
fi
for arch_config in $config_platforms; do
echo "-------------------------------"
echo "PROCESSING $(basename $dir)";
if [ "$arch_config" = none ]; then
opt_actions="do_clone do_patch do_prep do_make do_install do_deb do_release"
opt_actions_done=''
[ ! -e "$dir/config" ] && [ -e $dir/config.${platforms[0]} ] && { [ -h "$dir/config" ] && rm -f $dir/config; ln -srf $dir/config.${platforms[0]} $dir/config; }
[ ! -e "$dir/env" ] && [ -e $dir/env.${platforms[0]} ] && { [ -h "$dir/env" ] && rm -f $dir/env; ln -srf $dir/env.${platforms[0]} $dir/env; }
else
opt_extradir=$(readlink -fm $XBIANARCHDIR/../../extra-files/$(basename $dir))
opt_actions="do_clone do_patch do_prep do_make do_install"
opt_actions_done="do_deb do_release"
echo " for platform $arch_config"
[ -e $dir/config.$arch_config ] && ln -srf $dir/config.$arch_config $dir/config
[ -e $dir/env.$arch_config ] && ln -srf $dir/env.$arch_config $dir/env
[ -e $opt_extradir/.config.$arch_config ] && ln -srf $opt_extradir/.config.$arch_config $opt_extradir/.config
fi
unset $(env | grep config_ | awk -F'=' '{print $1}')
do_readconfig $dir
echo "-------------------------------"
[ -z "$opt_arch" ] && opt_arch=$(basename "$dir")
export config_platform=${opt_arch%%-*}
export config_platform_branch=$opt_arch
export config_branch=${opt_arch##*-}
export config_arch_config=$arch_config
[ $config_branch = $config_platform ] && export config_branch=$config_source_branch
trap "kill_gitbuilder; sync; [ -z "$config_use_workspace" ] && mountpoint -q $dir/working && sudo /bin/umount $dir/working; " EXIT TERM
git_preloader
if [ -n "$config_use_workspace" ] && [ "$opt_action" != release ]; then
(
for d in "$dir/working" content content-dbg; do
if ! mountpoint -q "$d" || ! findmnt -n $(readlink -m $d) >/dev/null; then
! mountpoint -q "$d" && rm -fr "$d" && mkdir -p "$d" "$config_use_workspace/$config_platform_branch/$(basename $d)" && sudo /bin/mount --bind "$config_use_workspace/$config_platform_branch/$(basename $d)" "$d"
fi
done
)
fi
for a in $opt_action; do
case $a in
wipe)
( do_wipe "$dir" )
;;
clean)
( do_clean "$dir" )
;;
patch)
( do_patch "$dir" )
;;
prepare)
( do_prep "$dir" force )
;;
make)
( do_make "$dir" )
;;
clone)
( do_clone "$dir" )
;;
install)
( do_install "$dir" )
;;
deb)
( do_deb "$dir" )
;;
release|flush)
( do_release "$dir" "$a" )
;;
build)
dr=$(pwd)
[ -e "./.autowipe" ] && . "./.autowipe"
[ "$config_wipe_before" = "yes" ] && [ "$arch_config" = none ] && do_wipe "$dir" fullrun
for act in $opt_actions; do
#echo "( $act "$dir" fullrun )"
( $act "$dir" fullrun )
done
[ "$config_wipe_after" = "yes" ] && [ "$arch_config" = none ] && do_wipe "$dir" fullrun
;;
esac
done
done
if [ "$opt_action" = build ]; then
for act in $opt_actions_done; do
#echo "( $act "$dir" fullrun )"
( $act "$dir" fullrun )
done
fi
printf "\n-------------------------------\nFINISHED OK\n-------------------------------\n"
exit 0
done