(CommandList
  children: [
    (C {(set)} {(-euo)} {(pipefail)})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SCRIPT_DIR)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (C {(cd)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(dirname)} 
                                          {
                                            (DQ 
                                              (BracedVarSub
                                                token: <VSub_Name BASH_SOURCE>
                                                bracket_op: 
                                                  (ArrayIndex
                                                    expr: (ArithWord w:{(Lit_Digits 0)})
                                                  )
                                                spids: [24 29]
                                              )
                                            )
                                          }
                                        )
                                      ]
                                    )
                                  left_token: <Left_CommandSub "$(">
                                  spids: [20 31]
                                )
                              )
                            }
                          )
                          (C {(pwd)})
                        ]
                        op_id: Op_DAmp
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [16 37]
              )
            }
          spids: [15]
        )
      ]
      spids: [15]
    )
    (Subshell
      child: 
        (AndOr
          children: [(C {(cd)} {(DQ ($ VSub_Name "$SCRIPT_DIR") (/..))}) (C {(make)} {(shell-env)})]
          op_id: Op_DAmp
        )
      spids: [40 53]
    )
    (C {(cd)} {(DQ ($ VSub_Name "$SCRIPT_DIR"))})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other "[")} {($ VSub_Pound "$#")} {(-gt)} {(0)} {(Lit_Other "]")})
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:SANDSTORM_HOME)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [78]
                )
              ]
              spids: [78]
            )
          ]
          spids: [-1 75]
        )
        (if_arm
          cond: [
            (Sentence
              child: (C {(Lit_Other "[")} {(-e)} {(/etc/init.d/sandstorm)} {(Lit_Other "]")})
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (C {(eval)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [(C {(grep)} {(DQ ("^DAEMON="))} {(/etc/init.d/sandstorm)})]
                      )
                    left_token: <Left_CommandSub "$(">
                    spids: [98 106]
                  )
                )
              }
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:SANDSTORM_HOME)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(dirname)} {($ VSub_Name "$DAEMON")})]
                          )
                        left_token: <Left_CommandSub "$(">
                        spids: [111 115]
                      )
                    }
                  spids: [110]
                )
              ]
              spids: [110]
            )
          ]
          spids: [81 92]
        )
      ]
      else_action: [
        (SimpleCommand
          words: [
            {(echo)}
            {(DQ ("I couldn't find an initscript for Sandstorm. Please pass the directory"))}
          ]
          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[126])]
        )
        (SimpleCommand
          words: [{(echo)} {(DQ ("where Sandstorm is installed as an argument to this script."))}]
          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[136])]
        )
        (C {(exit)} {(1)})
      ]
      spids: [117 144]
    )
    (C {(.)} {($ VSub_Name "$SANDSTORM_HOME") (/sandstorm.conf)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(-n)} 
                  {
                    (DQ 
                      (BracedVarSub
                        token: <VSub_Name HTTPS_PORT>
                        suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                        spids: [169 172]
                      )
                    )
                  } {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ("Please remove the HTTPS_PORT= line in your Sandstorm configuration"))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[188])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("since run-dev.sh does not support HTTPS."))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[198])]
            )
          ]
          spids: [-1 179]
        )
      ]
      spids: [-1 201]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_EqualTilde
                      left: 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name PORT>
                              suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                              spids: [218 221]
                            )
                          )
                        }
                      right: 
                        {(Lit_Other "^") ("(") (.) (Lit_Other "*") (Lit_Other "?") (")") (Lit_Comma ",")}
                    )
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:PORT)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Name BASH_REMATCH>
                        bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 1)}))
                        spids: [242 247]
                      )
                    }
                  spids: [241]
                )
              ]
              spids: [241]
            )
          ]
          spids: [-1 238]
        )
      ]
      spids: [-1 252]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$SERVER_USER"))} {(KW_Bang "!") (Lit_Other "=")} 
                  {(DQ ($ VSub_Name "$USER"))} {(Lit_Other "]")}
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ("Please change your Sandstorm installation to be owned by your own user"))}
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[282])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("account. E.g. run as root:"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[292])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("  ") ($ VSub_Name "$SANDSTORM_HOME") ("/sandstorm stop"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[304])]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ("  find ") ($ VSub_Name "$SANDSTORM_HOME") ("/var -user ") 
                    ($ VSub_Name "$SERVER_USER") (" -exec chown -h ") ($ VSub_Name "$USER") (" {} +")
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[320])]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ("  find ") ($ VSub_Name "$SANDSTORM_HOME") ("/var -group ") 
                    (CommandSubPart
                      command_list: 
                        (CommandList
                          children: [(C {(id)} {(-gn)} {($ VSub_Name "$SERVER_USER")})]
                        )
                      left_token: <Left_CommandSub "$(">
                      spids: [330 336]
                    ) (" -exec chgrp -h ") ($ VSub_Name "$USER") (" {} +")
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[342])]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ("  sed -i -e 's/^SERVER_USER=.*") (Lit_Other "$") ("/SERVER_USER=") 
                    ($ VSub_Name "$USER") ("/g' ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\\">)
                  )
                }
              ]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[357])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("      ") ($ VSub_Name "$SANDSTORM_HOME") (/sandstorm.conf))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[369])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("  ") ($ VSub_Name "$SANDSTORM_HOME") ("/sandstorm start"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[381])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 273]
        )
      ]
      spids: [-1 389]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (SimpleCommand
                      words: [{($ VSub_Name "$SANDSTORM_HOME") (/sandstorm)} {(status)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: {(/dev/null)}
                          spids: [401]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [404]
                        )
                      ]
                    )
                  ]
                  negated: True
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Please start Sandstorm and then stop the front-end:"))})
            (SimpleCommand
              words: [{(echo)} {(DQ ("  sudo ") ($ VSub_Name "$SANDSTORM_HOME") ("/sandstorm start"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[426])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("  sudo ") ($ VSub_Name "$SANDSTORM_HOME") ("/sandstorm stop-fe"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[438])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 408]
        )
      ]
      spids: [-1 446]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:BIND_IP)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name BIND_IP>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(127.0.0.1)})
                spids: [450 454]
              )
            }
          spids: [449]
        )
      ]
      spids: [449]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [
                    {(curl)}
                    {(http) (Lit_Other ":") (//) ($ VSub_Name "$BIND_IP") (Lit_Other ":") 
                      ($ VSub_Name "$PORT")
                    }
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(/dev/null)}
                      spids: [468]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[471])
                  ]
                )
              terminator: <Op_Semi ";">
            )
          ]
          action: [
            (SimpleCommand
              words: [{(echo)} {(DQ ("Please shut down your Sandstorm front-end:"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[484])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("  sudo ") ($ VSub_Name "$SANDSTORM_HOME") ("/sandstorm stop-fe"))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[496])]
            )
            (C {(exit)} {(1)})
          ]
          spids: [-1 475]
        )
      ]
      spids: [-1 504]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:MONGO_PASSWD)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (SimpleCommand
                        redirects: [
                          (Redir
                            op_id: Redir_Less
                            fd: -1
                            arg_word: {($ VSub_Name "$SANDSTORM_HOME") (/var/mongo/passwd)}
                            spids: [509]
                          )
                        ]
                      )
                    ]
                  )
                left_token: <Left_CommandSub "$(">
                spids: [508 512]
              )
            }
          spids: [507]
        )
      ]
      spids: [507]
    )
    (C {(export)} {(MAIL_URL)})
    (C {(export)} {(DDP_DEFAULT_CONNECTION_URL)})
    (C {(export)} 
      {(Lit_VarLike "MONGO_URL=") 
        (DQ ("mongodb://sandstorm:") ($ VSub_Name "$MONGO_PASSWD") ("@127.0.0.1:") 
          ($ VSub_Name "$MONGO_PORT") ("/meteor?authSource=admin")
        )
      }
    )
    (C {(export)} 
      {(Lit_VarLike "MONGO_OPLOG_URL=") 
        (DQ ("mongodb://sandstorm:") ($ VSub_Name "$MONGO_PASSWD") ("@127.0.0.1:") 
          ($ VSub_Name "$MONGO_PORT") ("/local?authSource=admin")
        )
      }
    )
    (C {(export)} {(Lit_VarLike "ROOT_URL=") ($ VSub_Name "$BASE_URL")})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SETTINGS)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(mktemp)})])
                left_token: <Left_CommandSub "$(">
                spids: [552 554]
              )
            }
          spids: [551]
        )
      ]
      spids: [551]
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_Great fd:-1 arg_word:{($ VSub_Name "$SETTINGS")} spids:[559])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: 
            {
              (DQ ("{\n") ("  ") (Right_DoubleQuote "\"") (public) (Right_DoubleQuote "\"") (": {\n") 
                ("    ") (Right_DoubleQuote "\"") (buildstamp) (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") 
                ("[local dev front-end]") (Right_DoubleQuote "\"") (",\n") ("    ") (Right_DoubleQuote "\"") (allowDemoAccounts) 
                (Right_DoubleQuote "\"") (": true,\n") ("    ") (Right_DoubleQuote "\"") (allowDevAccounts) (Right_DoubleQuote "\"") (": true,\n") 
                ("    ") (Right_DoubleQuote "\"") (allowUninvited) (Right_DoubleQuote "\"") (": ") 
                (BracedVarSub
                  token: <VSub_Name ALLOW_UNINVITED>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(false)})
                  spids: [597 601]
                ) (",\n") ("    ") (Right_DoubleQuote "\"") (isTesting) (Right_DoubleQuote "\"") (": true,\n") ("    ") 
                (Right_DoubleQuote "\"") (wildcardHost) (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") ($ VSub_Name "$WILDCARD_HOST") 
                (Right_DoubleQuote "\"") (",\n") ("    ") (Right_DoubleQuote "\"") (quotaEnabled) (Right_DoubleQuote "\"") (": ") 
                (BracedVarSub
                  token: <VSub_Name QUOTA_ENABLED>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(false)})
                  spids: [622 626]
                ) (",\n") ("    ") (Right_DoubleQuote "\"") (stripePublicKey) (Right_DoubleQuote "\"") (": ") 
                (Right_DoubleQuote "\"") 
                (BracedVarSub
                  token: <VSub_Name STRIPE_PUBLIC_KEY>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                  spids: [634 637]
                ) (Right_DoubleQuote "\"") (",\n") ("    ") (Right_DoubleQuote "\"") (smtpListenPort) 
                (Right_DoubleQuote "\"") (": ") 
                (BracedVarSub
                  token: <VSub_Name SMTP_LISTEN_PORT>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(30025)})
                  spids: [645 649]
                ) ("\n") ("  },\n") ("  ") (Right_DoubleQuote "\"") (home) (Right_DoubleQuote "\"") (": ") 
                (Right_DoubleQuote "\"") ($ VSub_Name "$SANDSTORM_HOME") (Right_DoubleQuote "\"") (",\n") ("  ") (Right_DoubleQuote "\"") 
                (stripeKey) (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") 
                (BracedVarSub
                  token: <VSub_Name STRIPE_KEY>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                  spids: [667 670]
                ) (Right_DoubleQuote "\"") (",\n") ("  ") (Right_DoubleQuote "\"") (mailchimpListId) 
                (Right_DoubleQuote "\"") (": ") (Right_DoubleQuote "\"") 
                (BracedVarSub
                  token: <VSub_Name MAILCHIMP_LIST_ID>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                  spids: [679 682]
                ) (Right_DoubleQuote "\"") (",\n") ("  ") (Right_DoubleQuote "\"") (mailchimpKey) (Right_DoubleQuote "\"") 
                (": ") (Right_DoubleQuote "\"") 
                (BracedVarSub
                  token: <VSub_Name MAILCHIMP_KEY>
                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                  spids: [691 694]
                ) (Right_DoubleQuote "\"") ("\n") ("}\n")
              )
            }
          do_expansion: True
          here_end: __EOF__
          was_filled: True
          spids: [563]
        )
      ]
    )
    (C {(exec)} {(meteor)} {(run)} 
      {(--port) (Lit_Other "=") ($ VSub_Name "$BIND_IP") (Lit_Other ":") ($ VSub_Name "$PORT")} {(--settings)} {($ VSub_Name "$SETTINGS")}
    )
  ]
)