#!/bin/sh
#
# Dlackware build system, inpsired by Dropline Build System
# Copyright 2015 Eugene Wissner, Dachau, Germany
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

PKGNAM=systemd-service-files
VERSION=${VERSION:-3.34.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_snuk}

ARCH=noarch

CWD=$(pwd)
TMP=${TMP:-/var/cache/snukware/tmp}
PKG=$TMP/package-$PKGNAM
OUTPUT=${OUTPUT:-/var/cache/snukware/a}

set -e # Exit on most errors

rm -rf $PKG
mkdir -p $PKG $TMP $OUTPUT \
	$PKG/usr/lib/systemd/system \
        $PKG/usr/bin \



# install -m 0755 $CWD/bin/* $PKG/usr/bin/

install -m 0644 $CWD/systemd/* $PKG/usr/lib/systemd/system/

mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cat $CWD/$PKGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PKGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
