(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:PIDDIR)
          op: assign_op.Equal
          rhs: {(/var/run/samba)}
          spids: [36]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SMBDPID)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$PIDDIR') (/smbd.pid)}
          spids: [39]
        )
      ]
    )
    (C {(unset)} {(TMPDIR)})
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {(test)} {(-x)} {(/usr/sbin/smbd)})
        (command.ControlFlow
          token: (Token id:Id.ControlFlow_Exit val:exit span_id:63)
          arg_word: {(0)}
        )
      ]
    )
    (C {(.)} {(/lib/lsb/init-functions)})
    (command.Case
      to_match: {($ Id.VSub_Number '$1')}
      arms: [
        (case_arm
          pat_list: [{(start)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(init_is_upstart)})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:87)
                    )
                  ]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:92)
                      arg_word: {(1)}
                    )
                  ]
                  spids: [84 89]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:SERVER_ROLE)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: (Token id:Id.Left_Backtick val:'`' span_id:101)
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [
                                  (command.Simple
                                    words: [
                                      {(samba-tool)}
                                      {(testparm)}
                                      {(--parameter-name) (Id.Lit_Equals '=') (DQ ('server role'))}
                                    ]
                                    redirects: [
                                      (redir.Redir
                                        op: (Token id:Id.Redir_Great val:'2>' span_id:114)
                                        fd: 2
                                        arg_word: {(/dev/null)}
                                      )
                                    ]
                                  )
                                  (C {(tail)} {(-1)})
                                ]
                                negated: F
                              )
                            ]
                          )
                      )
                    }
                  spids: [100]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_DollarName '$SERVER_ROLE'))} 
                          {(Id.Lit_Equals '=')} {(DQ ('active directory domain controller'))} {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:140)
                    )
                  ]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:145)
                      arg_word: {(0)}
                    )
                  ]
                  spids: [125 142]
                )
              ]
            )
            (C {(log_daemon_msg)} {(DQ ('Starting SMB/CIFS daemon'))} {(smbd)})
            (C {(install)} {(-o)} {(root)} {(-g)} {(root)} {(-m)} {(755)} {(-d)} 
              {($ Id.VSub_DollarName '$PIDDIR')}
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (C {(start-stop-daemon)} {(--start)} {(--quiet)} {(--oknodo)} {(--exec)} 
                              {(/usr/sbin/smbd)} {(--)} {(-D)}
                            )
                          ]
                          negated: T
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:206)
                    )
                  ]
                  action: [
                    (C {(log_end_msg)} {(1)})
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:216)
                      arg_word: {(1)}
                    )
                  ]
                  spids: [187 208]
                )
              ]
            )
            (C {(log_end_msg)} {(0)})
          ]
          spids: [80 81 230 -1]
        )
        (case_arm
          pat_list: [{(stop)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(init_is_upstart)})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:240)
                    )
                  ]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:245)
                      arg_word: {(0)}
                    )
                  ]
                  spids: [237 242]
                )
              ]
            )
            (C {(log_daemon_msg)} {(DQ ('Stopping SMB/CIFS daemon'))} {(smbd)})
            (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--pidfile)} 
              {($ Id.VSub_DollarName '$SMBDPID')}
            )
            (C {(sleep)} {(1)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (C {(Id.Lit_LBracket '[')} {(-f)} {($ Id.VSub_DollarName '$SMBDPID')} 
                          {(Id.Lit_RBracket ']')}
                        )
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [
                                {(ps)}
                                {(h)}
                                {
                                  (command_sub
                                    left_token: (Token id:Id.Left_Backtick val:'`' span_id:302)
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {(cat)} {($ Id.VSub_DollarName '$SMBDPID')})]
                                      )
                                  )
                                }
                              ]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_Great val:'>' span_id:310)
                                  fd: -1
                                  arg_word: {(/dev/null)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      ]
                    )
                  ]
                  action: [(C {(rm)} {(-f)} {($ Id.VSub_DollarName '$SMBDPID')})]
                  spids: [284 315]
                )
              ]
            )
            (C {(log_end_msg)} {(0)})
          ]
          spids: [233 234 343 -1]
        )
        (case_arm
          pat_list: [{(reload)}]
          action: [
            (C {(log_daemon_msg)} {(DQ ('Reloading /etc/samba/smb.conf'))} {(smbd)})
            (C {(start-stop-daemon)} {(--stop)} {(--quiet)} {(--signal)} {(HUP)} {(--pidfile)} 
              {($ Id.VSub_DollarName '$SMBDPID')}
            )
            (C {(log_end_msg)} {(0)})
          ]
          spids: [346 347 381 -1]
        )
        (case_arm
          pat_list: [{(restart)} {(force-reload)}]
          action: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(init_is_upstart)})
                      terminator: (Token id:Id.Op_Semi val:';' span_id:393)
                    )
                  ]
                  action: [
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Exit val:exit span_id:398)
                      arg_word: {(1)}
                    )
                  ]
                  spids: [390 395]
                )
              ]
            )
            (C {($ Id.VSub_Number '$0')} {(stop)})
            (C {(sleep)} {(1)})
            (C {($ Id.VSub_Number '$0')} {(start)})
          ]
          spids: [384 387 421 -1]
        )
        (case_arm
          pat_list: [{(status)}]
          action: [
            (C {(status_of_proc)} {(-p)} {($ Id.VSub_DollarName '$SMBDPID')} {(/usr/sbin/smbd)} {(smbd)})
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:439)
              arg_word: {($ Id.VSub_QMark '$?')}
            )
          ]
          spids: [424 425 444 -1]
        )
        (case_arm
          pat_list: [{(Id.Lit_Star '*')}]
          action: [
            (C {(echo)} 
              {(DQ ('Usage: /etc/init.d/smbd {start|stop|reload|restart|force-reload|status}'))}
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:458)
              arg_word: {(1)}
            )
          ]
          spids: [447 448 463 -1]
        )
      ]
    )
    (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:468) arg_word:{(0)})
  ]
)