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
hostname = Capistrano::CLI.ui.ask("Hostname: ")
top.copy_skel
run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}"
end

View File

@ -2,7 +2,7 @@ Puppet::Type.type(:configure).provide(:action) do
desc "Configure a program to install"
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
def destroy
@ -15,7 +15,7 @@ Puppet::Type.type(:configure).provide(:action) do
private
def config_status
File.join(@resource[:build_path], 'config.status')
File.join(@resource[:build_path], @resource[:config_status])
end
def path

View File

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

View File

@ -5,7 +5,9 @@ Puppet::Type.type(:make_and_install).provide(:action) do
def create
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
def destroy

View File

@ -19,6 +19,10 @@ Puppet::Type.newtype(:configure) do
desc "Options to build the software"
end
newparam(:config_status) do
desc "Relative location of config.status"
end
newparam(:path) do
desc "Path for executables"
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)
$build_path = build_path($name, $version)
@ -17,6 +17,7 @@ define build_and_install($version, $source, $path = '', $configure = '') {
options => $configure,
path => $path,
require => Download_and_unpack[$name],
config_status => $config_status,
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
pwd=$PWD
base_dir=<%= base_dir %>
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
make
make install
cd ext/openssl
PATH=${base_dir}/ruby-base/bin:$PATH ruby extconf.rb
make
make install
fi
PATH=${base_dir}/ruby-base/bin:$PATH
@ -29,5 +35,6 @@ if [ ! -f ${base_dir}/ruby-base/bin/puppet ]; then
gem install puppet
fi
mkdir ~/.puppet
mkdir -p ~/.puppet
cd /tmp/puppet
./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
hostname $1
if [ -f /etc/sysconfig/network ]; then
echo -e "NETWORKING=yes\nHOSTNAME=$1\n" > /etc/sysconfig/network
fi
echo "Server renamed to $1"