annotate gsm-fw/cfgmagic/functions @ 861:6ffebb8cec78

implemented feature mokoffs copy; made it part of the gtamodem-gsm config
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 03 May 2015 05:10:58 +0000
parents 11b6ca57a079
children 042c178ebac5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 target() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 if [ $# -lt 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 echo "target setting: required argument missing" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 if [ -n "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 echo "Error: target specified more than once" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 if [ ! -f "cfgmagic/target.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 echo "Error: target $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 TARGET="$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 . "cfgmagic/target.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 . cfgmagic/post-target
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 feature() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if [ $# -lt 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 echo "feature setting: required argument missing" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if [ -z "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 echo "Please specify the target before any features" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 if [ ! -f "cfgmagic/feature.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 echo "Error: feature $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 . "cfgmagic/feature.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 export_to_c() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
44 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
45 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
46 case "$c_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
47 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
48 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
49 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
50 c_export_list="$c_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
51 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
52 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
53 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
54 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 export_to_mk() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
58 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
59 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
60 case "$mk_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
61 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
62 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
63 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
64 mk_export_list="$mk_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
65 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
66 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
67 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
68 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 export_to_m4() {
524
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
72 while [ $# != 0 ]
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
73 do
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
74 case "$m4_export_list" in
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
75 *" $1 "* | *" $1")
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
76 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
77 *)
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
78 m4_export_list="$m4_export_list $1"
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
79 ;;
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
80 esac
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
81 shift
11b6ca57a079 gsm-fw/cfgmagic: first rough sketch at L1 configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
82 done
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 }