2009-01-15 15:48:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This scripts will:
|
|
|
|
# 1. create a dist package for current subproject
|
|
|
|
# 2. update the APKBUILD and build the package
|
|
|
|
# 3. build the alpine iso
|
|
|
|
#
|
|
|
|
# The following is assumed from the subproject:
|
|
|
|
# * that PACKAGE and VERSION is set in Makefile or defined in a local
|
|
|
|
# devbuild.conf file
|
|
|
|
# * that 'make dist' will generate a valid dist package
|
|
|
|
#
|
|
|
|
|
|
|
|
program=${0##*/}
|
|
|
|
|
|
|
|
# rebuild env. Those values can be overridden in either
|
2009-01-15 16:09:38 +00:00
|
|
|
# /etc/devbuildrc or $HOME/.devbuildrc
|
2009-01-15 15:48:16 +00:00
|
|
|
DISTFILES=/var/cache/distfiles
|
|
|
|
APORTS_DIR=$HOME/aports
|
|
|
|
ALPINE_DIR=$HOME/abuild
|
|
|
|
|
|
|
|
# for the local project. Those values can be overridden by
|
2009-01-15 16:09:38 +00:00
|
|
|
# a .devbuildrc in the subprojects dir
|
2009-01-15 15:48:16 +00:00
|
|
|
PACKAGE=$(grep '^PACKAGE' Makefile | sed 's/.*=[[:blank:]]*//')
|
|
|
|
VERSION=$(grep '^VERSION' Makefile | sed 's/.*=[[:blank:]]*//')
|
|
|
|
SUFFIX=.tar.bz2
|
|
|
|
REPO=core
|
|
|
|
|
|
|
|
# let user override the above defaults
|
2009-01-15 16:09:38 +00:00
|
|
|
for i in /etc/${program}rc $HOME/.${program}rc ./.${program}rc; do
|
2009-01-15 15:48:16 +00:00
|
|
|
if [ -f $i ]; then
|
|
|
|
. $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# generate a new dist package
|
|
|
|
tarball=${PACKAGE}-${VERSION}${SUFFIX}
|
|
|
|
make dist || exit 1
|
|
|
|
cp $tarball "$DISTFILES/" || exit 1
|
|
|
|
|
|
|
|
# update the APKBUILD, in a subshell
|
|
|
|
(
|
|
|
|
cd $APORTS_DIR/$REPO/$PACKAGE || exit 1
|
|
|
|
. ./APKBUILD
|
|
|
|
if [ "$pkgver" = "$VERSION" ]; then
|
|
|
|
pkgrel=$(( $pkgrel + 1 ))
|
|
|
|
else
|
|
|
|
pkgrel="0"
|
|
|
|
fi
|
|
|
|
sed -i -e " s/^pkgver=.*/pkgver=$VERSION/;
|
|
|
|
s/^pkgrel=.*/pkgrel=$pkgrel/;
|
|
|
|
/^md5sums=\"/,/\"\$/d" APKBUILD || exit 1
|
|
|
|
export SRCDEST="$DISTFILES"
|
|
|
|
abuild checksum >>APKBUILD
|
|
|
|
abuild
|
|
|
|
abuild cleanoldpkg
|
|
|
|
) || exit 1
|
|
|
|
|
|
|
|
# rebuild the iso
|
|
|
|
cd "$ALPINE_DIR" && fakeroot ./mkalpine
|
|
|
|
|