c979f9 Update identity functionality:

Authored and Committed by areguera 13 years ago
    Update identity functionality:
    
        - Add identity_renderPostActions and identity_renderLastActions to
          handle post-rendition and last-rendition actions respectively.
          
        - Update identity_renderBase to start using
          identity_renderPostActions and identity_renderLastActions
          functions.
    
        - Update post-rendition and last-rendition actions to remove
          definition of FILE and ACTION variables from them. Such
          variables are already defined by identity_renderBase and
          identity_renderPostActions and identity_renderLastActions. We
          only need to reuse them, there is no need to redefine them from
          themselves.
    
    
        
Scripts/Bash/Functions/Identity/identity_renderBase.sh CHANGED
@@ -40,7 +40,7 @@ function identity_renderBase {
40
40
local -a COMMONDIRS
41
41
42
42
# Redefine parent directory for current workplace.
43
- PARENTDIR=$(basename "$ACTIONVAL")
43
+ PARENTDIR=$(basename "${ACTIONVAL}")
44
44
45
45
# Define base location of template files.
46
46
identity_renderDirTemplate
@@ -60,6 +60,9 @@ function identity_renderBase {
60
60
COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1))
61
61
done
62
62
63
+ # Reset common directory counter.
64
+ COMMONDIRCOUNT=0
65
+
63
66
# Define export id used inside design templates. This value
64
67
# defines the design area we want to export.
65
68
EXPORTID='CENTOSARTWORK'
@@ -183,42 +186,21 @@ function identity_renderBase {
183
186
fi
184
187
185
188
# Execute post-rendition actions.
186
- for ACTION in "${POSTACTIONS[@]}"; do
189
+ identity_renderPostActions
187
-
188
- case "$ACTION" in
189
-
190
- renderSyslinux* )
191
- identity_renderSyslinux "${FILE}" "$ACTION"
192
- ;;
193
-
194
- renderGrub* )
195
- identity_renderGrub "${FILE}" "$ACTION"
196
- ;;
197
-
198
- renderFormats:* )
199
- identity_renderFormats "${FILE}" "$ACTION"
200
- ;;
201
-
202
- groupByType:* )
203
- identity_renderGroupByType "${FILE}" "$ACTION"
204
- ;;
205
-
206
- esac
207
-
208
- done
209
190
210
191
# Output separator line.
211
192
cli_printMessage '-' 'AsSeparatorLine'
212
193
213
- # Apply last-rendition actions. As convenction, last-rendition
194
+ # Verify position of file being produced in the list of files
195
+ # been currently processed. As convenction, last-rendition
214
196
# actions are applied after all images inside the same
215
- # directory structure have been produced. Notice that, in
197
+ # directory structure have being produced. Notice that, in
216
198
# order to apply last-rendition actions correctly,
217
199
# centos-art.sh needs to "predict" what the last file in the
218
200
# same directory structure would be. There is no magic here,
219
201
# so we need to previously define which are the common
220
- # directory structures centos-art.sh could produce content
221
- # for inside an array variable. Later, using the index of that
202
+ # directory structures centos-art.sh could produce content for
203
+ # inside an array variable. Later, using the index of that
222
204
# array variable we could check the next item in the array
223
205
# against the file being currently produced. If they match, we
224
206
# haven't reached the end of the same directory structure, but
@@ -231,34 +213,15 @@ function identity_renderBase {
231
213
# At this point centos-art.sh should be producing the last
232
214
# file from the same unique directory structure, so,
233
215
# before producing images for the next directory structure
234
- # lets evaluate last-rendition actions for the current
216
+ # lets execute last-rendition actions for the current
235
217
# directory structure.
236
- for ACTION in "${LASTACTIONS[@]}"; do
218
+ identity_renderLastActions
237
-
238
- case "$ACTION" in
239
-
240
- renderKSplash )
241
- identity_renderKsplash
242
- ;;
243
-
244
- renderDm:* )
245
- identity_renderDm "$ACTION"
246
- ;;
247
219
248
- groupByType:* )
249
- identity_renderGroupByType "$ACTION"
250
- ;;
251
-
252
- renderBrands )
253
- identity_renderBrands "${FILE}" "$ACTION"
254
- ;;
255
-
256
- esac
257
- done
258
220
fi
259
221
260
222
# Increment common directory counter.
261
223
COMMONDIRCOUNT=$(($COMMONDIRCOUNT + 1))
262
224
263
225
done
226
+
264
227
}
Scripts/Bash/Functions/Identity/identity_renderDm.sh CHANGED
@@ -58,7 +58,7 @@ function identity_renderDm {
58
58
59
59
# Get display manager passed from render.conf.sh pre-rendition
60
60
# configuration script.
61
- DM=$(identity_renderConfigOption "$1" '2')
61
+ DM=$(identity_renderConfigOption "${ACTION}" '2')
62
62
63
63
# Sanitate display manager passed from render.conf.sh
64
64
# pre-rendition configuration script. Whatever value be retrived
@@ -69,7 +69,7 @@ function identity_renderDm {
69
69
70
70
# Get screen resolutions passed from render.conf.sh pre-rendition
71
71
# configuration script.
72
- RESOLUTIONS=$(identity_renderConfigOption "$1" '3')
72
+ RESOLUTIONS=$(identity_renderConfigOption "${ACTION}" '3')
73
73
74
74
# Check screen resolutions passed from render.conf.sh
75
75
# pre-rendition configuration script.
Scripts/Bash/Functions/Identity/identity_renderFormats.sh CHANGED
@@ -29,9 +29,6 @@
29
29
30
30
function identity_renderFormats {
31
31
32
- # Get absolute path of PNG image file.
33
- local FILE="$1"
34
-
35
32
# Get image formats.
36
33
local FORMATS=$(identity_renderConfigOption "$2" '2-')
37
34
Scripts/Bash/Functions/Identity/identity_renderGrub.sh CHANGED
@@ -26,10 +26,6 @@
26
26
27
27
function identity_renderGrub {
28
28
29
- local FILE="$1"
30
- local ACTION="$2"
31
- local OPTIONS=''
32
-
33
29
# Define 16 colors images default file name prefix.
34
30
local PREFIX='-14c'
35
31
@@ -37,7 +33,7 @@ function identity_renderGrub {
37
33
# configuration script. These options are applied to pnmremap when
38
34
# doing color reduction, so any option available for pnmremap
39
35
# command can be passed to renderSyslinux functionality.
40
- OPTIONS=$(identity_renderConfigOption "$ACTION" '2-')
36
+ local OPTIONS=$(identity_renderConfigOption "$ACTION" '2-')
41
37
42
38
# Re-define 16 colors images default file name prefix using
43
39
# options as reference. This is useful to differenciate final
Scripts/Bash/Functions/Identity/identity_renderLastActions.sh ADDED
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+ #
3
+ # identity_renderLastActions.sh -- This function executes
4
+ # last-rendition actions.
5
+ #
6
+ # Copyright (C) 2009-2011 Alain Reguera Delgado
7
+ #
8
+ # This program is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU General Public License as
10
+ # published by the Free Software Foundation; either version 2 of the
11
+ # License, or (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful, but
14
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
+ # USA.
22
+ #
23
+ # ----------------------------------------------------------------------
24
+ # $Id$
25
+ # ----------------------------------------------------------------------
26
+
27
+ function identity_renderLastActions {
28
+
29
+ local ACTION=''
30
+
31
+ for ACTION in "${LASTACTIONS[@]}"; do
32
+
33
+ case "${ACTION}" in
34
+
35
+ renderKSplash )
36
+ identity_renderKsplash
37
+ ;;
38
+
39
+ renderDm:* )
40
+ identity_renderDm
41
+ ;;
42
+
43
+ groupByType:* )
44
+ identity_renderGroupByType
45
+ ;;
46
+ esac
47
+
48
+ done
49
+
50
+ }
Scripts/Bash/Functions/Identity/identity_renderPostActions.sh ADDED
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+ #
3
+ # identity_renderPostActions.sh -- This function executes
4
+ # post-rendition actions.
5
+ #
6
+ # Copyright (C) 2009-2011 Alain Reguera Delgado
7
+ #
8
+ # This program is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU General Public License as
10
+ # published by the Free Software Foundation; either version 2 of the
11
+ # License, or (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful, but
14
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
+ # USA.
22
+ #
23
+ # ----------------------------------------------------------------------
24
+ # $Id$
25
+ # ----------------------------------------------------------------------
26
+
27
+ function identity_renderPostActions {
28
+
29
+ local ACTION=''
30
+
31
+ for ACTION in "${POSTACTIONS[@]}"; do
32
+
33
+ case "${ACTION}" in
34
+
35
+ renderSyslinux* )
36
+ identity_renderSyslinux
37
+ ;;
38
+
39
+ renderGrub* )
40
+ identity_renderGrub
41
+ ;;
42
+
43
+ renderFormats:* )
44
+ identity_renderFormats
45
+ ;;
46
+
47
+ groupByType:* )
48
+ identity_renderGroupByType
49
+ ;;
50
+
51
+ renderBrands )
52
+ identity_renderBrands
53
+ ;;
54
+
55
+ esac
56
+
57
+ done
58
+
59
+ }
Scripts/Bash/Functions/Identity/identity_renderSyslinux.sh CHANGED
@@ -26,10 +26,6 @@
26
26
27
27
function identity_renderSyslinux {
28
28
29
- local FILE="$1"
30
- local ACTION="$2"
31
- local OPTIONS=''
32
-
33
29
# Define 16 colors images default file name prefix.
34
30
local PREFIX='-16c'
35
31
@@ -37,7 +33,7 @@ function identity_renderSyslinux {
37
33
# configuration script. These options are applied to pnmremap when
38
34
# doing color reduction, so any option available for pnmremap
39
35
# command can be passed to renderSyslinux functionality.
40
- OPTIONS=$(identity_renderConfigOption "$ACTION" '2-')
36
+ local OPTIONS=$(identity_renderConfigOption "$ACTION" '2-')
41
37
42
38
# Check options passed to action. This is required in order to
43
39
# aviod using options used already in this script. For example