3e74c96 livesys: Modernize shell code, don't require Bash.

Authored and Committed by fgrose 2 years ago
    livesys: Modernize shell code, don't require Bash.
    
    Use $() style command substitutions.
    Do not require the Bash shell.
    Use && || list control over -a -o test operators.
    Remove unused exists() function.
    Collect kernel command line once into a variable, and
      perform more robust parsing.
    Take advantage of losetup -f --show for assignment
      of variables for loop devices.
    Use ${mountopts:+$mountopts} expansion to nothing
      if mountopts is unset or empty in livesys-main.
    Use ${USERADDARGS:+$USERADDARGS} expansion to nothing
      if USERADDARGS is unset in livesys-main.
    Drop the unneeded -n (not zero-length) operator in test
      expressions, and use ! instead of -z (zero-length).
      This results in quicker-to-understand code as it
      more closely represents the variable object instead of
      the testing methodology and its double negatives.
    Clearly demark the run-on-first-boot-only code from
      the rest in livesys-main.
    Move, and comment to keep, the /.liveimg-configured flag
      file at the end of the livesys-main script, so that it
      is not set prematurely in a faulty script invocation.
    Replace touch with : > file syntax.
    Include a switch for rd.live.debug in livesys-main & livesys-late.
    
    Provide a filesystem check/repair function in functions
      and use it on a persistent home.img or home device filesystem.
    
    Also In functions:
    Update the strstr function to a simpler version from dracut.
    Drop the dependency on grep by using shell substring removal.
    Drop the Bash syntax $"..." for string translation for
      portability & security reasons. See
      https://www.gnu.org/software/gettext/manual/html_node/bash.html
    
        
file modified
+75 -29
file modified
+29 -26
file modified
+55 -62