Permalink
Browse files

Add initial Linux pkgsrc bootstrap logic.

  • Loading branch information...
Atalanta Systems Engineering
Atalanta Systems Engineering committed Feb 12, 2012
1 parent 912490a commit 10fb52e4a83ecb2392c8e0ba4e389395dee05824
Showing with 34 additions and 1 deletion.
  1. +5 −0 pkgsrc/README.md
  2. +3 −0 pkgsrc/attributes/default.rb
  3. +26 −1 pkgsrc/recipes/linux-client.rb
View
@@ -33,12 +33,17 @@ Provides a package provider called pkgsrc which will install & remove pkgsrc pac
Attributes
==========
+At present the second phase of the boostrap is somewhat primitive, in that it downloads the dependencies required to run `pkgin`, installs them, and then installs `pkgin`. Because at this stage in the bootstrap we don't have an intelligent enough binary package manager, we need to specify the versions exactly. As these will vary depending on the release of pkgsrc and patch level of the individual repository, we provide the capability to specify these as attributes.
+
* `node['pkgsrc']['package_server']` - HTTP or FTP path for remote server where pkgsrc binaries reside.
* `node['pkgsrc']['bootstrap_tarball']['url']` - URL of the pkgsrc bootstrap tarball.
* `node['pkgsrc']['bootstrap_tarball']['checksum']` - MD5 checksum of the bootstrap tarball.
+* `node['pkgsrc']['pkgin']['dependencies']` - Hash of pkgin dependencies and version numbers
+* `node['pkgsrc']['pkgin']['version']` - Version of pkgin to install
The Atalanta Systems Linux pkgsrc repository is freely available, and is specified as a sane default. The pkgsrc bootstrap tarball is also available from the same repo, and its URL and checksum are included as sane defaults.
+
Recipes
=======
@@ -1,3 +1,6 @@
default['pkgsrc']['package_server'] = 'http://pkgsrc.atalanta-systems.com'
default['pkgsrc']['bootstrap_tarball']['url'] = 'http://pkgsrc.atalanta-systems.com/pkgsrc-bootstrap.tar'
default['pkgsrc']['bootstrap_tarball']['checksum'] = 'f3216fb24eaab37bccdadad44be518b9'
+default['pkgsrc']['pkgin']['dependencies'] = {'xz' => '5.0.3', 'bzip2' => '1.0.6', 'zlib' => '1.2.3', 'libarchive' => '2.8.4nb1'}
+default['pkgsrc']['pkgin']['version'] = '0.5.2.1nb1'
+
@@ -1 +1,26 @@
-#TODO
+remote_file "/tmp/pkgsrc-bootstrap.tar" do
+ source node['pkgsrc']['bootstrap_tarball']['url']
+ action :create_if_missing
+end
+
+execute "tar xvf /tmp/pkgsrc-bootstrap.tar" do
+ cwd "/"
+ creates "/usr/pkg/sbin/pkg_add"
+end
+
+repo = node['pkgsrc']['package_server']
+dependencies = node['pkgsrc']['pkgin']['dependencies'].map { |d| d.join('-') }
+pkgin_version = node['pkgsrc']['pkgin']['version']
+
+dependencies.each do |dep|
+ execute "Install dependency #{dep}" do
+ target = ::File.join(repo, dep)
+ command "/usr/pkg/sbin/pkg_add #{target}"
+ not_if '/usr/pkg/sbin/pkg_info -e #{dep}'
+ end
+end
+
+execute "Install pkgin version #{pkgin_version}" do
+ command = "/usr/pkg/sbin/pkg_add pkgin-#{pkgin_version}"
+ not_if '/usr/pkg/sbin/pkg_info -e pkgin'
+end

0 comments on commit 10fb52e

Please sign in to comment.