blob: fea6fdb9346dc721587e56efa12e00ecc1029672 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
recipe_setup_simpleimage() {
TOPDIR=/usr/src/packages
rm -rf "$BUILD_ROOT$TOPDIR"
for i in OTHER SOURCES LIVEBUILD_ROOT ; do
mkdir -p "$BUILD_ROOT$TOPDIR/$i"
done
chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
else
cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
fi
}
recipe_prepare_simpleimage() {
BUILD_USER="root"
}
recipe_build_simpleimage() {
TOPDIR=/usr/src/packages
echo "creating simple image..."
cd $BUILD_ROOT || cleanup_and_exit 1
export SRCDIR="$TOPDIR/SOURCES"
NAME="`sed -n 's|Name:[[:blank:]]*||p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`"
[ -n "$NAME" ] || NAME="simpleimage"
VERSION="`sed -n 's|Version:[[:blank:]]*||p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`"
[ -n "$VERSION" ] || VERSION="`date -u +%y.%m.%d-%H.%M.%S`"
SHELL="/bin/sh"
[ -x $BUILD_ROOT/bin/bash ] && SHELL="/bin/bash"
if [ "`grep '^%build$' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`" ]; then
echo "Running integration script..."
sed -n '/%build/,$ p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage | tail -n +2 | chroot $BUILD_ROOT $SHELL -x || cleanup_and_exit 1
echo "Integration script finished."
fi
echo "Compresing the final image, this can take a while..."
echo
TAR="tar"
if test -x /usr/bin/bsdtar; then
TAR="/usr/bin/bsdtar --format gnutar --chroot"
fi
TOPDIRS=
for DIR in .* * ; do
case "$DIR" in
.|..) continue ;;
.build*) continue ;;
.simpleimage*) continue ;;
.srcfiles*) continue ;;
.pkgs) continue ;;
.rpm-cache) continue ;;
.tmp) continue ;;
installed-pkg) continue ;;
proc|sys) continue ;;
esac
TOPDIRS="$TOPDIRS $DIR"
done
rm -rf "$BUILD_ROOT$TOPDIR"
mkdir -p .tmp/{proc,sys}
if ! $TAR -cvzf .simpleimage.tar.gz --one-file-system $TOPDIRS -C .tmp proc sys; then
cleanup_and_exit 1
fi
if [ -x "`which mksquashfs 2> /dev/null`" ]; then
echo
echo "Tarball done, creating squashfs image as well"
echo
mksquashfs $TOPDIRS .tmp/proc .tmp/sys .simpleimage.squashfs -info -keep-as-directory -no-progress || cleanup_and_exit 1
fi
echo "simple image created."
DEST="$BUILD_ROOT$TOPDIR/OTHER"
mkdir -p "$DEST"
mv $BUILD_ROOT/.simpleimage.tar.gz $DEST/$NAME-${VERSION}_${BUILD_ARCH%%:*}.tar.gz
if [ -r .simpleimage.squashfs ]; then
mv $BUILD_ROOT/.simpleimage.squashfs $DEST/$NAME-${VERSION}_${BUILD_ARCH%%:*}.squashfs
fi
rm -f $BUILD_ROOT/.build.packages
ln -s ${TOPDIR#/} $BUILD_ROOT/.build.packages
test -d "$SRCDIR" && cd "$SRCDIR"
cleanup_and_exit 0
}
recipe_resultdirs_simpleimage() {
:
}
|