(CommandList
  children: [
    (C {(set)} {(-euo)} {(pipefail)})
    (C {(shopt)} {(-s)} {(extglob)})
    (C {(rm)} {(-rf)} {(bundle)})
    (FuncDef
      name: fail
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ('make-bundle.sh: FAILED at line ') ($ VSub_Number '$1'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[86])]
            )
            (C {(rm)} {(-rf)} {(bundle)})
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [76]
        )
      spids: [72 75]
    )
    (C {(trap)} {(SQ <'fail ${LINENO}'>)} {(ERR)})
    (FuncDef
      name: copyDep
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:FILE)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [127]
                )
              ]
              spids: [125]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:DST)
                  op: Equal
                  rhs: 
                    {(bundle) 
                      (DQ 
                        (BracedVarSub
                          token: <VSub_Name FILE>
                          suffix_op: 
                            (PatSub
                              pat: 
                                {(EscapedLiteralPart token:<Lit_EscapedChar '\\/'>) (usr) 
                                  (EscapedLiteralPart
                                    token: <Lit_EscapedChar '\\/'>
                                  ) (local)
                                }
                              replace: {(EscapedLiteralPart token:<Lit_EscapedChar '\\/'>) (usr)}
                              do_all: F
                              do_prefix: T
                              do_suffix: F
                            )
                          spids: [136 147]
                        )
                      )
                    }
                  spids: [133]
                )
              ]
              spids: [131]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(Lit_Other '[')} {(-e)} {(DQ ($ VSub_Name '$DST'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(Lit_Other ':')})]
                  spids: [16777215 165]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$FILE'))}
                              right: {(/etc/) (Lit_Other '*')}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$FILE'))} 
                                  {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (SimpleCommand
                              words: [{(echo)} {(DQ ($ VSub_Name '$FILE'))}]
                              redirects: [
                                (Redir
                                  op_id: Redir_DGreat
                                  fd: 16777215
                                  arg_word: {(tmp/host.list)}
                                  spids: [220]
                                )
                              ]
                            )
                          ]
                          spids: [16777215 211]
                        )
                      ]
                      spids: [16777215 225]
                    )
                  ]
                  spids: [175 191]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-h)} {(DQ ($ VSub_Name '$FILE'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(mkdir)} {(-p)} 
                      {
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(dirname)} {(DQ ($ VSub_Name '$DST'))})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [272 278]
                        )
                      }
                    )
                    (Assignment
                      keyword: Assign_Local
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:LINK)
                          op: Equal
                          rhs: 
                            {
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [(C {(readlink)} {(-f)} {(DQ ($ VSub_Name '$FILE'))})]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [284 292]
                              )
                            }
                          spids: [283]
                        )
                      ]
                      spids: [281]
                    )
                    (C {(ln)} {(-sf)} 
                      {
                        (DQ 
                          (BracedVarSub
                            token: <VSub_Name LINK>
                            suffix_op: 
                              (PatSub
                                pat: 
                                  {(EscapedLiteralPart token:<Lit_EscapedChar '\\/'>) (usr) 
                                    (EscapedLiteralPart
                                      token: <Lit_EscapedChar '\\/'>
                                    ) (local)
                                  }
                                replace: {(EscapedLiteralPart token:<Lit_EscapedChar '\\/'>) (usr)}
                                do_all: F
                                do_prefix: T
                                do_suffix: F
                              )
                            spids: [300 311]
                          )
                        )
                      } {(DQ ($ VSub_Name '$DST'))}
                    )
                    (C {(copyDep)} {(DQ ($ VSub_Name '$LINK'))})
                  ]
                  spids: [228 241]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-d)} {(DQ ($ VSub_Name '$FILE'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(mkdir)} {(-p)} {(DQ ($ VSub_Name '$DST'))})]
                  spids: [326 339]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-f)} {(DQ ($ VSub_Name '$FILE'))} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(mkdir)} {(-p)} 
                      {
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(dirname)} {(DQ ($ VSub_Name '$DST'))})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [379 385]
                        )
                      }
                    )
                    (C {(cp)} {(DQ ($ VSub_Name '$FILE'))} {(DQ ($ VSub_Name '$DST'))})
                  ]
                  spids: [355 368]
                )
              ]
              spids: [16777215 399]
            )
          ]
          spids: [117]
        )
      spids: [113 116]
    )
    (FuncDef
      name: copyDeps
      body: 
        (BraceGroup
          children: [
            (While
              cond: [(Sentence child:(C {(read)} {(FILE)}) terminator:<Op_Semi ';'>)]
              body: (DoGroup children:[(C {(copyDep)} {(DQ ($ VSub_Name '$FILE'))})] spids:[423 433])
            )
          ]
          spids: [408]
        )
      spids: [404 407]
    )
    (ForEach
      iter_name: CMD
      iter_words: [{(zip)} {(unzip)} {(xz)} {(gpg)}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [{(which)} {(DQ ($ VSub_Name '$CMD'))}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: 16777215
                                  arg_word: {(/dev/null)}
                                  spids: [469]
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('Please install ') ($ VSub_Name '$CMD'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[484])]
                    )
                    (C {(fail)} {(${ VSub_Name LINENO)})
                  ]
                  spids: [16777215 474]
                )
              ]
              spids: [16777215 495]
            )
          ]
          spids: [456 497]
        )
      spids: [446 454]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:METEOR_DEV_BUNDLE)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(./find-meteor-dev-bundle.sh)})])
                left_token: <Left_CommandSub '$('>
                spids: [501 503]
              )
            }
          spids: [500]
        )
      ]
      spids: [500]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:NODE_BUILD_ROOT)
          op: Equal
          rhs: {(/var/tmp/sandstorm-node-build-dir)}
          spids: [530]
        )
      ]
      spids: [530]
    )
    (C {(echo)} {(DQ ('Building node out-of-tree'))})
    (C {(rm)} {(-rf)} {(DQ ($ VSub_Name '$NODE_BUILD_ROOT'))})
    (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name '$NODE_BUILD_ROOT'))})
    (C {(cp)} {(-a)} {(deps/node)} {(DQ ($ VSub_Name '$NODE_BUILD_ROOT'))})
    (C {(pushd)} {(DQ ($ VSub_Name '$NODE_BUILD_ROOT') (/node))})
    (C {(./configure)} {(--partly-static)})
    (C {(make)} 
      {(-j) 
        (CommandSubPart
          command_list: (CommandList children:[(C {(nproc)})])
          left_token: <Left_CommandSub '$('>
          spids: [582 584]
        )
      }
    )
    (C {(popd)})
    (C {(mkdir)} {(-p)} {(deps/node/out)})
    (C {(rm)} {(-rf)} {(deps/node/out/) (Lit_Other '*')})
    (C {(mv)} {(DQ ($ VSub_Name '$NODE_BUILD_ROOT') (/node/out)) (/) (Lit_Other '*')} {(deps/node/out/)})
    (C {(cp)} {(-r)} {(shell-build/bundle)} {(bundle)})
    (C {(rm)} {(-f)} {(bundle/README)})
    (C {(cp)} {(meteor-bundle-main.js)} {(bundle/sandstorm-main.js)})
    (Subshell
      child: 
        (AndOr
          ops: [Op_DAmp]
          children: [
            (C {(cd)} {(bundle/programs/server)})
            (SimpleCommand
              words: [{(DQ ($ VSub_Name '$METEOR_DEV_BUNDLE') (/bin/npm))} {(install)}]
              more_env: [
                (env_pair
                  name: PATH
                  val: 
                    {($ VSub_Name '$PWD') (/deps/node/out/Release) (Lit_Other ':') 
                      ($ VSub_Name '$METEOR_DEV_BUNDLE') (/lib/node_modules/.bin) (Lit_Other ':') ($ VSub_Name '$METEOR_DEV_BUNDLE') (/bin) (Lit_Other ':') 
                      ($ VSub_Name '$PATH')
                    }
                  spids: [670]
                )
              ]
            )
          ]
        )
      spids: [661 688]
    )
    (C {(mkdir)} {(-p)} {(bundle/bin)})
    (C {(cp)} {(bin/sandstorm-http-bridge)} {(bundle/bin/sandstorm-http-bridge)})
    (C {(cp)} {(bin/sandstorm)} {(bundle/sandstorm)})
    (C {(cp)} {(deps/node/out/Release/node)} {(bundle/bin)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:OLD_BUNDLE_BASE)
          op: Equal
          rhs: {(sandstorm-171)}
          spids: [735]
        )
      ]
      spids: [735]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:OLD_BUNDLE_FILENAME)
          op: Equal
          rhs: {($ VSub_Name '$OLD_BUNDLE_BASE') (.tar.xz)}
          spids: [738]
        )
      ]
      spids: [738]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:OLD_BUNDLE_PATH)
          op: Equal
          rhs: {(hack/) ($ VSub_Name '$OLD_BUNDLE_FILENAME')}
          spids: [742]
        )
      ]
      spids: [742]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:OLD_BUNDLE_SHA256)
          op: Equal
          rhs: {(ebffd643dffeba349f139bee34e4ce33fd9b1298fafc1d6a31eb35a191059a99)}
          spids: [746]
        )
      ]
      spids: [746]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:OLD_MONGO_FILES)
          op: Equal
          rhs: 
            {
              (DQ ($ VSub_Name '$OLD_BUNDLE_BASE') ('/bin/mongo ') ($ VSub_Name '$OLD_BUNDLE_BASE') 
                (/bin/mongod)
              )
            }
          spids: [749]
        )
      ]
      spids: [749]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-e)} {(DQ ($ VSub_Name '$OLD_BUNDLE_PATH'))} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ ('Fetching ') ($ VSub_Name '$OLD_BUNDLE_FILENAME') (' to extract a mongo 2.6...'))
              }
            )
            (C {(curl)} {(--output)} {(DQ ($ VSub_Name '$OLD_BUNDLE_PATH'))} 
              {(https) (Lit_Other ':') (//dl.sandstorm.io/) ($ VSub_Name '$OLD_BUNDLE_FILENAME')}
            )
          ]
          spids: [16777215 773]
        )
      ]
      spids: [16777215 798]
    )
    (SimpleCommand
      words: [{(sha256sum)} {(--check)}]
      redirects: [
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {(DQ ($ VSub_Name '$OLD_BUNDLE_SHA256') ('  ') ($ VSub_Name '$OLD_BUNDLE_PATH') ('\n'))}
          do_expansion: True
          here_end: EOF
          was_filled: T
          spids: [808]
        )
      ]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:rc) op:Equal rhs:{($ VSub_QMark '$?')} spids:[819])]
      spids: [819]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {($ VSub_Name '$rc')} {(-ne)} {(0)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Old bundle did not match expected checksum.  Aborting.'))})
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 835]
        )
      ]
      spids: [16777215 849]
    )
    (C {(tar)} {(xf)} {($ VSub_Name '$OLD_BUNDLE_PATH')} 
      {(--transform) (Lit_Other '=') (s/) (Lit_Other '^') (${ VSub_Name OLD_BUNDLE_BASE) (/bundle/)} {($ VSub_Name '$OLD_MONGO_FILES')}
    )
    (C {(cp)} 
      {
        (CommandSubPart
          command_list: (CommandList children:[(C {(which)} {(zip)} {(unzip)} {(xz)} {(gpg)})])
          left_token: <Left_CommandSub '$('>
          spids: [875 885]
        )
      } {(bundle/bin)}
    )
    (C {(ln)} {(-s)} {(../sandstorm)} {(bundle/bin/spk)})
    (C {(chmod)} {(u) (Lit_Other '+') (w)} {(bundle/bin/) (Lit_Other '*')})
    (C {(mkdir)} {(-p)} 
      (BracedWordTree
        parts: [(bundle/usr/include/) (BracedAltPart words:[{(capnp)} {(sandstorm)}])]
      )
    )
    (C {(cp)} {(src/capnp/) (ExtGlobPart op:<ExtGlob_Bang '!('> spids:[941 945]) (.capnp)} 
      {(bundle/usr/include/capnp)}
    )
    (C {(cp)} {(src/sandstorm/) (Lit_Other '*') (.capnp)} {(bundle/usr/include/sandstorm)})
    (C {(cp)} {(-r)} {(node_modules)} {(bundle)})
    (Pipeline
      children: [
        (Subshell
          child: 
            (AndOr
              ops: [Op_DPipe]
              children: [
                (C {(ldd)} {(bundle/bin/) (Lit_Other '*')} 
                  {
                    (CommandSubPart
                      command_list: 
                        (CommandList
                          children: [(C {(find)} {(bundle)} {(-name)} {(SQ <'*.node'>)})]
                        )
                      left_token: <Left_CommandSub '$('>
                      spids: [980 990]
                    )
                  }
                )
                (C {(true)})
              ]
            )
          spids: [974 995]
        )
        (C {(grep)} {(-o)} {(SQ <'[[:space:]]/[^ ]*'>)})
        (C {(copyDeps)})
      ]
      negated: F
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(tmp/dnstest.c)} spids:[1023])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('#include <sys/types.h>\n') ('#include <sys/socket.h>\n') ('#include <netdb.h>\n') 
              ('#include <stdlib.h>\n') ('\n') ('int main() {\n') ('  struct addrinfo* result;\n') 
              ('  getaddrinfo("example.com", "http", NULL, &result);\n') ('  return 0;\n') ('}\n')
            }
          do_expansion: False
          here_end: __EOF__
          was_filled: T
          spids: [1027]
        )
      ]
    )
    (C {(gcc)} {(tmp/dnstest.c)} {(-o)} {(tmp/dnstest)})
    (Pipeline
      children: [
        (SimpleCommand
          words: [{(strace)} {(tmp/dnstest)}]
          redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1046])]
        )
        (C {(grep)} {(-o)} {(SQ <'"/[^"]*"'>)})
        (C {(tr)} {(-d)} {(SQ <'"'>)})
        (C {(copyDeps)})
      ]
      negated: F
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:16777215 arg_word:{(tmp/host.list)} spids:[1091])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('/etc/gai.conf\n') ('/etc/host.conf\n') ('/etc/hosts\n') ('/etc/nsswitch.conf\n') 
              ('/etc/resolvconf\n') ('/etc/resolv.conf\n') ('/etc/services\n') ('/run/resolvconf\n') ('/run/systemd/resolve/resolv.conf\n')
            }
          do_expansion: False
          here_end: __EOF__
          was_filled: T
          spids: [1095]
        )
      ]
    )
    (Pipeline
      children: [
        (C {(cat)} {(tmp/host.list)})
        (C {(grep)} {(-v)} {(SQ <'/ld[.]so[.]'>)})
        (C {(sort)})
        (SimpleCommand
          words: [{(uniq)}]
          redirects: [
            (Redir
              op_id: Redir_Great
              fd: 16777215
              arg_word: {(bundle/host.list)}
              spids: [1127]
            )
          ]
        )
      ]
      negated: F
    )
    (C {(mkdir)} {(-p)} 
      (BracedWordTree
        parts: [
          (bundle/)
          (BracedAltPart
            words: [{(dev)} {(proc)} {(tmp)} {(etc)} {(etc.host)} {(run)} {(run.host)} {(var)}]
          )
        ]
      )
    )
    (C {(touch)} 
      (BracedWordTree
        parts: [
          (bundle/dev/)
          (BracedAltPart words:[{(null)} {(zero)} {(random)} {(urandom)} {(fuse)}])
        ]
      )
    )
    (C {(mkdir)} {(-p)} {(bundle/usr/lib/locale)})
    (C {(localedef)} {(--no-archive)} {(--inputfile) (Lit_Other '=') (./localedata-C)} 
      {(--charmap) (Lit_Other '=') (UTF-8)} {(bundle/usr/lib/locale/C.UTF-8)}
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other '[')} {(-e)} {(.git)} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [{(git)} {(rev-parse)} {(HEAD)}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {(bundle/git-revision)}
                  spids: [1228]
                )
              ]
            )
          ]
          spids: [16777215 1219]
        )
      ]
      else_action: [
        (SimpleCommand
          words: [{(echo)} {(DQ (unknown))}]
          redirects: [
            (Redir
              op_id: Redir_Great
              fd: 16777215
              arg_word: {(bundle/git-revision)}
              spids: [1241]
            )
          ]
        )
      ]
      spids: [1232 1245]
    )
    (SimpleCommand
      words: [
        {(echo)}
        {
          (DQ ($ VSub_Name '$USER') ('@') ($ VSub_Name '$HOSTNAME') (' ') 
            (CommandSubPart
              command_list: (CommandList children:[(C {(date)})])
              left_token: <Left_CommandSub '$('>
              spids: [1254 1256]
            )
          )
        }
      ]
      redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(bundle/buildstamp)} spids:[1259])]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:16777215 arg_word:{(bundle/README.md)} spids:[1266])
        (HereDoc
          op_id: Redir_DLess
          fd: 16777215
          body: 
            {('# Sandstorm Bundle\n') ('\n') ('See: http://sandstorm.io\n') ('\n') 
              ('This is a self-contained, batteries-included Sandstorm server. It should\n') ('work on any Linux kernel whose version is 3.13 or newer. The rest of your\n') 
              ('filesystem is not touched and may as well be empty; everything will run in\n') ('a chroot.\n') ('\n') ('This bundle is intended to be installed using the Sandstorm installer or\n') 
              ('updater. To install Sandstorm, please run:\n') ('\n') ('    curl https://install.sandstorm.io | bash\n') ('\n') 
              ('If you have already installed Sandstorm, you can update your installation to\n') ('this version by running:\n') ('\n') ('    service sandstorm update <filename>.tar.xz\n')
            }
          do_expansion: False
          here_end: __EOF__
          was_filled: T
          spids: [1270]
        )
      ]
    )
  ]
)