Browse Source

Add docstrings to mkit's functions

Alois Mahdal 9 years ago
parent
commit
035aa8b343
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      mkit/include/common.sh

+ 21
- 0
mkit/include/common.sh View File

6
 }
6
 }
7
 
7
 
8
 build1() {
8
 build1() {
9
+    #
10
+    # Process one skeleton
11
+    #
9
     local srcpath dstpath
12
     local srcpath dstpath
10
     srcpath=$1
13
     srcpath=$1
11
     dstpath=${srcpath%.skel}
14
     dstpath=${srcpath%.skel}
22
 }
25
 }
23
 
26
 
24
 build() {
27
 build() {
28
+    #
29
+    # Add meat to all skeletons
30
+    #
25
     local srcpath
31
     local srcpath
26
     find -type f -name '*.skel' \
32
     find -type f -name '*.skel' \
27
      | while read srcpath;
33
      | while read srcpath;
51
 }
57
 }
52
 
58
 
53
 die() {
59
 die() {
60
+    #
61
+    # Exit with message and non-zero exit status
62
+    #
54
     echo "$@" >&2
63
     echo "$@" >&2
55
     exit 4
64
     exit 4
56
 }
65
 }
96
 }
105
 }
97
 
106
 
98
 expand_groups() {
107
 expand_groups() {
108
+    #
109
+    # Read path groups from paths.ini and expand to install params
110
+    #
99
     local group
111
     local group
100
     local mode
112
     local mode
101
     cat "mkit/paths.ini" \
113
     cat "mkit/paths.ini" \
109
 }
121
 }
110
 
122
 
111
 expand_paths() {
123
 expand_paths() {
124
+    #
125
+    # For each path of group $1, print all install params
126
+    #
112
     local group=$1
127
     local group=$1
113
     local mode=$2
128
     local mode=$2
114
     local root="$(get_root $group)"
129
     local root="$(get_root $group)"
135
 }
150
 }
136
 
151
 
137
 get_root() {
152
 get_root() {
153
+    #
154
+    # Find out target rooot for group $1
155
+    #
138
     local group="$1"
156
     local group="$1"
139
     local varname="${group^^*}_DIR"
157
     local varname="${group^^*}_DIR"
140
     test -n "${!varname}" || die "missing in config.mk: $varname"
158
     test -n "${!varname}" || die "missing in config.mk: $varname"
232
 }
250
 }
233
 
251
 
234
 read_section() {
252
 read_section() {
253
+    #
254
+    # Read one INI section
255
+    #
235
     local wnt=$1
256
     local wnt=$1
236
     local ok=false
257
     local ok=false
237
     grep '.' \
258
     grep '.' \