config / .fgfs / fgaddon /
Newer Older
432 lines | 15.886kb
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
1
#!/bin/bash
2

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
3
set -e
4

            
5
declare -A data=(
6
        [/sim/description]=text
7
        [/sim/long-description]=text
8
        [/sim/author]=text
9
        [/sim/flight-model]=text
10
        [/sim/type]=text
11
        [/sim/model/path]=text
12
)
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
13
fgaddon_svn=https://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft
many improvement
Sébastien MARQUE authored on 2020-09-08
14
fgaddon_path=$HOME/.fgfs/flightgear-fgaddon/Aircraft
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
15
database=${DB:-$0.db}
16
#locale=fr
17

            
18
test -r "$0.conf" && source $0.conf && echo config red
19

            
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
20

            
21
aircrafts=$(mktemp --dry-run /dev/shm/Aircraft-XXXXXXXXX)
22
aircraft=$(mktemp --dry-run /dev/shm/aircraft-XXXXXXX)
23
setxml=$(mktemp --dry-run /dev/shm/setxml-XXXXXXXX)
24
in_ram_database=$(mktemp --dry-run /dev/shm/XXXXXXX)
25

            
26

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
27
function xmlgetnext () {
28
    local IFS='>'
29
    read -d '<' TAG VALUE
30
    # by design, the first TAG/VALUE pair is empty
31
    # to avoid infinite loops at end of file parsing we return an error
32
    # the next time we find an empty TAG
33
    if test -z "$TAG"; then
34
        test ${xmlgetnext_firstentry:-1} -eq 1 && xmlgetnext_firstentry=0 || return 1;
35
    fi
36
    # process $TAG only if necessary
37
    local _TAG=$(printf '%q' $TAG)
38
    if test ${_TAG:0:1} = '$'; then
39
        TAG=$(tr '\n' ' ' <<< $TAG | sed 's/  */ /g; s/ *$//')
40
    fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
41
}
42

            
43
function sqlite_request () {
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
44
    if ! sqlite3 "$in_ram_database" <<< "$1"; then
45
        register_state
46
    fi
47
}
48

            
49
function xmlremovecomments () {
50
    sed -ri 's/<(!--|script>)/\n&/;s/(<\/script|--)>/&\n/' $setxml
51
    sed -ri '/<(script>|!--).*(<\/script|--)>/d;/<(script>|!--)/,/(<\/script|--)>/d' $setxml
small stuff
Sébastien MARQUE authored on 2020-09-27
52
    sed -i 's/\xef\xbb\xbf//' $setxml # removes BOM
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
53
}
54

            
55
function trap_break () {
56
    trap '' INT
57
    echo "stop requested"
58
    register_state
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
59
}
60

            
61
function trap_exit () {
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
62
    trapped_rc=$?
63
    trap '' INT
64
    rm -f $aircrafts $aircraft $setxml
65
    if test ! -e $in_ram_database; then
66
        exit
67
    fi
68
    test $trapped_rc -ne 0 && register_state
many improvements
Sébastien MARQUE authored on 2020-09-02
69
    echo "updating installation status"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
70
    for ac in $(sqlite_request 'select printf("%i:%s/%s", aircrafts.id, aircrafts.name, setxml.file)
71
                                from aircrafts inner join setxml
72
                                where aircrafts.id = setxml.variantof and setxml.installed != 0;'); do
many improvements
Sébastien MARQUE authored on 2020-09-02
73
        ac_path=${ac#*:}
many improvement
Sébastien MARQUE authored on 2020-09-08
74
        if test ! -e $fgaddon_path/$ac_path-set.xml; then
75
            sqlite_request "update setxml set installed = 0 where file = '${ac_path#*/}' and variantof = ${ac%:*}"
76
        fi
77
    done
78
    for ac in $fgaddon_path/*/*-set.xml; do
79
        ac=${ac/$fgaddon_path}
80
        sx=${ac##*/}
81
        ac=${ac%/*}
82
        if test -d $fgaddon_path/$ac/.svn; then
83
            install_type=1
84
        elif test -d $fgaddon_path/$ac/.git; then
85
            install_type=2
86
        else
87
            install_type=3
88
        fi
89
        sqlite_request "update setxml set installed = $install_type
90
                        where exists (
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
91
                            select 1
92
                            from aircrafts
93
                            where name = '${ac/\/}' and setxml.variantof = id
many improvement
Sébastien MARQUE authored on 2020-09-08
94
                        )"
many improvements
Sébastien MARQUE authored on 2020-09-02
95
    done
improve output for missing a...
Sébastien MARQUE authored on 2020-09-23
96
    missing_setxml=$(sqlite_request "select printf(' - %s', name) from aircrafts where id not in (select variantof from setxml)")
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
97
    if test -n "$missing_setxml"; then
improve output for missing a...
Sébastien MARQUE authored on 2020-09-23
98
        echo -e "missing setxml config for :\n$missing_setxml"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
99
    fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
100
    if test -r "$database" && md5sum $in_ram_database | sed "s,$in_ram_database,$database," | md5sum --status -c -; then
101
        rm -f $in_ram_database
many improvements
Sébastien MARQUE authored on 2020-09-02
102
        echo "no changes in $database"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
103
    elif test -w "$database"; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
104
        sqlite_request "vacuum"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
105
        mv -f $in_ram_database "$database"
many improvements
Sébastien MARQUE authored on 2020-09-02
106
        echo "database $database updated"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
107
    elif ! test -e "$database"; then
108
        mv $in_ram_database "$database"
many improvements
Sébastien MARQUE authored on 2020-09-02
109
        echo "database $database created"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
110
    else
111
        rm -f $in_ram_database
many improvements
Sébastien MARQUE authored on 2020-09-02
112
        echo "nothing can be done with $database !"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
113
    fi
114
}
115

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
116
function register_state () {
117
    sqlite_request "drop table if exists recover_rev"
118
    sqlite_request "create table recover_rev (
119
                        revkey text,
120
                        revision integer,
121
                        revauthor text,
122
                        revdate integer
123
                    )"
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
124
    for revkey in ${!revindex[@]}; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
125
        sqlite_request "insert into recover_rev values (
126
                            '$revkey',
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
127
                            ${revindex[$revkey]:-0},
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
128
                            '${revauthor[$revkey]}',
129
                            ${revdate[$revkey]:-0}
130
                        )"
131
    done
132
    sqlite_request "drop table if exists recover_setxmlmodified"
133
    sqlite_request "create table if not exists recover_setxmlmodified (
134
                        sx text
135
                    )"
136
    for sx in ${!setxmlmodified[@]}; do
137
        sqlite_request "insert into recover_setxmlmodified values (
138
                            '$sx'
139
                        )"
140
    done
141
    exit
142
}
143

            
144
function update_database () {
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
145
    echo "[ ${#revindex[@]} ] ${ac:1}"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
146

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
147
    dbupdate=$(sqlite_request "select revision from aircrafts where name is '${ac:1}'")
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
148
    if test -z "$dbupdate"; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
149
        sqlite_request "insert into aircrafts (name, revision, date, author)
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
150
                        values ('${ac:1}', ${revindex[$ac]}, ${revdate[$ac]}, '${revauthor[$ac]}')"
151
    elif test $dbupdate -lt ${revindex[$ac]}; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
152
        sqlite_request "update aircrafts set
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
153
                            revision = ${revindex[$ac]},
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
154
                            author   = '${revauthor[$ac]}',
155
                            date = ${revdate[$ac]}
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
156
                        where name is '${ac:1}'"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
157
    fi
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
158
    id=$(sqlite_request "select id from aircrafts where name is '${ac:1}'")
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
159

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
160
    for sx in ${!setxmlmodified[@]}; do
161
        unset include include_rootpath
162
        [[ "$sx" =~ ^"${ac:1}/" ]] || continue
163
        for col in ${!data[@]}; do
164
            data[$col]=
165
        done
166
        sx=${sx#*/}
remove -set.xml from filenam...
Sébastien MARQUE authored on 2020-09-02
167
        echo " -> $sx"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
168
        if ! svn export --quiet --force $fgaddon_svn/${ac:1}/$sx-set.xml $setxml; then
169
            register_state
170
        fi
171
        xmlremovecomments
172
        unset xmlgetnext_firstentry property
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
173
        while xmlgetnext; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
174
            case "${TAG:0:1}" in
175
                ''|'?'|'!')
176
                    continue;;
177
                /)
178
                    property=${property%/*};;
179
                *)
180
                    if test "${TAG: -1}" != '/'; then
181
                        property+=/${TAG%% *}
fix syntax mistake
Sébastien MARQUE authored on 2020-09-21
182
                    fi;;
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
183
#                    property+=/${TAG%% *}
184
#                    if test "${TAG: -1}" = '/'; then
185
#                        _TAG=${TAG:0:-1}
186
#                        test "${_TAG#* }" != "${_TAG}" && eval "${_TAG#* }"
187
#                        property=${property%/*}
188
#                    fi;;
189
            esac
190

            
191
            if [[ "$TAG" =~ ^"PropertyList include=" ]]; then
192
                include_rootpath=${include%/*}
193
                test $include = $include_rootpath && unset include_rootpath
194
                eval $(echo ${TAG#* })
195
                [[ "$include" =~ ^Aircraft/Generic/ ]] && unset include include_rootpath && continue
196
                if [[ "$include" =~ ^'../' ]]; then
197
                    if test -n "$include_rootpath"; then
198
                        if [[ "$include_rootpath" =~ '/' ]]; then
199
                            include_rootpath=${include_rootpath%/*}
200
                        else
201
                            unset include_rootpath
202
                        fi
203
                    else
204
                        ac_save=$ac
205
                        unset ac
206
                    fi
207
                    include=${include/\.\.\/}
208
                fi
209
                if ! svn cat $fgaddon_svn/${ac:1}/${include_rootpath:+$include_rootpath/}$include >> $setxml; then
210
                    register_state
211
                fi
212
                xmlremovecomments
213
            fi
214

            
215
            if [[ "$property" = /PropertyList@($data_pattern) ]]; then
fix overriding descs with in...
Sébastien MARQUE authored on 2020-09-27
216
                if test -z "${data[${property/\/PropertyList}]}"; then
217
                    eval "data[${property/\/PropertyList}]=\"${VALUE//\"/\\\"}\""
218
                    data[${property/\/PropertyList}]=$(tr '\n' ' ' <<< ${data[${property/\/PropertyList}]} | sed -r 's/^\s*//;s/\s+/ /g;s/\s*$//')
219
                fi
many improvement
Sébastien MARQUE authored on 2020-09-08
220
            fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
221

            
small stuff
Sébastien MARQUE authored on 2020-09-27
222
#            if test -n "$_TAG"; then
223
#                # _TAG non-null means xml props ends with /
224
#                # need to go back of last property
225
#                property=${property/%\/${_TAG%% *}}
226
#                unset _TAG
227
#            fi
many improvement
Sébastien MARQUE authored on 2020-09-08
228

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
229
            # continue parsing (while loop) until everything's found
230
            for col in ${!data[@]}; do
231
                test -z "${data[$col]}" && continue 2
232
            done
233
            break # everything's found
234
        done < $setxml
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
235

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
236
        if eval "test -z \"$data_test_null\""; then
237
            echo "WARNING: no info found, skipping"
238
            continue
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
239
        fi
240

            
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
241
        known=$(sqlite_request "select variantof from setxml where file is '$sx'")
242
        if test -n "$known"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
243
            for col in ${!data[@]}; do
244
                dbvalue=$(sqlite_request "select '$col'
245
                                          from setxml
246
                                          where file is '$sx' and variantof = $known")
247
                if test "$dbvalue" != "${data[$col]}" -a -n "${data[$col]}"; then
248
                    sqlite_request "update setxml
249
                                    set '$col' = '${data[$col]//\'/\'\'}'
250
                                    where file is '$sx' and variantof = $known"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
251
                fi
252
            done
253
        else
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
254
            values="'$sx', $id, "
255
            for col in ${!data[@]}; do
256
                values+="'${data[$col]//\'/\'\'}', "
257
            done
258
            values+=0
259
            sqlite_request "insert into setxml values ($values)"
260
        fi
261
        test -n "$ac_save" && ac=$ac_save
262
        unset setxmlmodified[${ac:1}/$sx]
263
    done
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
264
    unset revindex[$ac]
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
265
}
266

            
267
function apply_revision () {
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
268
    for ac in "${!revindex[@]}"; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
269
        update_database
270
        if test -d $fgaddon_path/${ac:1}/.svn \
271
        && test "$(svn info --show-item=url $fgaddon_path/${ac:1})" != "$fgaddon_svn/${ac:1}" \
272
        || test -d $fgaddon_path/${ac:1} -a ! -d $fgaddon_path/${ac:1}/.svn; then
273
            echo "INFO: local ${ac:1} installed out from repo" >&2
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
274
        fi
275
    done
276
}
277

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
278
trap trap_break INT
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
279
trap trap_exit EXIT
280

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
281
stty -echoctl
282

            
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
283
declare -A revindex revauthor revdate setxmlmodified files revpath
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
284
data_pattern=$(printf "%s|" ${!data[@]})
285
data_pattern=${data_pattern:0:-1}
286
data_test_null=$(printf '${data[%s]}' ${!data[@]})
287

            
288
if test -e $database; then
289
    cp $database $in_ram_database
290
    sql_cols=$(sqlite_request "pragma table_info(setxml)" | awk -F'|' '{printf("%s %s ", $2, $3)}')
291
    script_cols="file text variantof integer "
292
    for col in ${!data[@]}; do
293
        script_cols+="$col ${data["$col"]} "
294
    done
295
    script_cols+="installed integer " # last space is important
296
    if test "$sql_cols" != "$script_cols"; then
297
        echo "ALERT: datbase version mismatch !"
298
        exit 1
299
    fi
300
    if sqlite_request '.tables' | grep -q 'recover_' && test -z "$1"; then
301
        echo "recovering from previous saved state"
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
302
        eval $(sqlite_request "select printf('revindex[%s]=%u;revauthor[%s]=%s;revdate[%s]=%u;',
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
303
                                       revkey, revision,
304
                                       revkey, revauthor,
305
                                       revkey, revdate)
306
                               from recover_rev")
307
        eval $(sqlite_request "select printf('setxmlmodified[%s]=1;', sx)
308
                               from recover_setxmlmodified")
309
        sqlite_request "drop table recover_rev"
310
        sqlite_request "drop table recover_setxmlmodified"
311
        apply_revision
312
        exit
313
    fi
314
fi
315

            
316
sqlite_request "create table if not exists aircrafts (
317
                    id integer primary key,
318
                    name text,
319
                    revision integer,
320
                    date integer,
321
                    author text)"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
322

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
323
sqlite_request "create table if not exists setxml (
324
                    file text,
325
                    variantof integer,
326
                    $(for col in ${!data[@]}; do printf "'%s' %s, " $col ${data[$col]}; done)
327
                    installed integer)"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
328

            
search for next revision
Sébastien MARQUE authored on 2020-10-19
329
latest_revision=$(( $(sqlite_request "select max(revision) from aircrafts") + 1 ))
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
330

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
331
# for debugging purpose
332
if test -n "$2"; then
333
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
334
    revindex[$ac]=1
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
335
    revdate[$ac]=0
336
    revauthor[$ac]=foobar
337
    setxmlmodified[${ac:1}/${1#*/}]=1
338
    set -x
339
    update_database
340
    set +x
341
    exit
342
elif test -n "$1"; then
343
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
344
    eval $(sqlite_request "select printf('revindex[_%s]=%s;revdate[_%s]=%i;revauthor[_%s]=%s;',
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
345
                                            name, revision,
346
                                            name, date,
347
                                            name, author)
348
                           from aircrafts
349
                           where name = '${ac:1}'")
350
    setxmlmodified[${ac:1}/${1#*/}]=1
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
351
    if test -z "${revindex[$ac]}"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
352
        echo "aircraft ${ac:1} not found"
353
        rm $in_ram_database
354
        exit
355
    fi
356
    update_database
357
    exit
358
fi
359

            
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
360
echo "downloading FGADDON history from revision ${latest_revision:-0}"
361
svn log --revision ${latest_revision:-0}:HEAD --xml --verbose $fgaddon_svn > $aircrafts
362

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
363
total=$(grep -c '<logentry' $aircrafts)
364
progress=0
365

            
366
echo parsing history
367

            
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
368
while xmlgetnext; do
369
    case "$TAG" in
370
        'logentry revision='*)
371
            eval $(echo ${TAG#* })
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
372
            for action in ${!revpath[@]}; do
373
                unset revpath[$action]
374
            done
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
375
        ;;
376
        'author')
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
377
            revauthor=${VALUE//\'/\'\'}
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
378
        ;;
379
        'date')
380
            revdate=$(date +%s -d "$VALUE")
381
        ;;
382
        'path '*)
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
383
            TAG=${TAG#* }
384
            TAG=${TAG// /;}
385
            TAG=${TAG//-/_}
386
            eval $(echo ${TAG// /;})
387
            path=(${VALUE//\// })
388
            if test $kind = 'file' -a ${#path[@]} -gt 3; then
389
                revpath[$action]+="$VALUE "
390
            elif test $kind = 'dir' -a ${#path[@]} -eq 3 -a $action = 'D'; then
391
                files[_${path[2]}]=0
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
392
                unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
393
                for sx in ${!setxmlmodified[@]}; do
394
                    [[ "$sx" =~ "${path[2]}/" ]] && unset setxmlmodified[$sx]
395
                done
396
            fi
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
397
        ;;
398
        '/logentry')
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
399
            for item in ${revpath[D]}; do
400
                path=(${item//\// })
manage aircraft deletion
Sébastien MARQUE authored on 2020-09-23
401
                if [[ "${path[3]}" =~ "-set.xml" ]]; then
402
                    unset setxmlmodified[${path[2]}/${path[3]/-set.xml}]
403
                    sqlite_request "delete from setxml where file = '${path[3]/-set.xml}'"
404
                fi
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
405
                files[_${path[2]}]=$(( --files[_${path[2]}] ))
406
                if test ${files[_${path[2]}]} -le 0; then
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
407
                    unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
manage aircraft deletion
Sébastien MARQUE authored on 2020-09-23
408
                    sqlite_request "delete from aircrafts where name = '${path[2]}'"
many improvement
Sébastien MARQUE authored on 2020-09-08
409
                fi
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
410
            done
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
411
            for action in A M R; do
412
                for item in ${revpath[$action]}; do
413
                    path=(${item//\// })
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
414
                    revindex[_${path[2]}]=$revision
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
415
                    revauthor[_${path[2]}]=$revauthor
416
                    revdate[_${path[2]}]=$revdate
417
                    [[ "${path[3]}" =~ "-set.xml" ]] && setxmlmodified[${path[2]}/${path[3]/-set.xml}]=1
418
                    test $action = 'A' && files[_${path[2]}]=$(( ++files[_${path[2]}] ))
419
                done
420
            done
421
            newprogress=$((++logentry * 100 / $total))
422
            if test $(( $newprogress - $progress )) -ge ${progress_granularity:-1}; then
423
                progress=$newprogress
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
424
                echo "$progress% (${#revindex[@]})"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
425
            fi
426
        ;;
427
        '/log')
428
            apply_revision
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
429
            break
430
        ;;
431
    esac
432
done < $aircrafts