cryptonas/scripts/debian

54 lines
1.4 KiB
Bash

#!/bin/sh
#
# Copyright (c) 02005 sense.lab <senselab@systemausfall.org>
#
# License: This script is distributed under the terms of version 2
# of the GNU GPL. See the LICENSE file included with the package.
#
# $Id: cbox-build.sh 336 2005-11-29 22:28:28Z lars $
#
# build a debian package
#
set -ue
# include common functions and settings
source $(dirname $0)/common.sh.inc
######### some settings ###########
DEB_BUILD_DIR=/tmp/cryptobox-debian-$$
[ -e "$DEB_BUILD_DIR" ] && rm -rf "$DEB_BUILD_DIR"
DEB_ROOT_DIR=$TEMPLATE_DIR
DEB_CONTROL_DIR=$ROOT_DIR/DEBIAN
DEB_PACKAGE_DIR=$ROOT_DIR/packages
############# do it ###############
ACTION=build
[ $# -gt 0 ] && ACTION=$1 && shift
case "$ACTION" in
build )
# check for uid=0 (necessary for building)
[ "$(id -u)" -ne 0 ] && echo "this script ($0) has to be called as root" >&2 && exit 1
svn export "$DEB_ROOT_DIR" "$DEB_BUILD_DIR"
svn export "$DEB_CONTROL_DIR" "$DEB_BUILD_DIR/DEBIAN"
chown -R root. "$DEB_BUILD_DIR/usr/share/doc/"
dpkg-deb --build "$DEB_BUILD_DIR" "$DEB_PACKAGE_DIR"
rm -rf "$DEB_BUILD_DIR"
;;
check )
PACKAGE_FILE=$(find "$DEB_PACKAGE_DIR" -type f -name "cryptobox*" | grep "\.deb$" | sort -n | tail -1)
if [ -z "$PACKAGE_FILE" ]
then echo "no debian package found in $DEB_PACKAGE_DIR"
else lintian "$PACKAGE_FILE"
fi
;;
* )
echo "Syntax: $(basename $0) [ build | check help ]"
echo
;;
esac