(command.CommandList
  children: [
    (C {<set>} {<-euo>} {<pipefail>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SCRIPT_DIR)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: 
                  (command.AndOr
                    ops: [Id.Op_DAmp]
                    children: [
                      (C {<cd>} 
                        {
                          (DQ 
                            (command_sub
                              left_token: <Id.Left_DollarParen '$('>
                              child: 
                                (C {<dirname>} 
                                  {
                                    (DQ 
                                      (braced_var_sub
                                        token: <Id.VSub_Name BASH_SOURCE>
                                        bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                                      )
                                    )
                                  }
                                )
                            )
                          )
                        }
                      )
                      (C {<pwd>})
                    ]
                  )
              )
            }
          spids: [15]
        )
      ]
    )
    (command.Subshell
      child: 
        (command.AndOr
          ops: [Id.Op_DAmp]
          children: [
            (C {<cd>} {(DQ ($ Id.VSub_DollarName '$SCRIPT_DIR') <'/..'>)})
            (C {<make>} {<shell-env>})
          ]
        )
    )
    (C {<cd>} {(DQ ($ Id.VSub_DollarName '$SCRIPT_DIR'))})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SANDSTORM_HOME)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [78]
                )
              ]
            )
          ]
          spids: [62 75]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-e>} {<'/etc/init.d/sandstorm'>} {<Id.Lit_RBracket ']'>})
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<eval>} 
              {
                (DQ 
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: (C {<grep>} {(DQ <'^DAEMON='>)} {<'/etc/init.d/sandstorm'>})
                  )
                )
              }
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SANDSTORM_HOME)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: (C {<dirname>} {($ Id.VSub_DollarName '$DAEMON')})
                      )
                    }
                  spids: [110]
                )
              ]
            )
          ]
          spids: [81 92]
        )
      ]
      else_action: [
        (command.Simple
          words: [
            {<echo>}
            {(DQ <'I couldn\'t find an initscript for Sandstorm. Please pass the directory'>)}
          ]
          redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
          do_fork: T
        )
        (command.Simple
          words: [{<echo>} {(DQ <'where Sandstorm is installed as an argument to this script.'>)}]
          redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
          do_fork: T
        )
        (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
      ]
    )
    (C {<.>} {($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm.conf'>})
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-n>} 
                      {
                        (DQ 
                          (braced_var_sub
                            token: <Id.VSub_Name HTTPS_PORT>
                            suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                          )
                        )
                      } {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'Please remove the HTTPS_PORT= line in your Sandstorm configuration'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ <'since run-dev.sh does not support HTTPS.'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
          ]
          spids: [162 179]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.DBracket
                      expr: 
                        (bool_expr.Binary
                          op_id: Id.BoolBinary_EqualTilde
                          left: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name PORT>
                                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                                )
                              )
                            }
                          right: 
                            {<Id.Lit_Other '^'> <Id.Lit_Other '('> <Id.Lit_Other .> <Id.Lit_Other '*'> 
                              <Id.Lit_Other '?'> <Id.Lit_Other ')'> <Id.Lit_Other ','>
                            }
                        )
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:PORT)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name BASH_REMATCH>
                        bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 1>})
                      )
                    }
                  spids: [241]
                )
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
            )
          ]
          spids: [213 238]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$SERVER_USER'))} 
                      {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ ($ Id.VSub_DollarName '$USER'))} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'Please change your Sandstorm installation to be owned by your own user'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [{<echo>} {(DQ <'account. E.g. run as root:'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm stop'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'  find '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/var -user '> 
                    ($ Id.VSub_DollarName '$SERVER_USER') <' -exec chown -h '> ($ Id.VSub_DollarName '$USER') <' {} +'>
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'  find '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/var -group '> 
                    (command_sub
                      left_token: <Id.Left_DollarParen '$('>
                      child: (C {<id>} {<-gn>} {($ Id.VSub_DollarName '$SERVER_USER')})
                    ) <' -exec chgrp -h '> ($ Id.VSub_DollarName '$USER') <' {} +'>
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {
                  (DQ <'  sed -i -e \'s/^SERVER_USER=.*'> <Id.Lit_Dollar '$'> <'/SERVER_USER='> 
                    ($ Id.VSub_DollarName '$USER') <'/g\' '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>)
                  )
                }
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'      '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm.conf'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm start'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [255 273]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Pipeline
                      children: [
                        (command.Simple
                          words: [{($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm'>} {<status>}]
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<'/dev/null'>}
                            )
                            (redir
                              op: <Id.Redir_GreatAnd '2>&'>
                              loc: (redir_loc.Fd fd:2)
                              arg: {<1>}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                      negated: T
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (C {<echo>} {(DQ <'Please start Sandstorm and then stop the front-end:'>)})
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  sudo '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm start'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  sudo '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm stop-fe'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [392 408]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:BIND_IP)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name BIND_IP>
                suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<127.0.0.1>})
              )
            }
          spids: [449]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (command.Simple
                      words: [
                        {<curl>}
                        {<http> <Id.Lit_Colon ':'> <'//'> ($ Id.VSub_DollarName '$BIND_IP') 
                          <Id.Lit_Colon ':'> ($ Id.VSub_DollarName '$PORT')
                        }
                      ]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<'/dev/null'>}
                        )
                        (redir
                          op: <Id.Redir_GreatAnd '2>&'>
                          loc: (redir_loc.Fd fd:2)
                          arg: {<1>}
                        )
                      ]
                      do_fork: T
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Simple
              words: [{<echo>} {(DQ <'Please shut down your Sandstorm front-end:'>)}]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.Simple
              words: [
                {<echo>}
                {(DQ <'  sudo '> ($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/sandstorm stop-fe'>)}
              ]
              redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
          spids: [457 475]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:MONGO_PASSWD)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_DollarParen '$('>
                child: 
                  (command.Simple
                    redirects: [
                      (redir
                        op: <Id.Redir_Less '<'>
                        loc: (redir_loc.Fd fd:0)
                        arg: {($ Id.VSub_DollarName '$SANDSTORM_HOME') <'/var/mongo/passwd'>}
                      )
                    ]
                    do_fork: F
                  )
              )
            }
          spids: [507]
        )
      ]
    )
    (C {<export>} {<MAIL_URL>})
    (C {<export>} {<DDP_DEFAULT_CONNECTION_URL>})
    (C {<export>} 
      {<Id.Lit_VarLike 'MONGO_URL='> 
        (DQ <'mongodb://sandstorm:'> ($ Id.VSub_DollarName '$MONGO_PASSWD') <'@127.0.0.1:'> 
          ($ Id.VSub_DollarName '$MONGO_PORT') <'/meteor?authSource=admin'>
        )
      }
    )
    (C {<export>} 
      {<Id.Lit_VarLike 'MONGO_OPLOG_URL='> 
        (DQ <'mongodb://sandstorm:'> ($ Id.VSub_DollarName '$MONGO_PASSWD') <'@127.0.0.1:'> 
          ($ Id.VSub_DollarName '$MONGO_PORT') <'/local?authSource=admin'>
        )
      }
    )
    (C {<export>} {<Id.Lit_VarLike 'ROOT_URL='> ($ Id.VSub_DollarName '$BASE_URL')})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SETTINGS)
          op: assign_op.Equal
          rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<mktemp>}))}
          spids: [551]
        )
      ]
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {($ Id.VSub_DollarName '$SETTINGS')}
        )
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {<__EOF__>}
              here_end_span_id: 699
              stdin_parts: [
                <'{\n'>
                <'  '>
                <Id.Right_DoubleQuote '"'>
                <public>
                <Id.Right_DoubleQuote '"'>
                <': {\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <buildstamp>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                <'[local dev front-end]'>
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <allowDemoAccounts>
                <Id.Right_DoubleQuote '"'>
                <': true,\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <allowDevAccounts>
                <Id.Right_DoubleQuote '"'>
                <': true,\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <allowUninvited>
                <Id.Right_DoubleQuote '"'>
                <': '>
                (braced_var_sub
                  token: <Id.VSub_Name ALLOW_UNINVITED>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<false>})
                )
                <',\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <isTesting>
                <Id.Right_DoubleQuote '"'>
                <': true,\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <wildcardHost>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                ($ Id.VSub_DollarName '$WILDCARD_HOST')
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <quotaEnabled>
                <Id.Right_DoubleQuote '"'>
                <': '>
                (braced_var_sub
                  token: <Id.VSub_Name QUOTA_ENABLED>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<false>})
                )
                <',\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <stripePublicKey>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                (braced_var_sub
                  token: <Id.VSub_Name STRIPE_PUBLIC_KEY>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                )
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'    '>
                <Id.Right_DoubleQuote '"'>
                <smtpListenPort>
                <Id.Right_DoubleQuote '"'>
                <': '>
                (braced_var_sub
                  token: <Id.VSub_Name SMTP_LISTEN_PORT>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<30025>})
                )
                <'\n'>
                <'  },\n'>
                <'  '>
                <Id.Right_DoubleQuote '"'>
                <home>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                ($ Id.VSub_DollarName '$SANDSTORM_HOME')
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'  '>
                <Id.Right_DoubleQuote '"'>
                <stripeKey>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                (braced_var_sub
                  token: <Id.VSub_Name STRIPE_KEY>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                )
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'  '>
                <Id.Right_DoubleQuote '"'>
                <mailchimpListId>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                (braced_var_sub
                  token: <Id.VSub_Name MAILCHIMP_LIST_ID>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                )
                <Id.Right_DoubleQuote '"'>
                <',\n'>
                <'  '>
                <Id.Right_DoubleQuote '"'>
                <mailchimpKey>
                <Id.Right_DoubleQuote '"'>
                <': '>
                <Id.Right_DoubleQuote '"'>
                (braced_var_sub
                  token: <Id.VSub_Name MAILCHIMP_KEY>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:(word.Empty))
                )
                <Id.Right_DoubleQuote '"'>
                <'\n'>
                <'}\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<exec>} {<meteor>} {<run>} 
      {<--port> <Id.Lit_Equals '='> ($ Id.VSub_DollarName '$BIND_IP') <Id.Lit_Colon ':'> 
        ($ Id.VSub_DollarName '$PORT')
      } {<--settings>} {($ Id.VSub_DollarName '$SETTINGS')}
    )
  ]
)