(command.CommandList
  children: [
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} 
                      {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<id>} {<-u>}))} {<-ne>} {<0>} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} 
              {(DQ <'###########################################################################'>)}
            )
            (C {<echo>} {(DQ <'Installer must be run as root.'>)})
            (C {<echo>} {(DQ <'Try \'sudo bash '> ($ Id.VSub_Number '$0') <'\''>)})
            (C {<echo>} 
              {(DQ <'###########################################################################'>)}
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [20 37]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-f>} {<'/etc/fs_read_only_config'>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Preparing os for read only mode was done before. Nothing to do.'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [77 88]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:INSTALL_HALT)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [127]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SYS_TYPES)
          op: assign_op.Equal
          rhs: 
            {
              (sh_array_literal
                left: <Id.Op_LParen _>
                words: [
                  {<Pi> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <3> 
                    (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <'/'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <Pi> 
                    (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <Zero> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <W>
                  }
                  {<All> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <other> 
                    (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) <models>
                  }
                ]
              )
            }
          spids: [130]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:WATCHDOG_MODULES)
          op: assign_op.Equal
          rhs: 
            {
              (sh_array_literal
                left: <Id.Op_LParen _>
                words: [{<bcm2835_wdt>} {<bcm2835_wdog>} {<bcm2708_wdt>} {<bcm2708_wdog>}]
              )
            }
          spids: [151]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:OPTION_NAMES)
          op: assign_op.Equal
          rhs: {(sh_array_literal left:<Id.Op_LParen _> words:[{<NO>} {<YES>}])}
          spids: [162]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:INSTALL_WATCHDOG)
          op: assign_op.Equal
          rhs: {<1>}
          spids: [170]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:WD_TARGET)
          op: assign_op.Equal
          rhs: {<1>}
          spids: [173]
        )
      ]
    )
    (command.ShFunction
      name: replace
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<grep>} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-eq>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<sed>}
                        {<-i>}
                        {(DQ <'s/'> ($ Id.VSub_Number '$2') <'/'> ($ Id.VSub_Number '$3') <'/g'>)}
                        {($ Id.VSub_Number '$1')}
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/dev/null'>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  spids: [211 224]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: replaceAppend
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<grep>} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-eq>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<sed>}
                        {<-i>}
                        {(DQ <'s/'> ($ Id.VSub_Number '$2') <'/'> ($ Id.VSub_Number '$3') <'/g'>)}
                        {($ Id.VSub_Number '$1')}
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/dev/null'>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  spids: [277 290]
                )
              ]
              else_action: [
                (command.Pipeline
                  children: [
                    (C {<echo>} {($ Id.VSub_Number '$3')})
                    (command.Simple
                      words: [{<sudo>} {<tee>} {<-a>} {($ Id.VSub_Number '$1')}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/dev/null'>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  negated: F
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: append1
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<grep>} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-ne>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Pipeline
                      children: [
                        (C {<echo>} {($ Id.VSub_Number '$3')})
                        (command.Simple
                          words: [{<sudo>} {<tee>} {<-a>} {($ Id.VSub_Number '$1')}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'/dev/null'>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: F
                    )
                  ]
                  spids: [368 381]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: append2
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<grep>} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1')}]
              redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})]
              do_fork: T
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-ne>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (command.Simple
                      words: [
                        {<sed>}
                        {<-i>}
                        {
                          (DQ <'s/'> <Id.Lit_BadBackslash '\\'> <'\'/ '> ($ Id.VSub_Number '$3') <'/g'>)
                        }
                        {($ Id.VSub_Number '$1')}
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/dev/null'>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  spids: [437 450]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: mark_script_run
      body: (BraceGroup children:[(C {<touch>} {<'/etc/fs_read_only_config'>})])
    )
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<echo>} {(DQ <'Starting installation...'>)})
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<systemctl>} {<disable>} {<systemd-rfkill.service>})
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<echo>} {(DQ <'Removing unwanted packages...'>)})
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<apt-get>} {<remove>} {<-y>} {<--force-yes>} {<--purge>} {<dphys-swapfile>} {<fake-hwclock>})
    (C {<apt-get>} {<-y>} {<--force-yes>} {<autoremove>} {<--purge>})
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<echo>} {(DQ <'Configuring system...'>)})
    (C {<echo>} {(DQ <--------------------------------------------------------------------------->)})
    (C {<sed>} {<-i>} {(DQ <'s/#Storage=auto/Storage=volatile/'>)} {<'/etc/systemd/journald.conf'>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$INSTALL_WATCHDOG')} {<-ne>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<apt-get>} {<install>} {<-y>} {<--force-yes>} {<watchdog>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:MODULE)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name WATCHDOG_MODULES>
                        bracket_op: 
                          (bracket_op.ArrayIndex
                            expr: 
                              (arith_expr.Binary
                                op_id: Id.Arith_Minus
                                left: {($ Id.VSub_DollarName '$WD_TARGET')}
                                right: {<Id.Lit_Digits 1>}
                              )
                          )
                      )
                    }
                  spids: [644]
                )
              ]
            )
            (C {<append1>} {<'/etc/modules'>} {($ Id.VSub_DollarName '$MODULE')} 
              {($ Id.VSub_DollarName '$MODULE')}
            )
            (C {<replace>} {<'/etc/watchdog.conf'>} {(DQ <'#watchdog-device'>)} {(DQ <watchdog-device>)})
            (C {<replace>} {<'/etc/watchdog.conf'>} {(DQ <'#max-load-1'>)} {(DQ <max-load-1>)})
            (C {<apt-get>} {<install>} {<-y>} {<--force-yes>} {<insserv>})
            (C {<insserv>} {<watchdog>})
            (C {<append1>} {<'/lib/systemd/system/watchdog.service'>} {(DQ <WantedBy>)} 
              {(DQ <'WantedBy=multi-user.target'>)}
            )
            (C {<systemctl>} {<enable>} {<watchdog>})
            (C {<replaceAppend>} {<'/etc/sysctl.conf'>} {(DQ <'^.*kernel.panic.*'> <Id.Lit_Dollar '$'>)} 
              {(DQ <'kernel.panic = 10'>)}
            )
          ]
          spids: [613 626]
        )
      ]
    )
    (C {<append2>} {<'/boot/cmdline.txt'>} {<fastboot>} {<fastboot>})
    (C {<append2>} {<'/boot/cmdline.txt'>} {<noswap>} {<noswap>})
    (C {<append2>} {<'/boot/cmdline.txt'>} {<ro> <Id.Lit_Other '^'> <o> <Id.Lit_Other '^'> <t>} {<ro>})
    (C {<rm>} {<-rf>} {<'/var/spool'>})
    (C {<ln>} {<-s>} {<'/tmp'>} {<'/var/spool'>})
    (C {<touch>} {<'/tmp/openauto.ini'>})
    (C {<ln>} {<-s>} {<'/tmp/openauto.ini'>} {<'/home/pi/openauto.ini'>})
    (C {<chown>} {<pi> <Id.Lit_Colon ':'> <pi>} {<'/home/pi/openauto.ini'>})
    (C {<mkdir>} {<-p>} {<'/tmp/.config'>})
    (C {<mkdir>} {<-p>} {<'/tmp/.local'>})
    (C {<ln>} {<-s>} {<'/tmp/.config'>} {<'/home/pi/'>})
    (C {<ln>} {<-s>} {<'/tmp/.local'>} {<'/home/pi/'>})
    (C {<apt>} {<clean>})
    (C {<rm>} {<-rf>} {<'/var/cache/apt/'>})
    (C {<replace>} {<'/usr/lib/tmpfiles.d/var.conf'>} 
      {(DQ <spool> <Id.Lit_BadBackslash '\\'> <'s*0755'>)} {(DQ <'spool 1777'>)}
    )
    (C {<touch>} {<'/tmp/dhcpcd.resolv.conf'>})
    (command.Simple
      words: [{<echo>} {(DQ <'nameserver 8.8.8.8'>)}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {<'/tmp/dhcpcd.resolv.conf'>}
        )
      ]
      do_fork: T
    )
    (command.Simple
      words: [{<echo>} {(DQ <'nameserver 8.8.4.4'>)}]
      redirects: [
        (redir
          op: <Id.Redir_DGreat '>>'>
          loc: (redir_loc.Fd fd:1)
          arg: {<'/tmp/dhcpcd.resolv.conf'>}
        )
      ]
      do_fork: T
    )
    (C {<rm>} {<'/etc/resolv.conf'>})
    (C {<ln>} {<-s>} {<'/tmp/dhcpcd.resolv.conf'>} {<'/etc/resolv.conf'>})
    (C {<replace>} {<'/etc/fstab'>} 
      {(DQ <vfat> <Id.Lit_BadBackslash '\\'> <'s*defaults'> <Id.Lit_BadBackslash '\\'> <s>)} {(DQ <'vfat    defaults,ro '>)}
    )
    (C {<replace>} {<'/etc/fstab'>} 
      {(DQ <ext4> <Id.Lit_BadBackslash '\\'> <'s*defaults,noatime'> <Id.Lit_BadBackslash '\\'> <s>)} {(DQ <'ext4    defaults,noatime,ro '>)}
    )
    (C {<append1>} {<'/etc/fstab'>} {(DQ <'/var/log'>)} {(DQ <'tmpfs /var/log tmpfs nodev,nosuid 0 0'>)})
    (C {<append1>} {<'/etc/fstab'>} {(DQ <'/var/tmp'>)} {(DQ <'tmpfs /var/tmp tmpfs nodev,nosuid 0 0'>)})
    (C {<append1>} {<'/etc/fstab'>} {(DQ <Id.Lit_BadBackslash '\\'> <'s/tmp'>)} 
      {(DQ <'tmpfs /tmp    tmpfs nodev,nosuid 0 0'>)}
    )
    (C {<mark_script_run>})
    (C {<sync>})
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)