|
#!/bin/bash
|
|
# Build script for Slackware
|
|
# Copyright (C) 2009-2020 Damien Goutte-Gattat
|
|
#
|
|
# Redistribution and use of this script, with or without modifications,
|
|
# is permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
|
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
|
|
#
|
|
# Latest omero sourcecode is available at: <http://www.openmicroscopy.org/>.
|
|
#
|
|
# Depends: l/ice-py, l/omero-marshal, l/pytables
|
|
|
|
# Source package infos
|
|
NAMESRC=${NAMESRC:-OMERO.server}
|
|
VERSION=${VERSION:-5.6.2}
|
|
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION-ice36-b226.zip}
|
|
WGET=${WGET:-https://downloads.openmicroscopy.org/omero/$VERSION/artifacts/$ARCHIVE}
|
|
|
|
# Build infos
|
|
NAMEPKG=${NAMEPKG:-omero-server}
|
|
BUILD=${BUILD:-1GGD}
|
|
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
|
|
JOBS=${JOBS:-1}
|
|
EXT=${EXT:-txz}
|
|
|
|
# Directories
|
|
TMP=${TMP:-/tmp}
|
|
OUT=${OUT:-$TMP/build}
|
|
PKG=${PKG:-$OUT/$NAMEPKG}
|
|
CWD=$(pwd)
|
|
|
|
set -e # Quit if a command returns non-zero
|
|
|
|
# Sanity checks
|
|
if [ $UID -eq 0 ]; then
|
|
echo "You should NOT run this script as ROOT!"
|
|
exit 1
|
|
fi
|
|
if [ ! -d $TMP ]; then
|
|
echo "$TMP does not exist or is not a directory!"
|
|
exit 1
|
|
fi
|
|
|
|
# Get and verify the source archive
|
|
if [ ! -r $ARCHIVE ]; then
|
|
wget -c -O $ARCHIVE.part "$WGET"
|
|
mv $ARCHIVE.part $ARCHIVE
|
|
fi
|
|
sha256sum -c $ARCHIVE.sha256
|
|
|
|
# Get and verify OMERO.py
|
|
if [ ! -r omero-py-5.7.1.tar.gz ]; then
|
|
pip3 download --no-binary :all: --no-deps omero-py==5.7.1
|
|
fi
|
|
sha256sum -c omero-py-5.7.1.tar.gz.sha256
|
|
|
|
# Extract and install
|
|
mkdir -p $PKG/opt
|
|
cd $PKG/opt
|
|
unzip $CWD/$ARCHIVE
|
|
mv OMERO.server-$VERSION-ice36-b226 omero
|
|
rm omero/etc/env.bat
|
|
|
|
# Install launch scripts
|
|
install -D -m 755 $CWD/omero.sh $PKG/usr/bin/omero
|
|
install -D -m 644 $CWD/rc.omero $PKG/etc/rc.d/rc.omero
|
|
|
|
# Install configuration file
|
|
install -D -m 644 $CWD/omero.conf $PKG/etc/omero.conf.new
|
|
|
|
# Install documentation
|
|
mkdir -p $PKG/usr/doc/$NAMEPKG-$VERSION
|
|
install -m 644 $CWD/README $PKG/usr/doc/$NAMEPKG-$VERSION
|
|
mv omero/LICENSE.txt $PKG/usr/doc/$NAMEPKG-$VERSION
|
|
mv omero/history.rst $PKG/usr/doc/$NAMEPKG-$VERSION
|
|
mv omero/share/licenses $PKG/usr/doc/$NAMEPKG-$VERSION/licenses
|
|
|
|
# Install OMERO.py
|
|
# This used to be provided along with OMERO.server, but is now
|
|
# distributed on PyPI. However given that OMERO.py is necessary
|
|
# to even start the server, I don't see the point of packaging
|
|
# it separately.
|
|
cd $TMP
|
|
tar xf $CWD/omero-py-5.7.1.tar.gz
|
|
cd omero-py-5.7.1
|
|
python3 setup.py build
|
|
python3 setup.py install \
|
|
--install-lib=/opt/omero/lib/python \
|
|
--install-scripts=/opt/omero/bin \
|
|
--root=$PKG
|
|
rm $PKG/opt/omero/bin/{omero,setpythonpath,winconfig}.bat
|
|
|
|
# Copy slack-desc and doinst.sh files
|
|
mkdir -p $PKG/install
|
|
install -m 644 $CWD/slack-desc $PKG/install/slack-desc
|
|
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
|
|
|
|
# Add dependency infos
|
|
cat <<EOF > $PKG/install/slack-required
|
|
ice-py
|
|
omero-marshal
|
|
pytables
|
|
EOF
|
|
|
|
# Package the tree
|
|
cd $PKG
|
|
mkdir -p $OUT
|
|
PACKAGING="
|
|
chown root:root . -R
|
|
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
|
|
rm -rf $PKG
|
|
rm -rf $TMP/omero-py-5.7.1
|
|
"
|
|
if type -p fakeroot ; then
|
|
echo "$PACKAGING" | fakeroot
|
|
else
|
|
su -c "$PACKAGING"
|
|
fi
|