Created
October 18, 2016 17:46
-
-
Save bdha/f94975c5e42254541c004d32c28cefb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# This script translates a Solaris SVR4 Chef Omnibus package into a tarball. | |
# It parses the pkgmap to set up required symlinks, tars, and drops the file in | |
# /var/tmp. | |
CHEF_VERSION=12.3.0-1 | |
PKG_ROOT=/var/tmp/chef-$CHEF_VERSION | |
mkdir -p $PKG_ROOT/work | |
cd $PKG_ROOT | |
if ! [ -f $PKG_ROOT/chef-${CHEF_VERSION}.i86pc.solaris ] ; then | |
wget "https://opscode-omnibus-packages.s3.amazonaws.com/solaris2/5.10/i86pc/chef-${CHEF_VERSION}.i86pc.solaris" | |
fi | |
pkgtrans chef-${CHEF_VERSION}.i86pc.solaris work all | |
cd $PKG_ROOT/work/chef | |
WORK_ROOT=$PKG_ROOT/work/chef/reloc | |
for X in $( grep '^1 s' $PKG_ROOT/work/chef/pkgmap | awk '{print $4}' | grep 'embedded/lib' | grep -v '\.\./' ); do | |
declare $( echo $X | awk -F= '{print "TARGET="$1, "SOURCE="$2}' ) | |
DIR=$( dirname $TARGET ) | |
cd $WORK_ROOT/$DIR | |
LINK=$( basename $TARGET ) | |
ln -s $SOURCE $LINK | |
done | |
cd $WORK_ROOT/chef/embedded/ssl | |
ln -s certs/cacert.pem cert.pem | |
cd /var/tmp | |
cd /var/tmp/chef-$CHEF_VERSION/work/chef/reloc | |
tar -cf chef-$CHEF_VERSION.tar chef | |
gzip chef-$CHEF_VERSION.tar | |
mv chef-$CHEF_VERSION.tar.gz /var/tmp | |
echo | |
echo "Chef package translated and dropped in /var/tmp/chef-${CHEF_VERSION}.tar.gz." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment