xenomai: new package, only mercury for now supported
[openadk.git] / scripts / update-patches2
blob03a8690b560f03683c6945bf80eaa07c4143deb5
1 #!/usr/bin/env mksh
2 #-
3 # Copyright © 2014
4 #       Thorsten Glaser <tg@mirbsd.org>
6 # Provided that these terms and disclaimer and all copyright notices
7 # are retained or reproduced in an accompanying document, permission
8 # is granted to deal in this work without restriction, including un‐
9 # limited rights to use, publicly perform, distribute, sell, modify,
10 # merge, give away, or sublicence.
12 # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
13 # the utmost extent permitted by applicable law, neither express nor
14 # implied; without malicious intent or gross negligence. In no event
15 # may a licensor, author or contributor be held liable for indirect,
16 # direct, other damage, loss, or other issues arising in any way out
17 # of dealing in the work, even if advised of the possibility of such
18 # damage or existence of a defect, except proven that it results out
19 # of said person’s immediate fault when using the work as intended.
21 PATCH_LIST='patch-* *.patch'
22 CURDIR=$PWD
23 export CURDIR PATCH_LIST
25 rm -f patches/*.new
26 mksh "${ADK_TOPDIR}"/scripts/update-patches |&
27 first=1
28 set -A toedit
29 while IFS= read -p -d '' -r; do
30         if (( first )); then
31                 if [[ $REPLY = FAIL ]]; then
32                         rm -rf "${WRKDIR1}.orig"
33                         exit 1
34                 fi
35                 first=0
36         fi
37         toedit+=("$REPLY")
38 done
39 if (( !first )); then
40         print -n 'edit patches: '
41         read
42         cd patches
43         ${VISUAL:-${EDITOR:-vi}} "${toedit[@]}"
44         cd ..
46 rm -rf "${WRKDIR1}.orig"
47 exit 0