projects/aports·blob v2.0_rc8 · refs

61 lines · 1.5 KiB

1#!/bin/sh
2
3# This scripts will:
4# 1. create a dist package for current subproject
5# 2. update the APKBUILD and build the package
6# 3. build the alpine iso
7#
8# The following is assumed from the subproject:
9# * that PACKAGE and VERSION is set in Makefile or defined in a local
10# devbuild.conf file
11# * that 'make dist' will generate a valid dist package
12#
13
14program=${0##*/}
15
16# rebuild env. Those values can be overridden in either
17# /etc/devbuildrc or $HOME/.devbuildrc
18DISTFILES=/var/cache/distfiles
19APORTS_DIR=$HOME/aports
20ALPINE_DIR=$HOME/abuild
21
22# for the local project. Those values can be overridden by
23# a .devbuildrc in the subprojects dir
24PACKAGE=$(grep '^PACKAGE' Makefile | sed 's/.*=[[:blank:]]*//')
25VERSION=$(grep '^VERSION' Makefile | sed 's/.*=[[:blank:]]*//')
26SUFFIX=.tar.bz2
27REPO=core
28
29# let user override the above defaults
30for i in /etc/${program}rc $HOME/.${program}rc ./.${program}rc; do
31 if [ -f $i ]; then
32 . $i
33 fi
34done
35
36# generate a new dist package
37tarball=${PACKAGE}-${VERSION}${SUFFIX}
38make dist || exit 1
39cp $tarball "$DISTFILES/" || exit 1
40
41# update the APKBUILD, in a subshell
42(
43 cd $APORTS_DIR/$REPO/$PACKAGE || exit 1
44 . ./APKBUILD
45 if [ "$pkgver" = "$VERSION" ]; then
46 pkgrel=$(( $pkgrel + 1 ))
47 else
48 pkgrel="0"
49 fi
50 sed -i -e " s/^pkgver=.*/pkgver=$VERSION/;
51 s/^pkgrel=.*/pkgrel=$pkgrel/;
52 /^md5sums=\"/,/\"\$/d" APKBUILD || exit 1
53 export SRCDEST="$DISTFILES"
54 abuild checksum
55 abuild
56 abuild cleanoldpkg
57) || exit 1
58
59# rebuild the iso
60cd "$ALPINE_DIR" && fakeroot ./mkalpine
61