mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-28 10:02:43 +01:00
84 lines
2.1 KiB
Text
84 lines
2.1 KiB
Text
|
#!/bin/sh
|
||
|
|
||
|
# Slackware build script for containerd
|
||
|
# Written by Asaf Ohayon <asaf@sysbind.co.il>
|
||
|
|
||
|
PRGNAM=containerd
|
||
|
VERSION=${VERSION:-0.2.3}
|
||
|
BUILD=${BUILD:-1}
|
||
|
TAG=${TAG:-_SBo}
|
||
|
|
||
|
if [ -z "$ARCH" ]; then
|
||
|
case "$( uname -m )" in
|
||
|
i?86) ARCH=i586 ;;
|
||
|
arm*) ARCH=arm ;;
|
||
|
*) ARCH=$( uname -m ) ;;
|
||
|
esac
|
||
|
fi
|
||
|
|
||
|
CWD=$(pwd)
|
||
|
TMP=${TMP:-/tmp/SBo}
|
||
|
PKG=$TMP/package-$PRGNAM
|
||
|
OUTPUT=${OUTPUT:-/tmp}
|
||
|
|
||
|
if [ "$ARCH" = "i586" ]; then
|
||
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||
|
LIBDIRSUFFIX=""
|
||
|
elif [ "$ARCH" = "i686" ]; then
|
||
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||
|
LIBDIRSUFFIX=""
|
||
|
elif [ "$ARCH" = "x86_64" ]; then
|
||
|
SLKCFLAGS="-O2 -fPIC"
|
||
|
LIBDIRSUFFIX="64"
|
||
|
else
|
||
|
SLKCFLAGS="-O2"
|
||
|
LIBDIRSUFFIX=""
|
||
|
fi
|
||
|
|
||
|
set -e
|
||
|
|
||
|
rm -rf $PKG
|
||
|
mkdir -p $TMP $PKG $OUTPUT
|
||
|
cd $TMP
|
||
|
rm -rf $PRGNAM-$VERSION
|
||
|
tar xvf $CWD/containerd-${VERSION}.tar.gz || tar xvf $CWD/v$VERSION.tar.gz
|
||
|
cd $PRGNAM-$VERSION
|
||
|
chown -R root:root .
|
||
|
# the have symlinks in their testdata that goes outside the context of this build
|
||
|
find -L . ! -type l \
|
||
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
||
|
-o -perm 511 \) -exec chmod 755 {} \; -o ! -type l \
|
||
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||
|
|
||
|
source /etc/profile.d/go.sh
|
||
|
|
||
|
unset GOPATH
|
||
|
export GOPATH="${TMP}/${PRGNAM}-${VERSION}"
|
||
|
mkdir -p src/github.com/docker
|
||
|
cd src/github.com/docker/
|
||
|
ln -rsf "${TMP}/${PRGNAM}-${VERSION}" containerd
|
||
|
cd containerd
|
||
|
LDFLAGS= make
|
||
|
|
||
|
cd src/github.com/docker/containerd/bin
|
||
|
for file in $(find . -type f -print); do
|
||
|
echo ${file}
|
||
|
install -Dm755 ${file} ${PKG}/usr/bin/${file}
|
||
|
file=$(echo ${file} | sed 's/\.\///g')
|
||
|
if [[ "${file}" == "ctr" ]]; then
|
||
|
ln -s ${file} ${PKG}/usr/bin/docker-containerd-${file}
|
||
|
else
|
||
|
ln -s ${file} ${PKG}/usr/bin/docker-${file}
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||
|
|
||
|
mkdir -p $PKG/install
|
||
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||
|
|
||
|
cd $PKG
|
||
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|