(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:IMAGE_FILE)
          op: assign_op.Equal
          rhs: {<raspbian-stretch-lite.zip>}
          spids: [14]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TODAY_EXT)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [(C {<date>} {<Id.Lit_Other '+'> (DQ <'%Y-%m-%d-%H-%M'>)})]
                  )
              )
            }
          spids: [17]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BUILD_ID)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                command_list: 
                  (command.CommandList
                    children: [
                      (C {<hexdump>} {<-n>} {<4>} {<-e>} {(SQ <'4/4 "%X" 1 "\\n"'>)} {</dev/random>})
                    ]
                  )
              )
            }
          spids: [27]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:IMAGE_FILE_CUSTOMIZED)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name IMAGE>
                suffix_op: 
                  (suffix_op.Unary
                    op_id: Id.VTest_ColonHyphen
                    arg_word: 
                      {
                        (DQ <crankshaft-> (${ Id.VSub_Name TODAY_EXT) <-> (${ Id.VSub_Name BUILD_ID) 
                          <.img>
                        )
                      }
                  )
              )
            }
          spids: [44]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:IMAGE_URL)
          op: assign_op.Equal
          rhs: {<https> <Id.Lit_Other ':'> <//downloads.raspberrypi.org/raspbian_lite_latest>}
          spids: [61]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:TEMP_CHROOT_DIR)
          op: assign_op.Equal
          rhs: {</mnt/raspbian-temp>}
          spids: [66]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:DROP_IN)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name DROP_IN>
                suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{<0>})
              )
            }
          spids: [69]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:CUSTOM_SCRIPT)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name CUSTOM_SCRIPT>
                suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:{(DQ )})
              )
            }
          spids: [76]
        )
      ]
    )
    (C {<clear>})
    (C {<echo>} {(DQ <'###########################################################################'>)})
    (C {<echo>} {(DQ )})
    (C {<echo>} {(DQ <'                  Welcome to the Crankshaft build script!'>)})
    (C {<echo>} {(DQ )})
    (C {<echo>} {(DQ <'###########################################################################'>)})
    (command.ShFunction
      name: bail_and_cleanup
      body: (command.BraceGroup children:[(C {<kpartx>} {<-d>} {($ Id.VSub_Number '$1')})])
    )
    (command.ShFunction
      name: check_command_ok
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<Id.Lit_LBracket '['>} {<-x>} 
                              {
                                (DQ 
                                  (command_sub
                                    left_token: <Id.Left_DollarParen '$('>
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {<command>} {<-v>} {($ Id.VSub_Number '$1')})]
                                      )
                                  )
                                )
                              } {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ )})
                    (command.Simple
                      words: [
                        {<echo>}
                        {
                          (DQ <'Error: '> ($ Id.VSub_Number '$1') 
                            <' is not installed. Please install it.'>
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})]
                    )
                    (C {<echo>} {(DQ )})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [153 174]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_root
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$EUID'))} {<-ne>} {<0>} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ )})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
"Please run this script as using sudo/as root, otherwise it can't continue. "
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ )})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Exit exit>)
                  ]
                  spids: [236 251]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_dependencies
      body: 
        (command.BraceGroup
          children: [
            (C {<check_command_ok>} {<kpartx>})
            (C {<check_command_ok>} {<qemu-arm-static>})
            (C {<check_command_ok>} {<chroot>})
            (C {<check_command_ok>} {<pv>})
            (C {<check_command_ok>} {<zipinfo>})
            (C {<check_command_ok>} {<zerofree>})
          ]
        )
    )
    (command.ShFunction
      name: get_unzip_image
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {<-f>} {(${ Id.VSub_Name IMAGE_FILE)} 
                          {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:remotesize)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_Backtick '`'>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.Pipeline
                                        children: [
                                          (command.Simple
                                            words: [
                                              {<wget>}
                                              {<https> <Id.Lit_Other ':'> 
                                                <//downloads.raspberrypi.org/raspbian_lite_latest>
                                              }
                                              {<--spider>}
                                              {<--server-response>}
                                              {<-O>}
                                              {<->}
                                            ]
                                            redirects: [
                                              (redir.Redir
                                                op: <Id.Redir_GreatAnd '2>&'>
                                                fd: 2
                                                arg_word: {<1>}
                                              )
                                            ]
                                          )
                                          (C {<sed>} {<-ne>} {(SQ <'/Content-Length/{s/.*: //;p}'>)})
                                        ]
                                        negated: F
                                      )
                                    ]
                                  )
                              )
                            }
                          spids: [370]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:localsize)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (command_sub
                                left_token: <Id.Left_Backtick '`'>
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.Pipeline
                                        children: [
                                          (C {<wc>} {<-c>} {(${ Id.VSub_Name IMAGE_FILE)})
                                          (C {<awk>} {(SQ <'{print $1}'>)})
                                        ]
                                        negated: F
                                      )
                                    ]
                                  )
                              )
                            }
                          spids: [403]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {<Id.Lit_LBracket '['>} 
                                  {
                                    (braced_var_sub
                                      token: <Id.VSub_Name remotesize>
                                      prefix_op: (Id.VSub_Pound)
                                    )
                                  } {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} 
                                  {
                                    (braced_var_sub
                                      token: <Id.VSub_Name localsize>
                                      prefix_op: (Id.VSub_Pound)
                                    )
                                  } {<Id.Lit_RBracket ']'>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:remotesize)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (command_sub
                                        left_token: <Id.Left_Backtick '`'>
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (command.Pipeline
                                                children: [
                                                  (command.Simple
                                                    words: [
                                                      {<wget>}
                                                      {<https> <Id.Lit_Other ':'> 
                                                        <
//downloads.raspberrypi.org/raspbian_lite_latest
                                                        >
                                                      }
                                                      {<--spider>}
                                                      {<--server-response>}
                                                      {<-O>}
                                                      {<->}
                                                    ]
                                                    redirects: [
                                                      (redir.Redir
                                                        op: <Id.Redir_GreatAnd '2>&'>
                                                        fd: 2
                                                        arg_word: {<1>}
                                                      )
                                                    ]
                                                  )
                                                  (C {<sed>} {<-ne>} 
                                                    {(SQ <'/Content-Length/{s/.*: //;p}'>)}
                                                  )
                                                ]
                                                negated: F
                                              )
                                            ]
                                          )
                                      )
                                    }
                                  spids: [452]
                                )
                              ]
                            )
                          ]
                          spids: [429 449]
                        )
                      ]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$remotesize'))} 
                                  {<Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$localsize'))} {<Id.Lit_RBracket ']'>}
                                )
                              terminator: <Id.Op_Semi _>
                            )
                          ]
                          action: [
                            (C {<echo>} 
                              {
                                (DQ 
                                  <
---------------------------------------------------------------------------
                                  >
                                )
                              }
                            )
                            (C {<echo>} 
                              {
                                (DQ <'Image file '> (${ Id.VSub_Name IMAGE_FILE) 
                                  <' is already the same, skipping download.'>
                                )
                              }
                            )
                            (C {<echo>} {(DQ <'It will be re-downloaded if remote file has changed.'>)})
                            (C {<echo>} 
                              {
                                (DQ 
                                  <
---------------------------------------------------------------------------
                                  >
                                )
                              }
                            )
                          ]
                          spids: [489 506]
                        )
                      ]
                      else_action: [
                        (C {<echo>} 
                          {
                            (DQ 
                              <
---------------------------------------------------------------------------
                              >
                            )
                          }
                        )
                        (C {<echo>} {(DQ <'Downloading new version of raspbian image from server...'>)})
                        (C {<wget>} {<-q>} {<--show-progress>} {<-O> (${ Id.VSub_Name IMAGE_FILE)} 
                          {(${ Id.VSub_Name IMAGE_URL)}
                        )
                        (C {<echo>} 
                          {
                            (DQ 
                              <
---------------------------------------------------------------------------
                              >
                            )
                          }
                        )
                      ]
                    )
                  ]
                  spids: [350 363]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {(DQ <--------------------------------------------------------------------------->)}
                )
                (C {<echo>} {(DQ <'Downloading raspbian image from server...'>)})
                (C {<wget>} {<-q>} {<--show-progress>} {<-O> (${ Id.VSub_Name IMAGE_FILE)} 
                  {(${ Id.VSub_Name IMAGE_URL)}
                )
                (C {<echo>} 
                  {(DQ <--------------------------------------------------------------------------->)}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMAGE_FILE_UNZIPPED)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        command_list: 
                          (command.CommandList
                            children: [(C {<zipinfo>} {<-1>} {(${ Id.VSub_Name IMAGE_FILE)})]
                          )
                      )
                    }
                  spids: [632]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMAGE_FILE_UNZIPPED_SIZE)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {<zipinfo>} {<-l>} {(${ Id.VSub_Name IMAGE_FILE)})
                                  (C {<tail>} {<-1>})
                                  (C {<xargs>})
                                  (C {<cut>} {<-d> (SQ <' '>)} {<-f3>})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [646]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(${ Id.VSub_Name IMAGE_FILE_UNZIPPED)} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'Unpacking raspbian image...'>)})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (command.Pipeline
                      children: [
                        (C {<unzip>} {<-o>} {<-p>} {(${ Id.VSub_Name IMAGE_FILE)})
                        (command.Simple
                          words: [
                            {<pv>}
                            {<-p>}
                            {<-s>}
                            {(${ Id.VSub_Name IMAGE_FILE_UNZIPPED_SIZE)}
                            {<-w>}
                            {<80>}
                          ]
                          redirects: [
                            (redir.Redir
                              op: <Id.Redir_Great '>'>
                              fd: -1
                              arg_word: {(${ Id.VSub_Name IMAGE_FILE_UNZIPPED)}
                            )
                          ]
                        )
                      ]
                      negated: F
                    )
                  ]
                  spids: [682 697]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<Id.Lit_LBracket '['>} {<-f>} {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'Copying a big file...'>)})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<cp>} {(${ Id.VSub_Name IMAGE_FILE_UNZIPPED)} 
                      {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)}
                    )
                  ]
                  spids: [758 773]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {(DQ <--------------------------------------------------------------------------->)}
                )
                (C {<echo>} 
                  {
                    (DQ <'Skipping creation of '> (${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED) 
                      <", it's already there. To re-create, delete it.">
                    )
                  }
                )
                (C {<echo>} 
                  {(DQ <--------------------------------------------------------------------------->)}
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: resize_raw_image
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMAGE_SIZE_RAW)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Simple
                                words: [{<wc>} {<-c>}]
                                redirects: [
                                  (redir.Redir
                                    op: <Id.Redir_Less '<'>
                                    fd: -1
                                    arg_word: {(DQ (${ Id.VSub_Name IMAGE_FILE_UNZIPPED))}
                                  )
                                ]
                              )
                            ]
                          )
                      )
                    }
                  spids: [848]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMAGE_SIZE_ACTUAL)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Simple
                                words: [{<wc>} {<-c>}]
                                redirects: [
                                  (redir.Redir
                                    op: <Id.Redir_Less '<'>
                                    fd: -1
                                    arg_word: {(DQ (${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED))}
                                  )
                                ]
                              )
                            ]
                          )
                      )
                    }
                  spids: [864]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:IMAGE_ROOTPART_START)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {<parted>} {(${ Id.VSub_Name IMAGE_FILE_UNZIPPED)} {<unit>} {<s>} 
                                    {<print>} {<-sm>}
                                  )
                                  (C {<tail>} {<-1>})
                                  (C {<cut>} {<-d> <Id.Lit_Other ':'>} {<-f2>})
                                  (C {<sed>} {(SQ <s/s//>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [880]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name IMAGE_SIZE_ACTUAL)} {<-gt>} 
                          {(${ Id.VSub_Name IMAGE_SIZE_RAW)} {<Id.Lit_RBracket ']'>}
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'Image seems already resized, or something is wrong.'>)})
                    (C {<echo>} 
                      {(DQ <"If the image doesn't work, try removing the .img and try again.">)}
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (command.ControlFlow token:<Id.ControlFlow_Return return>)
                  ]
                  spids: [921 938]
                )
              ]
            )
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Resizing image...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (command.Simple
              words: [
                {<dd>}
                {<Id.Lit_VarLike 'if='> </dev/zero>}
                {<Id.Lit_VarLike 'bs='> <1M>}
                {<Id.Lit_VarLike 'count='> <512>}
              ]
              redirects: [
                (redir.Redir
                  op: <Id.Redir_DGreat '>>'>
                  fd: -1
                  arg_word: {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:PART_NUM)
                  op: assign_op.Equal
                  rhs: {<2>}
                  spids: [1020]
                )
              ]
            )
            (command.Simple
              words: [{<fdisk>} {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)}]
              redirects: [
                (redir.HereDoc
                  op: <Id.Redir_DLess '<<'>
                  fd: -1
                  here_begin: {<EOF>}
                  here_end_span_id: 1048
                  stdin_parts: [
                    <'p\n'>
                    <'d\n'>
                    ($ Id.VSub_DollarName '$PART_NUM')
                    <'\n'>
                    <'n\n'>
                    <'p\n'>
                    ($ Id.VSub_DollarName '$PART_NUM')
                    <'\n'>
                    ($ Id.VSub_DollarName '$IMAGE_ROOTPART_START')
                    <'\n'>
                    <'\n'>
                    <'p\n'>
                    <'w\n'>
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: set_up_loopdevs
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {<kpartx>} {<-v>} {<-a>} {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)})
                (C {<tee>} {</tmp/kpartx-output.txt>})
              ]
              negated: F
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:LOOPPARTSID)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {<cat>} {</tmp/kpartx-output.txt>})
                                  (C {<head>} {<-n1>})
                                  (C {<sed>} {(SQ <'s/add map //'>)})
                                  (C {<cut>} {<-f1>} {<-d> (SQ <' '>)})
                                  (C {<sed>} {(SQ <'s/p1$//'>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [1081]
                )
              ]
            )
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'The loop device is '> (${ Id.VSub_Name LOOPPARTSID))})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<sync>})
            (C {<sleep>} {<2>})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<Id.Lit_LBracket '['>} {<-L>} 
                              {</dev/mapper/> (${ Id.VSub_Name LOOPPARTSID) <p1>} {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'                                                                           '
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ <"Couldn't find the loopdev partitions at /dev/mapper/"> 
                          (${ Id.VSub_Name LOOPPARTSID) <'p1!'>
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'                                                                           '
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<bail_and_cleanup>} {</dev/> (${ Id.VSub_Name LOOPPARTSID)} 
                      {(${ Id.VSub_Name IMAGE_FILE_CUSTOMIZED)}
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [1166 1183]
                )
              ]
            )
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} 
              {
                (DQ <'Found the loopdev partitions at /dev/mapper/'> (${ Id.VSub_Name LOOPPARTSID) 
                  <'!'>
                )
              }
            )
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:LOOPDEVPARTS)
                  op: assign_op.Equal
                  rhs: {</dev/mapper/> (${ Id.VSub_Name LOOPPARTSID)}
                  spids: [1271]
                )
              ]
            )
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Check rootfs before resize...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<e2fsck>} {<-f>} {(${ Id.VSub_Name LOOPDEVPARTS) <p2>})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Resize rootfs...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<resize2fs>} {<-p>} {(${ Id.VSub_Name LOOPDEVPARTS) <p2>})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Check rootfs afer resize...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<e2fsck>} {<-f>} {(${ Id.VSub_Name LOOPDEVPARTS) <p2>})
            (C {<mount_chroot_dirs>} {(${ Id.VSub_Name LOOPDEVPARTS)} {(${ Id.VSub_Name LOOPPARTSID)})
            (C {<sed>} {<-i>} {(SQ <'s/^/#CHROOT /g'>)} 
              {(${ Id.VSub_Name TEMP_CHROOT_DIR) </etc/ld.so.preload>}
            )
            (C {<cp>} 
              {
                (command_sub
                  left_token: <Id.Left_Backtick '`'>
                  command_list: (command.CommandList children:[(C {<which>} {<qemu-arm-static>})])
                )
              } {(${ Id.VSub_Name TEMP_CHROOT_DIR) </usr/bin/>}
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_ne
                              left: {(${ Id.VSub_Name DROP_IN)}
                              right: {<0>}
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {<-e>} {(DQ <'Dropping you in the chroot shell.'>)})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<chroot>} {(${ Id.VSub_Name TEMP_CHROOT_DIR)} {</bin/bash>})
                  ]
                  spids: [1427 1442]
                )
              ]
              else_action: [
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.Unary
                                  op_id: Id.BoolUnary_n
                                  child: {(DQ (${ Id.VSub_Name CUSTOM_SCRIPT))}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                      action: [(C {<eval>} {(${ Id.VSub_Name CUSTOM_SCRIPT)})]
                      spids: [1484 1499]
                    )
                  ]
                  else_action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'Unpacking qt5 libraries...'>)})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (command.Pipeline
                      children: [
                        (C {<pv>} {<-p>} {<-w>} {<80>} {<prebuilt/libQt5_OpenGLES2.tar.xz>})
                        (C {<tar>} {<-xf>} {<->} {<-C>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </>})
                      ]
                      negated: F
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<echo>} {(DQ <'Copy crankshaft files to root...'>)})
                    (C {<echo>} 
                      {
                        (DQ 
                          <
---------------------------------------------------------------------------
                          >
                        )
                      }
                    )
                    (C {<cp>} {<-a>} {<crankshaft/.>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </root/>})
                    (C {<sync>})
                    (C {<sleep>} {<1>})
                    (C {<chroot>} {(${ Id.VSub_Name TEMP_CHROOT_DIR)} {</bin/bash>} 
                      {</root/scripts/customize-image-pi.sh>}
                    )
                    (C {<chroot>} {(${ Id.VSub_Name TEMP_CHROOT_DIR)} {</bin/bash>} 
                      {</root/scripts/read-only-fs.sh>}
                    )
                  ]
                )
              ]
            )
            (C {<sed>} {<-i>} {(SQ <'s/^#CHROOT //g'>)} 
              {(${ Id.VSub_Name TEMP_CHROOT_DIR) </etc/ld.so.preload>}
            )
            (C {<umount_chroot_dirs>})
            (C {<zerofree>} {(${ Id.VSub_Name LOOPDEVPARTS) <p2>})
            (C {<umount_loop_dev>} {</dev/> (${ Id.VSub_Name LOOPPARTSID)})
            (C {<echo>} 
              {(DQ <'###########################################################################'>)}
            )
            (C {<echo>} 
              {(DQ <'                                                                           '>)}
            )
            (C {<echo>} {(DQ <'If you reach here, it means the image is ready. :)'>)})
            (C {<echo>} 
              {(DQ <'                                                                           '>)}
            )
            (C {<echo>} 
              {(DQ <'###########################################################################'>)}
            )
          ]
        )
    )
    (command.ShFunction
      name: mount_chroot_dirs
      body: 
        (command.BraceGroup
          children: [
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Mounting CHROOT directories'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<mkdir>} {<-p>} {(${ Id.VSub_Name TEMP_CHROOT_DIR)})
            (C {<mount>} {<-o>} {<rw>} {(${ Id.VSub_Number 1) <p2>} {(${ Id.VSub_Name TEMP_CHROOT_DIR)})
            (C {<mount>} {<-o>} {<rw>} {(${ Id.VSub_Number 1) <p1>} 
              {(${ Id.VSub_Name TEMP_CHROOT_DIR) </boot>}
            )
            (C {<mount>} {<--bind>} {</dev>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </dev/>})
            (C {<mount>} {<--bind>} {</sys>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </sys/>})
            (C {<mount>} {<--bind>} {</proc>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </proc/>})
            (C {<mount>} {<--bind>} {</dev/pts>} {(${ Id.VSub_Name TEMP_CHROOT_DIR) </dev/pts>})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {<Id.Lit_LBracket '['>} {<-f>} 
                              {(${ Id.VSub_Name TEMP_CHROOT_DIR) </etc/ld.so.preload>} {<Id.Lit_RBracket ']'>}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'                                                                           '
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ <"I didn't see "> (${ Id.VSub_Name TEMP_CHROOT_DIR) 
                          <'/etc/ folder. Bailing!'>
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'                                                                           '
                          >
                        )
                      }
                    )
                    (C {<echo>} 
                      {
                        (DQ 
                          <
'###########################################################################'
                          >
                        )
                      }
                    )
                    (C {<umount_chroot_dirs>})
                    (C {<umount_loop_dev>} {($ Id.VSub_Number '$2')})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Exit exit>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [1863 1879]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: umount_chroot_dirs
      body: 
        (command.BraceGroup
          children: [
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Unmount chroot dirs...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<sync>})
            (C {<umount>} 
              (word.BracedTree
                parts: [
                  (${ Id.VSub_Name TEMP_CHROOT_DIR)
                  </>
                  (word_part.BracedTuple
                    words: [{<dev/pts>} {<dev>} {<sys>} {<Id.KW_Proc proc>} {<boot>} {}]
                  )
                ]
              )
            )
          ]
        )
    )
    (command.ShFunction
      name: umount_loop_dev
      body: 
        (command.BraceGroup
          children: [
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (C {<echo>} {(DQ <'Unmount loop devices...'>)})
            (C {<echo>} 
              {(DQ <--------------------------------------------------------------------------->)}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:loopdev)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_Backtick '`'>
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {<echo>} {($ Id.VSub_Number '$1')})
                                  (C {<cut>} {<-d> (DQ </>)} {<-f3>})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [2021]
                )
              ]
            )
            (C {<dmsetup>} {<remove>} {<-f>} {($ Id.VSub_DollarName '$loopdev') (DQ <p1>)})
            (C {<dmsetup>} {<remove>} {<-f>} {($ Id.VSub_DollarName '$loopdev') (DQ <p2>)})
            (C {<kpartx>} {<-d>} {($ Id.VSub_Number '$1')})
          ]
        )
    )
    (C {<check_dependencies>})
    (C {<check_root>})
    (C {<get_unzip_image>})
    (C {<resize_raw_image>})
    (C {<set_up_loopdevs>})
  ]
)