forked from aspiers/containment-rpm
-
Notifications
You must be signed in to change notification settings - Fork 4
/
kiwi_post_run
38 lines (29 loc) · 974 Bytes
/
kiwi_post_run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh -eu
: ${TOPDIR:=/usr/src/packages}
TARGET_DIR=$TOPDIR/KIWI-vmx/
RPM_SOURCE_DIR=$TOPDIR/SOURCES
FILES_DIR=/usr/lib/build
cd $TARGET_DIR
STEM=Containment-Studio
EXT=.qcow2
SOURCE=$(echo $STEM-*$EXT)
# extract os/platform, version, release from the source tarball
set -- $(echo $SOURCE | sed -r "s/(.*)-(.*)$EXT/\1 \2/")
NAME=$(echo $1 | sed -r "s/.x86_64//g")
VERSION=$2
RELEASE=$(date +%Y%m%d%H%M%S)
echo "name $NAME"
echo "version $VERSION"
echo "release $RELEASE"
sed -e "s/__NAME__/$NAME/g" \
-e "s/__VERSION__/$VERSION/g" \
-e "s/__RELEASE__/$RELEASE/g" \
-e "s/__SOURCE__/$SOURCE/g" \
< $FILES_DIR/image.spec.in \
> $FILES_DIR/image.spec
tar -cjf $RPM_SOURCE_DIR/$NAME-$VERSION-$RELEASE-vmx.tar.bz2 $SOURCE
rpmbuild -ba $FILES_DIR/image.spec
# required for the BS to find the rpm, because it is
# a "non-standard result file for KIWI"
mkdir -p $TOPDIR/OTHER
mv $TOPDIR/RPMS/noarch/$NAME-$VERSION-$RELEASE.noarch.rpm $TOPDIR/OTHER/