@@ -68,8 +68,12 @@ find the script when you ask to use it.
68
68
Special Task Syntax
69
69
-------------------
70
70
71
- While tasks are generally normal bash scripts, there are a few special bash
72
- functions which are available to you:
71
+ While tasks are generally normal bash scripts, there are a few special syntactic
72
+ elements which are available to you. These are implemented in a rather unique
73
+ way: as Yo loads your script, it reads each line and detects the use of the
74
+ following keywords, somewhat like a macro processor. Most of these keywords also
75
+ have a corresponding bash function that Yo provides to implement the necessary
76
+ functionality.
73
77
74
78
- ``DEPENDS_ON <task name here> `` - this declares that your task depends on
75
79
another one. Yo will search for these lines in your script and automatically
@@ -105,14 +109,46 @@ functions which are available to you:
105
109
ensure that A runs to completion before task ``B `` begins.
106
110
107
111
These functions can be used anywhere in your script, however bash syntax such as
108
- quoting or variable expansion is not respected when Yo locates them. So, while
109
- the following is valid bash, it won't work with Yo:
112
+ quoting or variable expansion is not respected where Yo interprets them. So,
113
+ while the following is valid bash, it won't work with Yo:
110
114
111
115
.. code :: bash
112
116
113
117
TASK=drgn
114
118
DEPENDS_ON $TASK
115
119
120
+
121
+ Other Task Variables and Functions
122
+ ----------------------------------
123
+
124
+ Additionally, Yo's bash task library makes a few conveniences available to you.
125
+ It sources the contents of ``/etc/os-release `` so that you can use common
126
+ variables from this file, such as ``$NAME ``, ``$VERSION_ID ``, etc. In addition,
127
+ Yo provides the following variables:
128
+
129
+ - ``$ORAVER `` - an integer representing the current Oracle Linux release. The
130
+ variable is undefined if not running on Oracle Linux. You can detect when
131
+ Oracle Linux is running by matching the ``NAME `` variable against ``Oracle* ``
132
+
133
+ - ``$UBUVER `` - an integer representing the Ubuntu version (e.g. for 24.10, this
134
+ would be "24"). If you would like the full version (e.g. to distinguish 24.04
135
+ and 24.10), use the ``$VERSION_ID `` field directly.
136
+
137
+ - ``$FEDVER `` - an integer representing the Fedora version
138
+
139
+ - ``$DEBVER `` - an integer representing the Debian version
140
+
141
+ - ``$PKGMGR `` - the name of the system package manager (only detected for the
142
+ above operating systems)
143
+
144
+ And below are the simple bash functions (not interpreted by Yo) provided in the
145
+ task library:
146
+
147
+ - ``PKG_INSTALL [package [...]] `` install one or more packages. This relies on
148
+ the detected ``$PKGMGR `` from above, and ensures that the correct options are
149
+ used for the specific package manager, especially to avoid interactive
150
+ confirmation.
151
+
116
152
Managing Tasks
117
153
--------------
118
154
0 commit comments