(command.CommandList children: [ (C {<source>} {<'./virtualbox_env.sh'>}) (C {<source>} {<'./vmware/vmware_env.sh'>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalOr left: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$OSTYPE')} right: {<msys>} ) right: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_DollarName '$OSTYPE')} right: {<cygwin>} ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RSYNCEXTRA) op: assign_op.Equal rhs: {(DQ <'--perms --chmod=a=rwx,Da+x'>)} spids: [54] ) ] ) ] spids: [26 47] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id:Id.BoolUnary_f child:{<'./proxy_setup.sh'>}) ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<.>} {<'./proxy_setup.sh'>})] spids: [62 73] ) ] ) (C {<set>} {<-e>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DIR) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<dirname>} {($ Id.VSub_Number '$0')}) ) } spids: [88] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_gt left: {($ Id.VSub_Pound '$#')} right: {<1>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KEYFILE) op: assign_op.Equal rhs: {(DQ <bootstrap_chef.id_rsa>)} spids: [114] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:IP) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [120] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BCPC_DIR) op: assign_op.Equal rhs: {(DQ <chef-bcpc>)} spids: [126] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VAGRANT) op: assign_op.Equal rhs: {(DQ )} spids: [132] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VMWARE) op: assign_op.Equal rhs: {(DQ )} spids: [137] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VBOX) op: assign_op.Equal rhs: {(DQ )} spids: [142] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Number '$1')} right: {(DQ <--vagrant-local>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'Running on the local Vagrant VM'>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VAGRANT) op: assign_op.Equal rhs: {(DQ <true>)} spids: [176] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VBOX) op: assign_op.Equal rhs: {(DQ <true>)} spids: [182] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BCPC_DIR) op: assign_op.Equal rhs: {(DQ <'~vagrant/chef-bcpc'>)} spids: [188] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_USER) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$USER'))} spids: [194] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_CMD) op: assign_op.Equal rhs: {(DQ <'bash -c'>)} spids: [200] ) ] ) ] spids: [151 166] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Number '$1')} right: {(DQ <--vagrant-remote>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'SSHing to the Vagrant VM'>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VAGRANT) op: assign_op.Equal rhs: {(DQ <true>)} spids: [231] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VBOX) op: assign_op.Equal rhs: {(DQ <true>)} spids: [237] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BCPC_DIR) op: assign_op.Equal rhs: {(DQ <'~vagrant/chef-bcpc'>)} spids: [243] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_USER) op: assign_op.Equal rhs: {(DQ <vagrant>)} spids: [249] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_CMD) op: assign_op.Equal rhs: {(DQ <'vagrant ssh -c'>)} spids: [255] ) ] ) ] spids: [206 221] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {($ Id.VSub_Number '$1')} right: {(DQ <--vagrant-vmware>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'SSHing to the Vagrant VM (on VMware)'>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VAGRANT) op: assign_op.Equal rhs: {(DQ <true>)} spids: [286] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VMWARE) op: assign_op.Equal rhs: {(DQ <true>)} spids: [292] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BCPC_DIR) op: assign_op.Equal rhs: {(DQ <'~vagrant/chef-bcpc'>)} spids: [298] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_USER) op: assign_op.Equal rhs: {(DQ <vagrant>)} spids: [304] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_CMD) op: assign_op.Equal rhs: {(DQ <'vagrant ssh -c'>)} spids: [310] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DIR) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$DIR') <'/vmware'>} spids: [316] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {(DQ ($ Id.VSub_DollarName '$VMRUN'))} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(DQ <'vmrun not found!'>)}] redirects: [ (redir op: <Id.Redir_GreatAnd '>&'> loc: (redir_loc.Fd fd:1) arg: {<2>} ) ] do_fork: T ) (command.Simple words: [ {<echo>} { (DQ <' Please ensure VMWare is installed and vmrun is accessible.'> ) } ] 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: [321 334] ) ] ) ] spids: [261 276] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_USER) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [368] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SSH_CMD) op: assign_op.Equal rhs: { (DQ <'ssh -t -i '> ($ Id.VSub_DollarName '$KEYFILE') <' '> (${ Id.VSub_Name SSH_USER) <'@'> (${ Id.VSub_Name IP) ) } spids: [374] ) ] ) (C {<echo>} { (DQ <'SSHing to the non-Vagrant machine '> (${ Id.VSub_Name IP) <' as '> (${ Id.VSub_Name SSH_USER) ) } ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_ge left: {($ Id.VSub_Pound '$#')} right: {<3>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CHEF_ENVIRONMENT) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$3'))} spids: [423] ) ] ) ] spids: [407 420] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CHEF_ENVIRONMENT) op: assign_op.Equal rhs: {(DQ <Test-Laptop>)} spids: [432] ) ] ) ] ) (C {<echo>} {(DQ <'Chef environment: '> (${ Id.VSub_Name CHEF_ENVIRONMENT))}) ] spids: [98 111] ) ] else_action: [ (command.Simple words: [ {<echo>} { (DQ <'Usage: '> (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<basename>} {($ Id.VSub_Number '$0')}) ) <' --vagrant-local|--vagrant-remote|--vagrant-vmware|<user name> IP-Address [chef environment]'> ) } ] redirects: [(redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/stderr'>})] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit>) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalNot child: (bool_expr.Unary op_id: Id.BoolUnary_f child: {(DQ <'environments/'> (${ Id.VSub_Name CHEF_ENVIRONMENT) <.json>)} ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} { (DQ <'Error: environment file '> (${ Id.VSub_Name CHEF_ENVIRONMENT) <'.json not found'>) } ) (command.ControlFlow token:<Id.ControlFlow_Exit exit>) ] spids: [480 499] ) ] ) (C {<pushd>} {($ Id.VSub_DollarName '$DIR')}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: {($ Id.VSub_DollarName '$VAGRANT')} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ISO) op: assign_op.Equal rhs: {<ubuntu-14.04-mini.iso>} spids: [537] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalNot child: (bool_expr.Unary op_id: Id.BoolUnary_f child: {($ Id.VSub_DollarName '$KEYFILE')} ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<ssh-keygen>} {<-N>} {(DQ )} {<-f>} {($ Id.VSub_DollarName '$KEYFILE')})] spids: [541 554] ) ] ) (C {<echo>} {(DQ <'Running rsync of non-Vagrant install'>)}) (C {<rsync>} {($ Id.VSub_DollarName '$RSYNCEXTRA')} {<-avP>} {<-e>} {(DQ <'ssh -i '> ($ Id.VSub_DollarName '$KEYFILE'))} {<--exclude>} {<vbox>} {<--exclude>} {<vmware>} {<--exclude>} {($ Id.VSub_DollarName '$KEYFILE')} {<--exclude>} {<.chef>} {<.>} {(${ Id.VSub_Name SSH_USER) <Id.Lit_At '@'> ($ Id.VSub_DollarName '$IP') <Id.Lit_Colon ':'> <chef-bcpc> } ) (C {<rsync>} {($ Id.VSub_DollarName '$RSYNCEXTRA')} {<-avP>} {<-e>} {(DQ <'ssh -i '> ($ Id.VSub_DollarName '$KEYFILE'))} {<'vbox/'> ($ Id.VSub_DollarName '$ISO')} {(${ Id.VSub_Name SSH_USER) <Id.Lit_At '@'> ($ Id.VSub_DollarName '$IP') <Id.Lit_Colon ':'> <'chef-bcpc/cookbooks/bcpc/files/default/bins'> } ) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && ./setup_ssh_keys.sh '> (${ Id.VSub_Name KEYFILE) <.pub> ) } ) ] spids: [523 534] ) ] else_action: [ (C {<echo>} {(DQ <'Running rsync of Vagrant install'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'rsync '> ($ Id.VSub_DollarName '$RSYNCEXTRA') < ' -avP --exclude vbox --exclude vmware --exclude .chef /chef-bcpc-host/ /home/vagrant/chef-bcpc/' > ) } ) (C {<echo>} {(DQ <'Rsync over the hypervisor mini ISO to avoid redownloading'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'rsync '> ($ Id.VSub_DollarName '$RSYNCEXTRA') <' -avP /chef-bcpc-host/vbox/'> ($ Id.VSub_DollarName '$ISO') <' /home/vagrant/chef-bcpc/cookbooks/bcpc/files/default/bins'> ) } ) ] ) (C {<echo>} {(DQ <'Updating server'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && sudo apt-get -y update && sudo apt-get -y dist-upgrade'> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalAnd left: (bool_expr.Unary op_id: Id.BoolUnary_n child: {(DQ ($ Id.VSub_DollarName '$VBOX'))} ) right: (bool_expr.Unary op_id: Id.BoolUnary_z child: { (command_sub left_token: <Id.Left_Backtick '`'> child: (command.Pipeline children: [ (C {($ Id.VSub_DollarName '$VBM')} {<snapshot>} {<bcpc-bootstrap>} {<list>} ) (C {<grep>} {<dist-upgrade>}) ] negated: F ) ) } ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'Taking snapshot (VirtualBox)'>)}) (C {($ Id.VSub_DollarName '$VBM')} {<snapshot>} {<bcpc-bootstrap>} {<take>} {<dist-upgrade-complete>} ) ] spids: [710 745] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName '$VMWARE'))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VM_PATH) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<ls>} {<-d>} {<'.vagrant/machines/bootstrap/vmware_fusion/'> <Id.Lit_Star '*'> <'/'>} ) ) } spids: [783] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:VMX_FILE) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$VM_PATH') <'/precise64.vmx'>} spids: [797] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Unary op_id: Id.BoolUnary_z child: { (command_sub left_token: <Id.Left_Backtick '`'> child: (command.Pipeline children: [ (C {(DQ ($ Id.VSub_DollarName '$VMRUN'))} {<listSnapshots>} {($ Id.VSub_DollarName '$VMX_FILE')} ) (C {<grep>} {<dist-upgrade>}) ] negated: F ) ) } ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'Taking snapshot (VMware)'>)}) (C {(DQ ($ Id.VSub_DollarName '$VMRUN'))} {<snapshot>} {($ Id.VSub_DollarName '$VMX_FILE')} {<dist-upgrade-complete>} ) ] spids: [802 829] ) ] ) ] spids: [767 780] ) ] ) (C {<echo>} {(DQ <'Building binaries'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && sudo ./cookbooks/bcpc/files/default/build_bins.sh'> ) } ) (C {<echo>} {(DQ <'Setting up chef server'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && sudo ./setup_chef_server.sh '> (${ Id.VSub_Name IP) ) } ) (C {<echo>} {(DQ <'Setting up chef cookbooks'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && ./setup_chef_cookbooks.sh '> (${ Id.VSub_Name IP) <' '> (${ Id.VSub_Name SSH_USER) ) } ) (C {<echo>} {(DQ <'Setting up chef environment, roles, and uploading cookbooks'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && knife environment from file environments/'> (${ Id.VSub_Name CHEF_ENVIRONMENT) <'.json && knife role from file roles/*.json && knife cookbook upload -a -o cookbooks'> ) } ) (C {<echo>} {(DQ <'Enrolling local bootstrap node into chef'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} { (DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && ./setup_chef_bootstrap_node.sh '> (${ Id.VSub_Name IP) <' '> (${ Id.VSub_Name CHEF_ENVIRONMENT) ) } ) (C {<echo>} {(DQ <'Configuring SSH access keys for bootstrap procedure'>)}) (C {($ Id.VSub_DollarName '$SSH_CMD')} {(DQ <'cd '> ($ Id.VSub_DollarName '$BCPC_DIR') <' && sudo ./install_bootstrap_ssh_key.sh'>)} ) (C {<popd>}) (C {<echo>} {(DQ <'Finished bootstrap of Chef server!'>)}) ] )