Browse Source

Tidy up variable setting code

 *  Add docstring,
 *  add explanations for local variable names,
 *  separate export declarations,
 *  sort globals alphabetically,
 *  add built part delimiters,
 *  quote paths properly.
Alois Mahdal 9 years ago
parent
commit
1b7d7e32f1
1 changed files with 25 additions and 8 deletions
  1. 25
    8
      src/bin/saturnin.skel

+ 25
- 8
src/bin/saturnin.skel View File

2
 
2
 
3
 . $(ffoom path) || exit 3
3
 . $(ffoom path) || exit 3
4
 
4
 
5
+#
6
+# =====BEGIN BUILT PART=====
7
+#
8
+
5
 mkconfpath() {
9
 mkconfpath() {
6
-    local userd="__SATURNIN_CONFIG_USER__/ini.d"
7
-    local user="__SATURNIN_CONFIG_USER__"
8
-    local lcal="__SATURNIN_CONFIG_LOCAL__"
9
-    local distd="__SATURNIN_SHARE__/ini.d"
10
+    #
11
+    # Assemble list of config paths for FFOO_CONFIG_PATH (path per line)
12
+    #
13
+    local userd     # user'd modular config (~/.xyz/ini.d)
14
+    local user      # user's generic config
15
+    local lcal      # local admin provided config
16
+    local distd     # distribution-provided config (always modular)
17
+    userd="__SATURNIN_CONFIG_USER__/ini.d"
18
+    user="__SATURNIN_CONFIG_USER__"
19
+    lcal="__SATURNIN_CONFIG_LOCAL__"
20
+    distd="__SATURNIN_SHARE__/ini.d"
10
     test -d "$userd" && find -L "$userd" -mindepth 1 -maxdepth 1 -type d
21
     test -d "$userd" && find -L "$userd" -mindepth 1 -maxdepth 1 -type d
11
     echo "$user"
22
     echo "$user"
12
     echo "$lcal"
23
     echo "$lcal"
13
     test -d "$distd" && find -L "$distd" -mindepth 1 -maxdepth 1 -type d
24
     test -d "$distd" && find -L "$distd" -mindepth 1 -maxdepth 1 -type d
14
 }
25
 }
15
 
26
 
16
-export FFOO_PATH="__SATURNIN_FFOO_DIR__"
27
+export FFOO_PATH FFOO_CONFIG_PATH SATURNIN_VERSION SATURNIN_CACHE_HOME
28
+
29
+FFOO_CONFIG_PATH="$(mkconfpath | tr '\n' :)"
30
+FFOO_PATH="__SATURNIN_FFOO_DIR__"
31
+SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
17
 SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
32
 SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
18
-export FFOO_CONFIG_PATH=$(mkconfpath | tr '\n' :)
19
-export SATURNIN_VERSION="__VERSION__"
20
-export SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
33
+SATURNIN_VERSION="__VERSION__"
34
+
35
+#
36
+# =====END BUILT PART=====
37
+#
21
 
38
 
22
 ffoo import config
39
 ffoo import config
23
 ffoo import exits
40
 ffoo import exits