(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:IMAGE_FILE spids:[22])
          op: Equal
          rhs: {(raspbian-stretch-lite.zip)}
          spids: [22]
        )
      ]
      spids: [22]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:TODAY_EXT spids:[25])
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [(C {(date)} {(Lit_Other '+') (DQ ('%Y-%m-%d-%H-%M'))})]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [26 33]
              )
            }
          spids: [25]
        )
      ]
      spids: [25]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:BUILD_ID spids:[35])
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(hexdump)} {(-n)} {(4)} {(-e)} {(SQ <'4/4 "%X" 1 "\\n"'>)} {(/dev/random)})
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [36 50]
              )
            }
          spids: [35]
        )
      ]
      spids: [35]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:IMAGE_FILE_CUSTOMIZED spids:[52])
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name IMAGE>
                suffix_op: 
                  (suffix_op.StringUnary
                    op_id: VTest_ColonHyphen
                    arg_word: 
                      {
                        (DQ (crankshaft-) (${ VSub_Name TODAY_EXT) (-) (${ VSub_Name BUILD_ID) (.img))
                      }
                  )
                spids: [53 67]
              )
            }
          spids: [52]
        )
      ]
      spids: [52]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:IMAGE_URL spids:[69])
          op: Equal
          rhs: {(https) (Lit_Other ':') (//downloads.raspberrypi.org/raspbian_lite_latest)}
          spids: [69]
        )
      ]
      spids: [69]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:TEMP_CHROOT_DIR spids:[74])
          op: Equal
          rhs: {(/mnt/raspbian-temp)}
          spids: [74]
        )
      ]
      spids: [74]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:DROP_IN spids:[77])
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name DROP_IN>
                suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:{(0)})
                spids: [78 82]
              )
            }
          spids: [77]
        )
      ]
      spids: [77]
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:CUSTOM_SCRIPT spids:[84])
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name CUSTOM_SCRIPT>
                suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ )})
                spids: [85 90]
              )
            }
          spids: [84]
        )
      ]
      spids: [84]
    )
    (C {(clear)})
    (C {(echo)} {(DQ ('###########################################################################'))})
    (C {(echo)} {(DQ )})
    (C {(echo)} {(DQ ('                  Welcome to the Crankshaft build script!'))})
    (C {(echo)} {(DQ )})
    (C {(echo)} {(DQ ('###########################################################################'))})
    (command.FuncDef
      name: bail_and_cleanup
      body: (command.BraceGroup children:[(C {(kpartx)} {(-d)} {($ VSub_Number '$1')})] spids:[138])
      spids: [134 137]
    )
    (command.FuncDef
      name: check_command_ok
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(Lit_Other '[')} {(-x)} 
                              {
                                (DQ 
                                  (word_part.CommandSubPart
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {(command)} {(-v)} {($ VSub_Number '$1')})]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [170 176]
                                  )
                                )
                              } {(Lit_Other ']')}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (C {(echo)} {(DQ )})
                    (command.SimpleCommand
                      words: [
                        {(echo)}
                        {
                          (DQ ('Error: ') ($ VSub_Number '$1') 
                            (' is not installed. Please install it.')
                          )
                        }
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (C {(echo)} {(DQ )})
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                  spids: [16777215 182]
                )
              ]
              spids: [16777215 228]
            )
          ]
          spids: [158]
        )
      spids: [154 157]
    )
    (command.FuncDef
      name: check_root
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$EUID'))} {(-ne)} {(0)} {(Lit_Other ']')})
                      terminator: <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:<ControlFlow_Exit exit>)
                  ]
                  spids: [16777215 259]
                )
              ]
              spids: [16777215 299]
            )
          ]
          spids: [237]
        )
      spids: [233 236]
    )
    (command.FuncDef
      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)})
          ]
          spids: [308]
        )
      spids: [304 307]
    )
    (command.FuncDef
      name: get_unzip_image
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(Lit_Other '[')} {(-f)} {(${ VSub_Name IMAGE_FILE)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:remotesize spids:[378])
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.Pipeline
                                        children: [
                                          (command.SimpleCommand
                                            words: [
                                              {(wget)}
                                              {(https) (Lit_Other ':') 
                                                (//downloads.raspberrypi.org/raspbian_lite_latest)
                                              }
                                              {(--spider)}
                                              {(--server-response)}
                                              {(-O)}
                                              {(-)}
                                            ]
                                            redirects: [
                                              (redir.Redir
                                                op: <Redir_GreatAnd '2>&'>
                                                fd: 2
                                                arg_word: {(1)}
                                              )
                                            ]
                                          )
                                          (C {(sed)} {(-ne)} {(SQ <'/Content-Length/{s/.*: //;p}'>)})
                                        ]
                                        negated: F
                                      )
                                    ]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [379 406]
                              )
                            }
                          spids: [378]
                        )
                      ]
                      spids: [378]
                    )
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:localsize spids:[409])
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (command.Pipeline
                                        children: [
                                          (C {(wc)} {(-c)} {(${ VSub_Name IMAGE_FILE)})
                                          (C {(awk)} {(SQ <'{print $1}'>)})
                                        ]
                                        negated: F
                                      )
                                    ]
                                  )
                                left_token: <Left_Backtick '`'>
                                spids: [410 426]
                              )
                            }
                          spids: [409]
                        )
                      ]
                      spids: [409]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_Other '[')} 
                                  {
                                    (word_part.BracedVarSub
                                      token: <VSub_Name remotesize>
                                      prefix_op: VSub_Pound
                                      spids: [437 440]
                                    )
                                  } {(KW_Bang '!') (Lit_Other '=')} 
                                  {
                                    (word_part.BracedVarSub
                                      token: <VSub_Name localsize>
                                      prefix_op: VSub_Pound
                                      spids: [445 448]
                                    )
                                  } {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:remotesize spids:[456])
                                  op: Equal
                                  rhs: 
                                    {
                                      (word_part.CommandSubPart
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (command.Pipeline
                                                children: [
                                                  (command.SimpleCommand
                                                    words: [
                                                      {(wget)}
                                                      {(https) (Lit_Other ':') 
                                                        (
//downloads.raspberrypi.org/raspbian_lite_latest
                                                        )
                                                      }
                                                      {(--spider)}
                                                      {(--server-response)}
                                                      {(-O)}
                                                      {(-)}
                                                    ]
                                                    redirects: [
                                                      (redir.Redir
                                                        op: <Redir_GreatAnd '2>&'>
                                                        fd: 2
                                                        arg_word: {(1)}
                                                      )
                                                    ]
                                                  )
                                                  (C {(sed)} {(-ne)} 
                                                    {(SQ <'/Content-Length/{s/.*: //;p}'>)}
                                                  )
                                                ]
                                                negated: F
                                              )
                                            ]
                                          )
                                        left_token: <Left_Backtick '`'>
                                        spids: [457 484]
                                      )
                                    }
                                  spids: [456]
                                )
                              ]
                              spids: [456]
                            )
                          ]
                          spids: [16777215 453]
                        )
                      ]
                      spids: [16777215 487]
                    )
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$remotesize'))} 
                                  {(Lit_Other '=')} {(DQ ($ VSub_Name '$localsize'))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ 
                                  (
---------------------------------------------------------------------------
                                  )
                                )
                              }
                            )
                            (C {(echo)} 
                              {
                                (DQ ('Image file ') (${ 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: [16777215 508]
                        )
                      ]
                      else_action: [
                        (C {(echo)} 
                          {
                            (DQ 
                              (
---------------------------------------------------------------------------
                              )
                            )
                          }
                        )
                        (C {(echo)} {(DQ ('Downloading new version of raspbian image from server...'))})
                        (C {(wget)} {(-q)} {(--show-progress)} {(-O) (${ VSub_Name IMAGE_FILE)} 
                          {(${ VSub_Name IMAGE_URL)}
                        )
                        (C {(echo)} 
                          {
                            (DQ 
                              (
---------------------------------------------------------------------------
                              )
                            )
                          }
                        )
                      ]
                      spids: [543 587]
                    )
                  ]
                  spids: [16777215 371]
                )
              ]
              else_action: [
                (C {(echo)} 
                  {
                    (DQ (---------------------------------------------------------------------------))
                  }
                )
                (C {(echo)} {(DQ ('Downloading raspbian image from server...'))})
                (C {(wget)} {(-q)} {(--show-progress)} {(-O) (${ VSub_Name IMAGE_FILE)} 
                  {(${ VSub_Name IMAGE_URL)}
                )
                (C {(echo)} 
                  {
                    (DQ (---------------------------------------------------------------------------))
                  }
                )
              ]
              spids: [590 630]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:IMAGE_FILE_UNZIPPED spids:[634])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(zipinfo)} {(-1)} {(${ VSub_Name IMAGE_FILE)})]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [635 643]
                      )
                    }
                  spids: [634]
                )
              ]
              spids: [634]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:IMAGE_FILE_UNZIPPED_SIZE spids:[646])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(zipinfo)} {(-l)} {(${ VSub_Name IMAGE_FILE)})
                                  (C {(tail)} {(-1)})
                                  (C {(xargs)})
                                  (C {(cut)} {(-d) (SQ <' '>)} {(-f3)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [647 676]
                      )
                    }
                  spids: [646]
                )
              ]
              spids: [646]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(Lit_Other '[')} {(-f)} {(${ VSub_Name IMAGE_FILE_UNZIPPED)} 
                              {(Lit_Other ']')}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (C {(echo)} {(DQ ('Unpacking raspbian image...'))})
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (command.Pipeline
                      children: [
                        (C {(unzip)} {(-o)} {(-p)} {(${ VSub_Name IMAGE_FILE)})
                        (command.SimpleCommand
                          words: [
                            {(pv)}
                            {(-p)}
                            {(-s)}
                            {(${ VSub_Name IMAGE_FILE_UNZIPPED_SIZE)}
                            {(-w)}
                            {(80)}
                          ]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(${ VSub_Name IMAGE_FILE_UNZIPPED)}
                            )
                          ]
                        )
                      ]
                      negated: F
                    )
                  ]
                  spids: [16777215 695]
                )
              ]
              spids: [16777215 752]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(Lit_Other '[')} {(-f)} {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)} 
                              {(Lit_Other ']')}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (C {(echo)} {(DQ ('Copying a big file...'))})
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (C {(cp)} {(${ VSub_Name IMAGE_FILE_UNZIPPED)} 
                      {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)}
                    )
                  ]
                  spids: [16777215 771]
                )
              ]
              else_action: [
                (C {(echo)} 
                  {
                    (DQ (---------------------------------------------------------------------------))
                  }
                )
                (C {(echo)} 
                  {
                    (DQ ('Skipping creation of ') (${ VSub_Name IMAGE_FILE_CUSTOMIZED) 
                      (", it's already there. To re-create, delete it.")
                    )
                  }
                )
                (C {(echo)} 
                  {
                    (DQ (---------------------------------------------------------------------------))
                  }
                )
              ]
              spids: [806 834]
            )
          ]
          spids: [351]
        )
      spids: [347 350]
    )
    (command.FuncDef
      name: resize_raw_image
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:IMAGE_SIZE_RAW spids:[846])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.SimpleCommand
                                words: [{(wc)} {(-c)}]
                                redirects: [
                                  (redir.Redir
                                    op: <Redir_Less '<'>
                                    fd: 16777215
                                    arg_word: {(DQ (${ VSub_Name IMAGE_FILE_UNZIPPED))}
                                  )
                                ]
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [847 859]
                      )
                    }
                  spids: [846]
                )
              ]
              spids: [846]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:IMAGE_SIZE_ACTUAL spids:[862])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.SimpleCommand
                                words: [{(wc)} {(-c)}]
                                redirects: [
                                  (redir.Redir
                                    op: <Redir_Less '<'>
                                    fd: 16777215
                                    arg_word: {(DQ (${ VSub_Name IMAGE_FILE_CUSTOMIZED))}
                                  )
                                ]
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [863 875]
                      )
                    }
                  spids: [862]
                )
              ]
              spids: [862]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:IMAGE_ROOTPART_START spids:[878])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(parted)} {(${ VSub_Name IMAGE_FILE_UNZIPPED)} {(unit)} {(s)} 
                                    {(print)} {(-sm)}
                                  )
                                  (C {(tail)} {(-1)})
                                  (C {(cut)} {(-d) (Lit_Other ':')} {(-f2)})
                                  (C {(sed)} {(SQ <s/s//>)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [879 916]
                      )
                    }
                  spids: [878]
                )
              ]
              spids: [878]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_Other '[')} {(${ VSub_Name IMAGE_SIZE_ACTUAL)} {(-gt)} 
                          {(${ VSub_Name IMAGE_SIZE_RAW)} {(Lit_Other ']')}
                        )
                      terminator: <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:<ControlFlow_Return return>)
                  ]
                  spids: [16777215 936]
                )
              ]
              spids: [16777215 970]
            )
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Resizing image...'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (command.SimpleCommand
              words: [
                {(dd)}
                {(Lit_VarLike 'if=') (/dev/zero)}
                {(Lit_VarLike 'bs=') (1M)}
                {(Lit_VarLike 'count=') (512)}
              ]
              redirects: [
                (redir.Redir
                  op: <Redir_DGreat '>>'>
                  fd: 16777215
                  arg_word: {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:PART_NUM spids:[1018])
                  op: Equal
                  rhs: {(2)}
                  spids: [1018]
                )
              ]
              spids: [1018]
            )
            (command.SimpleCommand
              words: [{(fdisk)} {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 1046
                  stdin_parts: [
                    ('p\n')
                    ('d\n')
                    ($ VSub_Name '$PART_NUM')
                    ('\n')
                    ('n\n')
                    ('p\n')
                    ($ VSub_Name '$PART_NUM')
                    ('\n')
                    ($ VSub_Name '$IMAGE_ROOTPART_START')
                    ('\n')
                    ('\n')
                    ('p\n')
                    ('w\n')
                  ]
                )
              ]
            )
          ]
          spids: [843]
        )
      spids: [839 842]
    )
    (command.FuncDef
      name: set_up_loopdevs
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(kpartx)} {(-v)} {(-a)} {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)})
                (C {(tee)} {(/tmp/kpartx-output.txt)})
              ]
              negated: F
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:LOOPPARTSID spids:[1079])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        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
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [1080 1117]
                      )
                    }
                  spids: [1079]
                )
              ]
              spids: [1079]
            )
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('The loop device is ') (${ VSub_Name LOOPPARTSID))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(sync)})
            (C {(sleep)} {(2)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(Lit_Other '[')} {(-L)} {(/dev/mapper/) (${ VSub_Name LOOPPARTSID) (p1)} 
                              {(Lit_Other ']')}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'                                                                           '
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ ("Couldn't find the loopdev partitions at /dev/mapper/") 
                          (${ VSub_Name LOOPPARTSID) ('p1!')
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'                                                                           '
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (C {(bail_and_cleanup)} {(/dev/) (${ VSub_Name LOOPPARTSID)} 
                      {(${ VSub_Name IMAGE_FILE_CUSTOMIZED)}
                    )
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                  spids: [16777215 1179]
                )
              ]
              spids: [16777215 1238]
            )
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} 
              {
                (DQ ('Found the loopdev partitions at /dev/mapper/') (${ VSub_Name LOOPPARTSID) ('!'))
              }
            )
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:LOOPDEVPARTS spids:[1267])
                  op: Equal
                  rhs: {(/dev/mapper/) (${ VSub_Name LOOPPARTSID)}
                  spids: [1267]
                )
              ]
              spids: [1267]
            )
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Check rootfs before resize...'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(e2fsck)} {(-f)} {(${ VSub_Name LOOPDEVPARTS) (p2)})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Resize rootfs...'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(resize2fs)} {(-p)} {(${ VSub_Name LOOPDEVPARTS) (p2)})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Check rootfs afer resize...'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(e2fsck)} {(-f)} {(${ VSub_Name LOOPDEVPARTS) (p2)})
            (C {(mount_chroot_dirs)} {(${ VSub_Name LOOPDEVPARTS)} {(${ VSub_Name LOOPPARTSID)})
            (C {(sed)} {(-i)} {(SQ <'s/^/#CHROOT /g'>)} 
              {(${ VSub_Name TEMP_CHROOT_DIR) (/etc/ld.so.preload)}
            )
            (C {(cp)} 
              {
                (word_part.CommandSubPart
                  command_list: (command.CommandList children:[(C {(which)} {(qemu-arm-static)})])
                  left_token: <Left_Backtick '`'>
                  spids: [1408 1412]
                )
              } {(${ VSub_Name TEMP_CHROOT_DIR) (/usr/bin/)}
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.BoolBinary
                              op_id: BoolBinary_ne
                              left: {(${ VSub_Name DROP_IN)}
                              right: {(0)}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (C {(echo)} {(-e)} {(DQ ('Dropping you in the chroot shell.'))})
                    (C {(echo)} 
                      {
                        (DQ 
                          (
---------------------------------------------------------------------------
                          )
                        )
                      }
                    )
                    (C {(chroot)} {(${ VSub_Name TEMP_CHROOT_DIR)} {(/bin/bash)})
                  ]
                  spids: [16777215 1436]
                )
              ]
              else_action: [
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: 
                            (command.DBracket
                              expr: 
                                (bool_expr.BoolUnary
                                  op_id: BoolUnary_n
                                  child: {(DQ (${ VSub_Name CUSTOM_SCRIPT))}
                                )
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [(C {(eval)} {(${ VSub_Name CUSTOM_SCRIPT)})]
                      spids: [16777215 1493]
                    )
                  ]
                  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)} {(${ 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/.)} {(${ VSub_Name TEMP_CHROOT_DIR) (/root/)})
                    (C {(sync)})
                    (C {(sleep)} {(1)})
                    (C {(chroot)} {(${ VSub_Name TEMP_CHROOT_DIR)} {(/bin/bash)} 
                      {(/root/scripts/customize-image-pi.sh)}
                    )
                    (C {(chroot)} {(${ VSub_Name TEMP_CHROOT_DIR)} {(/bin/bash)} 
                      {(/root/scripts/read-only-fs.sh)}
                    )
                  ]
                  spids: [1510 1646]
                )
              ]
              spids: [1473 1650]
            )
            (C {(sed)} {(-i)} {(SQ <'s/^#CHROOT //g'>)} 
              {(${ VSub_Name TEMP_CHROOT_DIR) (/etc/ld.so.preload)}
            )
            (C {(umount_chroot_dirs)})
            (C {(zerofree)} {(${ VSub_Name LOOPDEVPARTS) (p2)})
            (C {(umount_loop_dev)} {(/dev/) (${ 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 ('###########################################################################'))}
            )
          ]
          spids: [1055]
        )
      spids: [1051 1054]
    )
    (command.FuncDef
      name: mount_chroot_dirs
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Mounting CHROOT directories'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(mkdir)} {(-p)} {(${ VSub_Name TEMP_CHROOT_DIR)})
            (C {(mount)} {(-o)} {(rw)} {(${ VSub_Number 1) (p2)} {(${ VSub_Name TEMP_CHROOT_DIR)})
            (C {(mount)} {(-o)} {(rw)} {(${ VSub_Number 1) (p1)} {(${ VSub_Name TEMP_CHROOT_DIR) (/boot)})
            (C {(mount)} {(--bind)} {(/dev)} {(${ VSub_Name TEMP_CHROOT_DIR) (/dev/)})
            (C {(mount)} {(--bind)} {(/sys)} {(${ VSub_Name TEMP_CHROOT_DIR) (/sys/)})
            (C {(mount)} {(--bind)} {(/proc)} {(${ VSub_Name TEMP_CHROOT_DIR) (/proc/)})
            (C {(mount)} {(--bind)} {(/dev/pts)} {(${ VSub_Name TEMP_CHROOT_DIR) (/dev/pts)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(Lit_Other '[')} {(-f)} 
                              {(${ VSub_Name TEMP_CHROOT_DIR) (/etc/ld.so.preload)} {(Lit_Other ']')}
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'                                                                           '
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ ("I didn't see ") (${ VSub_Name TEMP_CHROOT_DIR) ('/etc/ folder. Bailing!'))
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'                                                                           '
                          )
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ 
                          (
'###########################################################################'
                          )
                        )
                      }
                    )
                    (C {(umount_chroot_dirs)})
                    (C {(umount_loop_dev)} {($ VSub_Number '$2')})
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                  spids: [16777215 1873]
                )
              ]
              spids: [16777215 1928]
            )
          ]
          spids: [1736]
        )
      spids: [1732 1735]
    )
    (command.FuncDef
      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.BracedWordTree
                parts: [
                  (${ VSub_Name TEMP_CHROOT_DIR)
                  (/)
                  (word_part.BracedAltPart
                    words: [{(dev/pts)} {(dev)} {(sys)} {(proc)} {(boot)} {}]
                  )
                ]
              )
            )
          ]
          spids: [1938]
        )
      spids: [1934 1937]
    )
    (command.FuncDef
      name: umount_loop_dev
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (C {(echo)} {(DQ ('Unmount loop devices...'))})
            (C {(echo)} 
              {(DQ (---------------------------------------------------------------------------))}
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:loopdev spids:[2015])
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Number '$1')})
                                  (C {(cut)} {(-d) (DQ (/))} {(-f3)})
                                ]
                                negated: F
                              )
                            ]
                          )
                        left_token: <Left_Backtick '`'>
                        spids: [2016 2031]
                      )
                    }
                  spids: [2015]
                )
              ]
              spids: [2015]
            )
            (C {(dmsetup)} {(remove)} {(-f)} {($ VSub_Name '$loopdev') (DQ (p1))})
            (C {(dmsetup)} {(remove)} {(-f)} {($ VSub_Name '$loopdev') (DQ (p2))})
            (C {(kpartx)} {(-d)} {($ VSub_Number '$1')})
          ]
          spids: [1991]
        )
      spids: [1987 1990]
    )
    (C {(check_dependencies)})
    (C {(check_root)})
    (C {(get_unzip_image)})
    (C {(resize_raw_image)})
    (C {(set_up_loopdevs)})
  ]
)