some additional changes

This commit is contained in:
John Bintz 2012-07-31 15:58:54 -04:00
parent b9231ec890
commit 00e10a4b96
3 changed files with 15 additions and 8 deletions

View File

@ -59,12 +59,20 @@ Capistrano::Configuration.instance.load do
top.copy_skel top.copy_skel
end end
def as_user(cmd)
if use_sudo
%{#{sudo} su -c "#{cmd}" #{user}}
else
cmd
end
end
desc "Apply the configuration" desc "Apply the configuration"
task :apply do task :apply do
top.copy_files top.copy_files
top.rename if rename_server && wrong_server_name? top.rename if rename_server && wrong_server_name?
run "cd #{puppet_dir} && #{sudo} ./apply" run "cd #{puppet_dir} && #{as_user("./apply")}"
end end
def wrong_server_name? def wrong_server_name?
@ -76,12 +84,12 @@ Capistrano::Configuration.instance.load do
top.copy_files top.copy_files
top.rename if rename_server top.rename if rename_server
run "cd #{puppet_dir} && #{sudo} ./bootstrap" run "cd #{puppet_dir} && #{as_user("./bootstrap")}"
top.reboot top.bootstrap_reboot
end end
desc "Reboot the server after bootstrapping" desc "Reboot the server after bootstrapping"
task :reboot do task :bootstrap_reboot do
run "#{sudo} shutdown -r now" run "#{sudo} shutdown -r now"
end end

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
mkdir -p ~/.puppet mkdir -p ~/.puppet
<%= use_sudo ? "sudo env" : "" %> RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \ RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \
<%= with_additional_puppet_bin_path %> \ <%= with_additional_puppet_bin_path %> \
puppet apply <%= additional_puppet_options %> \ puppet apply <%= additional_puppet_options %> \
--confdir=$PWD \ --confdir=$PWD \

View File

@ -15,7 +15,7 @@ if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then
rm -Rf yaml-$YAML_VERSION* rm -Rf yaml-$YAML_VERSION*
curl http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz > yaml.tar.gz curl http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz > yaml.tar.gz
tar zxvf c$yaml.tar.gz tar zxvf yaml.tar.gz
mv yaml-$YAML_VERSION yaml-$YAML_VERSION-base mv yaml-$YAML_VERSION yaml-$YAML_VERSION-base
cd yaml-$YAML_VERSION-base cd yaml-$YAML_VERSION-base
./configure --prefix=${opt_dir} ./configure --prefix=${opt_dir}
@ -49,5 +49,4 @@ if [ ! -f ${base_dir}/ruby-base/bin/puppet ]; then
fi fi
mkdir -p ~/.puppet mkdir -p ~/.puppet
cd /tmp/puppet
./apply