Update mac packaging

This commit is contained in:
C. R. Oldham 2015-06-12 14:14:26 -06:00
parent 092b7ddd0a
commit 5f1459d708
8 changed files with 88 additions and 54 deletions

View file

@ -5,41 +5,33 @@ Building Native Packages on OSX
Salt runs well on the Mac, but does have some limitations.
In this directory you will find scripts and collateral to build an OSX
.pkg-style package that only needs the stock system Python. This process has
been tested on Mac OSX Lion (10.7) and following. Versions of OSX since
Lion have Python 2.7.
.pkg-style package that uses a custom-built Python. This process has
been tested on Mac OSX Lion (10.7) and following.
In addition, because of changes in launchd from version
to version of the OS, a simpler approach is taken for
the launchd plist files.
Unlike Salt installs on Linux, all Salt commands are wrapped
in a bash script. This is because the build process creates
a pseudo-virtualenv as the install directory, and we want to
make sure we have PYTHONPATH set properly before any Salt
command is executed.
If this bothers you, you may consider installing Salt through
MacPorts, Brew, pip, or by hand with 'python setup.py install'.
However, this approach does enable Salt users to potentially
This approach enables Salt users to potentially
add items to their Salt install via 'pip install' without
interfering with the rest of their system's Python packages.
To build a native package you will need the following installed:
- XCode
- pip (easy_install pip)
- virtualenv (pip install virtualenv)
- xCode, or the xCode command line tools
- git
The native package will install package files into /opt/salt.
Configuration files will be installed to /etc, but will have
'.dist' appended to them.
Launchd plists will be placed in /Library/LaunchDaemons. By default
salt-minion will be enabled and started.
salt-minion will NOT be enabled or started.
The process has been automated via the ``build.sh`` script
in the directory with this README file.
in the directory with this README file. Checkout the Salt repo from
GitHub, chdir into the base repo directory, and run
./build.sh

View file

@ -14,15 +14,13 @@ fi
PKGDIR=$1
rm -rf build
mkdir -p build
BUILDDIR=`pwd`/build
PKGRESOURCES=$SRCDIR/pkg/osx
mkdir -p /opt/salt
virtualenv /opt/salt
source /opt/salt/bin/activate
mkdir -p /opt/salt/python
cd $BUILDDIR
@ -37,7 +35,7 @@ gpg --verify libsodium-1.0.2.tar.gz.sig
echo "-------- Building libsodium"
tar -xvf libsodium-1.0.2.tar.gz
cd libsodium-1.0.2
./configure --prefix=/opt/salt
./configure --prefix=/opt/salt/python
make
make check
make install
@ -51,7 +49,7 @@ wget http://download.zeromq.org/SHA1SUMS
echo "-------- Building zeromq"
tar -zxvf zeromq-4.0.5.tar.gz
cd zeromq-4.0.5
./configure --prefix=/opt/salt
./configure --prefix=/opt/salt/python
make
make check
make install
@ -65,10 +63,11 @@ wget http://downloads.sourceforge.net/project/swig/swig/swig-3.0.4/swig-3.0.4.ta
echo "-------- Building SWIG 3.0.4"
tar -zxvf swig-3.0.4.tar.gz
cd swig-3.0.4
./configure --prefix=/opt/salt
./configure --prefix=/opt/salt/python
make
make install
export PATH=/opt/salt/python/bin:$PATH
echo "-------- Installing Salt dependencies with pip"
pip install -r $PKGRESOURCES/requirements.txt
@ -79,40 +78,28 @@ echo "-------- Installing Salt into the virtualenv"
if [ "$3" == "" ]; then
pip install salt==$2
else
pip install $3
e pip install $3
fi
cd /opt/salt/bin
rm python
ln -s /usr/bin/python
# sed -i '' 's/^#!\/.*/#!\/opt\/salt\/bin\/python/g' $1/opt/salt/bin/salt* $1/opt/salt/bin/pip* $1/opt/salt/bin/ioflo* $1/opt/salt/bin/easy_install $1/opt/salt/bin/raetflo
# mv salt salt.py
# mv salt-master salt-master.py
# mv salt-minion salt-minion.py
# mv salt-api salt-api.py
# mv salt-cloud salt-cloud.py
# mv salt-unity salt-unity.py
# cp $PKGRESOURCES/scripts/salt* .
# sed -i '' 's/VIRTUAL_ENV=.*/VIRTUAL_ENV=\/opt\/salt/g' $1/opt/salt/bin/activate
# rm $1/opt/salt/bin/activate.csh
# rm $1/opt/salt/bin/activate.fish
cd /opt/salt/python/bin
mkdir -p /opt/salt/bin
for f in /opt/salt/python/bin/salt-* do
ln -s $f /opt/salt/bin
done
cp $PKGRESOURCES/scripts/start-*.sh /opt/salt/bin
mkdir -p $PKGDIR/opt
cp -r /opt/salt $PKGDIR/opt
mkdir -p $PKGDIR/Library/LaunchDaemons $PKGDIR/etc
mkdir -p $PKGDIR/Library/LaunchDaemons
cp $PKGRESOURCES/scripts/com.saltstack.salt.minion.plist $PKGDIR/Library/LaunchDaemons
cp $PKGRESOURCES/scripts/com.saltstack.salt.master.plist $PKGDIR/Library/LaunchDaemons
cp $PKGRESOURCES/scripts/com.saltstack.salt.syndic.plist $PKGDIR/Library/LaunchDaemons
cp $PKGRESOURCES/scripts/com.saltstack.salt.api.plist $PKGDIR/Library/LaunchDaemons
mkdir -p $PKGDIR/etc/salt
cp $SRCDIR/conf/minion $PKGDIR/etc/salt/minion.dist
cp $SRCDIR/Users/cro/src/ve/sd/salt/conf/master $PKGDIR/etc/salt/master.dist
cp $SRCDIR/conf/master $PKGDIR/etc/salt/master.dist
cd $PKGRESOURCES
cp distribution.xml.dist distribution.xml
@ -121,7 +108,7 @@ echo $SEDSTR
sed -i '' $SEDSTR distribution.xml
pkgbuild --root $PKGDIR --identifier=com.saltstack.salt --version=$2 --ownership=recommended salt-src-$2.pkg
productbuild --distribution=distribution.xml --package-path=salt-src-$2.pkg --version=$2 salt-$2.pkg
productbuild --resources=$PKGDIR --distribution=distribution.xml --package-path=salt-src-$2.pkg --version=$2 salt-$2.pkg
# copy the wrapper script to /opt/salt/bin

View file

@ -1 +1 @@
conclusion
<h1>Salt is Installed!</h1>

View file

@ -5,6 +5,7 @@
<domains enable_localSystem="true"/>
<options rootVolumeOnly="true" />
<!-- Define documents displayed at various steps -->
<background file="saltstack.png" mime-type="image/png" scaling="tofit"/>
<welcome file="welcome.html" mime-type="text/html" />
<license file="license.html" mime-type="text/html" />
<conclusion file="conclusion.html" mime-type="text/html" />

View file

@ -1 +1,14 @@
license
<h1>Salt - Remote execution system</h1>
<p>Copyright 2014-2015 SaltStack Team</p>
<p>Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at</p>
<p> http://www.apache.org/licenses/LICENSE-2.0</p>
<p>Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</p>

BIN
pkg/osx/saltstack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,4 +0,0 @@
#!/bin/bash
source /opt/salt/bin/activate
export PYTHONPATH=/opt/salt/lib/python2.7:/opt/salt/lib/python2.7/site-packages
exec /opt/salt/bin/python /opt/salt/bin/$0.py "$@"

View file

@ -1 +1,46 @@
welcome
<p>
<a href="http://saltstack.com">SaltStack</a> is extremely fast and scalable
systems and configuration management software for predictive orchestration,
cloud and data center automation, server provisioning, application deployment
and more. </p>
<p>Documentation for Salt is available at
<a href="http://docs.saltstack.com">http://docs.saltstack.com</a>
</p>
<p> This package will install Salt on your Mac. Salt
installs into /opt/salt. You may want to add /opt/salt/bin to your
PATH environment variable.</p>
<p>LaunchD plist files will be installed in /Library/LaunchDaemons.
To enable startup of Salt processes on boot, run one or more of the following
as root:</p>
<table border=0 cellpadding='5'>
<tr><td>salt-minion</td>
<td>launchctl load /Library/LaunchDaemons/com.saltstack.salt.minion.plist</td></tr>
<tr><td>salt-master</td>
<td>launchctl load /Library/LaunchDaemons/com.saltstack.salt.master.plist</td></tr>
<tr><td>salt-syndic</td>
<td>launchctl load /Library/LaunchDaemons/com.saltstack.salt.syndic.plist</td></tr>
<tr><td>salt-api</td>
<td>launchctl load /Library/LaunchDaemons/com.saltstack.salt.api.plist</td></tr>
</table>
<p>Sample configuration files (master.dist and minion.dist) will be
installed to /etc/salt. Create copies of them without the '.dist' in
the filename and edit as you see fit.</p>
<p>This Salt package uses a custom-built Python. To install additional
Python modules for Salt, use the associated 'pip' binary. For example,
if you need LDAP support in Salt you will need the 'python-ldap' module.
Install it with
<blockquote>
/opt/salt/python/bin/pip install python-ldap
</blockquote>
<p>
Note that some Python modules need a compiler available. Installing
Apple's xCode command line tools should provide the necessary utilities.
Alternatively, <a href="http://macports.org">MacPorts</a>,
<a href="http://finkproject.org">Fink</a>, or <a href="http://brew.sh">
Homebrew</a> may provide what you need.