a bunch of changes

This commit is contained in:
John Bintz 2012-01-18 12:29:05 -05:00
parent 64c306bed8
commit 1570e842bb
9 changed files with 33 additions and 7 deletions

View File

@ -49,6 +49,7 @@ Capistrano::Configuration.instance.load do
task :rename do task :rename do
hostname = Capistrano::CLI.ui.ask("Hostname: ") hostname = Capistrano::CLI.ui.ask("Hostname: ")
top.copy_skel
run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}" run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}"
end end

View File

@ -2,7 +2,7 @@ Puppet::Type.type(:configure).provide(:action) do
desc "Configure a program to install" desc "Configure a program to install"
def create def create
system %{bash -c '#{path} cd #{@resource[:build_path]} ; make clean ; make distclean ; ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}'}.tap { |o| p o } system %{bash -c '#{path} cd #{@resource[:build_path]} ; ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}'}.tap { |o| p o }
end end
def destroy def destroy
@ -15,7 +15,7 @@ Puppet::Type.type(:configure).provide(:action) do
private private
def config_status def config_status
File.join(@resource[:build_path], 'config.status') File.join(@resource[:build_path], @resource[:config_status])
end end
def path def path

View File

@ -2,7 +2,7 @@ Puppet::Type.type(:gem).provide(:install) do
desc "Install a Ruby Gem" desc "Install a Ruby Gem"
def create def create
gem_command('install --no-ri --no-rdoc') system gem_command('install --no-ri --no-rdoc')
end end
def destroy def destroy
@ -25,7 +25,7 @@ Puppet::Type.type(:gem).provide(:install) do
def gem_command(what) def gem_command(what)
command = %{bash -c 'PATH=#{@resource[:path]} gem #{what} #{@resource[:name]} #{version}'} command = %{bash -c 'PATH=#{@resource[:path]} gem #{what} #{@resource[:name]} #{version}'}
%x{#{command}} command
end end
end end

View File

@ -5,7 +5,9 @@ Puppet::Type.type(:make_and_install).provide(:action) do
def create def create
system %{bash -c '#{path} cd #{@resource[:build_path]} ; make && make install'} system %{bash -c '#{path} cd #{@resource[:build_path]} ; make && make install'}
File.symlink(@resource[:install_path], symlink_path)
FileUtils.rm_rf symlink_path
FileUtils.ln_sf(@resource[:install_path], symlink_path)
end end
def destroy def destroy

View File

@ -19,6 +19,10 @@ Puppet::Type.newtype(:configure) do
desc "Options to build the software" desc "Options to build the software"
end end
newparam(:config_status) do
desc "Relative location of config.status"
end
newparam(:path) do newparam(:path) do
desc "Path for executables" desc "Path for executables"
end end

View File

@ -1,4 +1,4 @@
define build_and_install($version, $source, $path = '', $configure = '') { define build_and_install($version, $source, $path = '', $configure = '', $config_status = 'config.status') {
$full_source = inline_template($source) $full_source = inline_template($source)
$build_path = build_path($name, $version) $build_path = build_path($name, $version)
@ -17,6 +17,7 @@ define build_and_install($version, $source, $path = '', $configure = '') {
options => $configure, options => $configure,
path => $path, path => $path,
require => Download_and_unpack[$name], require => Download_and_unpack[$name],
config_status => $config_status,
ensure => present ensure => present
} }

View File

@ -0,0 +1,7 @@
define mkdir_p($path) {
exec { "mkdir -p ${name}":
path => $path,
unless => "test -d ${name}"
}
}

View File

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
pwd=$PWD
base_dir=<%= base_dir %> base_dir=<%= base_dir %>
if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then
@ -20,6 +21,11 @@ if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then
./configure --prefix=${base_dir}/ruby-base --disable-pthread ./configure --prefix=${base_dir}/ruby-base --disable-pthread
make make
make install make install
cd ext/openssl
PATH=${base_dir}/ruby-base/bin:$PATH ruby extconf.rb
make
make install
fi fi
PATH=${base_dir}/ruby-base/bin:$PATH PATH=${base_dir}/ruby-base/bin:$PATH
@ -29,5 +35,6 @@ if [ ! -f ${base_dir}/ruby-base/bin/puppet ]; then
gem install puppet gem install puppet
fi fi
mkdir ~/.puppet mkdir -p ~/.puppet
cd /tmp/puppet
./apply ./apply

View File

@ -10,5 +10,9 @@ cat /etc/hosts | sed "s#^\\(127.0.0.1\\)\\(.*\\)\$#\\1 $1 \\2#g" > /etc/hosts.tm
mv /etc/hosts.tmp /etc/hosts mv /etc/hosts.tmp /etc/hosts
hostname $1 hostname $1
if [ -f /etc/sysconfig/network ]; then
echo -e "NETWORKING=yes\nHOSTNAME=$1\n" > /etc/sysconfig/network
fi
echo "Server renamed to $1" echo "Server renamed to $1"