| | 218 | ############################################################################### |
|---|
| | 219 | # get_lsb_required_value() - Additional function to simplify repetitive tasks # |
|---|
| | 220 | # Obtains the LSB Value of $1 for index of script # |
|---|
| | 221 | # ($2) and immediately converts LSB defined # |
|---|
| | 222 | # facilities (beginning with a '$' character) to a # |
|---|
| | 223 | # script name. If the script is not found, then # |
|---|
| | 224 | # the function exits with an error as per # |
|---|
| | 225 | # convert_lsb_required. # |
|---|
| | 226 | ############################################################################### |
|---|
| | 227 | get_lsb_required_value() |
|---|
| | 228 | { |
|---|
| | 229 | local reqval |
|---|
| | 230 | # Probably need some error checking in here |
|---|
| | 231 | reqval=`echo "${fullheaders[${2}]}" | \ |
|---|
| | 232 | grep "^# ${1}" | \ |
|---|
| | 233 | sed -e "s@# ${1}:@@" \ |
|---|
| | 234 | -e "s/^[ \t]*//"` |
|---|
| | 235 | |
|---|
| | 236 | # If $reqval contains a '$' charcter, then convert it to a script name |
|---|
| | 237 | echo "${reqval}" | grep "\\$" 2>&1 > /dev/null |
|---|
| | 238 | if test "${?}" -eq "0" |
|---|
| | 239 | then |
|---|
| | 240 | reqval=`convert_lsb_required "${reqval}"` |
|---|
| | 241 | fi |
|---|
| | 242 | echo "${reqval}" |
|---|
| | 243 | } |
|---|
| | 244 | |
|---|
| | 245 | ############################################################################### |
|---|
| | 246 | # get_lsb_should_value() - Additional function to simplify repetitive tasks # |
|---|
| | 247 | # Obtains the LSB Value of $1 for index of script # |
|---|
| | 248 | # ($2) and immediately converts LSB defined # |
|---|
| | 249 | # facilities (beginning with a '$' character) to a # |
|---|
| | 250 | # script name. If the script is not found, the # |
|---|
| | 251 | # value is removed from the list as it is optional. # |
|---|
| | 252 | ############################################################################### |
|---|
| | 253 | get_lsb_should_value() |
|---|
| | 254 | { |
|---|
| | 255 | local optval |
|---|
| | 256 | local listitem |
|---|
| | 257 | local optitem |
|---|
| | 258 | # Probably need some error checking in here |
|---|
| | 259 | optval=`echo "${fullheaders[${2}]}" | \ |
|---|
| | 260 | grep "^# ${1}" | \ |
|---|
| | 261 | sed -e "s@# ${1}:@@" \ |
|---|
| | 262 | -e "s/^[ \t]*//"` |
|---|
| | 263 | |
|---|
| | 264 | # If $optval contains a '$' charcter, then convert it to a script name |
|---|
| | 265 | echo "${optval}" | grep "\\$" 2>&1 > /dev/null |
|---|
| | 266 | if test "${?}" -eq "0" |
|---|
| | 267 | then |
|---|
| | 268 | optval=`convert_lsb_should "${optval}"` |
|---|
| | 269 | # if we still have a "$" character, then it's not found and it should |
|---|
| | 270 | # be removed from the list (and it's trailing space if one exists) |
|---|
| | 271 | # since it is optional |
|---|
| | 272 | echo "${optval}" | grep "\\$" 2>&1 > /dev/null |
|---|
| | 273 | if test "${?}" -eq "0" |
|---|
| | 274 | then |
|---|
| | 275 | # Remove the value |
|---|
| | 276 | for listitem in ${optval} |
|---|
| | 277 | do |
|---|
| | 278 | echo "${listitem}" | grep "\\$" |
|---|
| | 279 | if test "${?}" -eq "0" |
|---|
| | 280 | then |
|---|
| | 281 | optval=`echo "${optval}" | sed -e 's@${listitem} @@' \ |
|---|
| | 282 | -e 's@${listitem}@@' | \ |
|---|
| | 283 | sed -e "s@# ${1}:@@" \ |
|---|
| | 284 | -e "s/^[ \t]*//"` |
|---|
| | 285 | fi |
|---|
| | 286 | done |
|---|
| | 287 | fi |
|---|
| | 288 | fi |
|---|
| | 289 | # If a should start value does not have a script associted with it, then |
|---|
| | 290 | # remove it (or it and trailing space) from the list |
|---|
| | 291 | for optitem in ${otpval} |
|---|
| | 292 | do |
|---|
| | 293 | grep "${optitem}" "${statedir}/enabled-scripts" 2>&1 > /dev/null |
|---|
| | 294 | if test "${?}" -ne "0" |
|---|
| | 295 | then |
|---|
| | 296 | optval=`echo "${optval}" | sed -e 's@${otpitem} @@' \ |
|---|
| | 297 | -e 's@${optitem}@@' | \ |
|---|
| | 298 | sed -e "s@# ${1}:@@" \ |
|---|
| | 299 | -e "s/^[ \t]*//"` |
|---|
| | 300 | fi |
|---|
| | 301 | done |
|---|
| | 302 | |
|---|
| | 303 | echo "${optval}" |
|---|
| | 304 | } |
|---|
| | 305 | |
|---|