update tizen version to tizen20231130
[tools/build.git] / build-recipe-preinstallimage
1 #
2 # preinstall specific functions.
3 #
4 ################################################################
5 #
6 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2 or 3 as
10 # published by the Free Software Foundation.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program (see the file COPYING); if not, write to the
19 # Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 #
22 ################################################################
23
24 recipe_setup_preinstallimage() {
25     # should never be called
26     cleanup_and_exit 1
27 }
28
29 recipe_prepare_preinstallimage() {
30     :
31 }
32
33 recipe_build_preinstallimage() {
34     echo "creating preinstall image..."
35     test -d "$BUILD_ROOT/.preinstall_image" || cleanup_and_exit 1
36     cd $BUILD_ROOT || cleanup_and_exit 1
37     TAR="tar"
38     if test -x /usr/bin/bsdtar; then
39         TAR="/usr/bin/bsdtar --format gnutar --chroot"
40     fi
41     TOPDIRS=
42     for DIR  in .* * ; do
43       case "$DIR" in
44         .|..) continue ;;
45         .build.kernel*) ;; # to be packaged
46         .build.initrd*) ;; # to be packaged
47         .build*) continue ;;
48         .preinstallimage*) continue ;;
49         .srcfiles*) continue ;;
50         .pkgs) continue ;;
51         .rpm-cache) continue ;;
52         installed-pkg) continue ;;
53         proc|sys) continue ;;
54       esac
55       TOPDIRS="$TOPDIRS $DIR"
56     done
57     if ! $TAR -czf .preinstallimage.$$.tar.gz --one-file-system $TOPDIRS ; then
58         cleanup_and_exit 1
59     fi
60     echo "image created."
61     TOPDIR=/usr/src/packages
62     mkdir -p $BUILD_ROOT$TOPDIR/OTHER
63     rm -f $BUILD_ROOT$TOPDIR/OTHER/preinstallimage.info
64     for PKG in $BUILD_ROOT/.preinstall_image/* ; do
65         PKG=${PKG##*/}
66         read PKG_HDRMD5 PKGID < $BUILD_ROOT/.preinstall_image/$PKG
67         test -n "$PKG_HDRMD5" || cleanup_and_exit 1
68         echo "$PKG_HDRMD5  $PKG" >> $BUILD_ROOT$TOPDIR/OTHER/preinstallimage.info
69     done
70     mv $BUILD_ROOT/.preinstallimage.$$.tar.gz $BUILD_ROOT$TOPDIR/OTHER/preinstallimage.tar.gz
71     rm -f $BUILD_ROOT/.build.packages
72     ln -s ${TOPDIR#/} $BUILD_ROOT/.build.packages
73     test -d "$SRCDIR" && cd "$SRCDIR"
74 }
75
76 recipe_resultdirs_preinstallimage() {
77     :
78 }
79