diff --git a/BUILD_ORDER b/BUILD_ORDER index 37d3a2d..d7b07be 100644 --- a/BUILD_ORDER +++ b/BUILD_ORDER @@ -52,7 +52,7 @@ l libqrencode # zbar xap zbar l libev # i3wm - l yajl # i3wm + l yajl # i3wm,podman x font-awesome # i3wm x xcb-util-xrm # i3wm xap dmenu # i3wm @@ -73,3 +73,4 @@ ap conmon # podman ap go-md2man # podman ap crun # podman + n cni-plugins # podman diff --git a/n/cni-plugins/cni-plugins.SlackBuild b/n/cni-plugins/cni-plugins.SlackBuild new file mode 100755 index 0000000..4031589 --- /dev/null +++ b/n/cni-plugins/cni-plugins.SlackBuild @@ -0,0 +1,113 @@ +#!/bin/sh +# Set initial variables: +CWD=$(pwd) + +APP=cni-plugins +VERSION=$(ls $APP-*.tar.?z* | sed -e 's/\.tar\..z.*//' | rev | cut -d- -f1 | rev) +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-1} +TAG=${TAG:-micu} + +# The domain part of the go package name, usually the hosting platform +DOMAIN=github.com +# The name of the organization/owner of the package +ORG=containernetworking +# The name of the repository +REPONAME=plugins + +LIBSUFFIX="" +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "x86_64" ]; then + LIBSUFFIX=${LIBSUFFIX:-64} +fi + +if [ "$TMP" = "" ]; then + TMP=/tmp +fi +PKG=$TMP/package-$APP +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP || exit 1 +rm -rf $APP-$VERSION +mkdir -p $APP-$VERSION/src/$DOMAIN/$ORG +cd $APP-$VERSION/src/$DOMAIN/$ORG || exit 1 +tar xvf $CWD/$APP-$VERSION.tar.?z* || exit 1 +mv $APP-$VERSION $REPONAME +cd $REPONAME || exit 1 +chown -R root.root . +find . -perm 444 -exec chmod 644 {} \; +find . -perm 777 -exec chmod 755 {} \; +find . -perm 666 -exec chmod 644 {} \; + +# Point go to the location of the source tree +export GOPATH="$TMP/$APP-$VERSION" +REPO_PATH=$TMP/$APP-$VERSION/src/$DOMAIN/$ORG/$REPONAME +mkdir -p $PKG/usr/libexec/cni + +PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/*" +for d in $PLUGINS; do + if [ -d "$d" ]; then + plugin="$(basename "$d")" + if [ $plugin != "windows" ]; then + echo " $plugin" + go build -o "$PKG/usr/libexec/cni/$plugin" "$REPO_PATH"/$d + fi + fi +done + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBSUFFIX}/*.la + +chown -R root.bin $PKG/usr/bin $PKG/usr/sbin + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "current ar archive" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null +) + +# Compress and if needed symlink the man pages: +if [ -d $PKG/usr/info ]; then + rm -f $PKG/usr/info/dir + gzip -9 $PKG/usr/info/* +fi +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +mkdir -p $PKG/usr/doc/$APP-$VERSION +cp -a CONTRIBUTING.md DCO LICENSE OWNERS.md README.md RELEASING.md \ + $PKG/usr/doc/$APP-$VERSION + +mkdir -p $PKG/install +[ -f $CWD/doinst.sh ] && cat $CWD/doinst.sh > $PKG/install/doinst.sh +[ -f $CWD/doinst.sh.gz ] && zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Allow to run as non-root until now: +if [ $(id -u) -ne 0 ]; then + echo "*** Running as non-root, skipping makepkg." + echo "*** Package contents is in $PKG directory." + exit 0 +fi + +cd $PKG +makepkg -l y -c n $TMP/$APP-$VERSION-$ARCH-${BUILD}${TAG}.txz + +# Clean up the extra stuff: +if [ "$1" = "--cleanup" ]; then + rm -rf $TMP/$APP-$VERSION + rm -rf $PKG +fi + diff --git a/n/cni-plugins/get_sources.sh b/n/cni-plugins/get_sources.sh new file mode 100755 index 0000000..7de26fc --- /dev/null +++ b/n/cni-plugins/get_sources.sh @@ -0,0 +1,7 @@ +#!/bin/bash +SRC=cni-plugins +git clone -b master https://github.com/containernetworking/plugins.git $SRC +VERSION=$(cd $SRC && git describe --tags --dirty | sed -e 's/v//' -e 's/-/_/g') +mv $SRC ${SRC}-${VERSION} +tar cf - ${SRC}-${VERSION} | xz -c9 > ${SRC}-${VERSION}.tar.xz +[ -s ${SRC}-${VERSION}.tar.xz ] && rm -rf ${SRC}-${VERSION} diff --git a/n/cni-plugins/slack-desc b/n/cni-plugins/slack-desc new file mode 100644 index 0000000..ead6b93 --- /dev/null +++ b/n/cni-plugins/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +cni-plugins: cni-plugins (plugins for Container Networking Interface) +cni-plugins: +cni-plugins: Container networking plugins for baseline functionality. +cni-plugins: +cni-plugins: Site: https://github.com/containernetworking/plugins +cni-plugins: +cni-plugins: +cni-plugins: +cni-plugins: +cni-plugins: +cni-plugins: