update tizen version to tizen20231130
[tools/build.git] / livebuild_pre_run.template
1 #!/bin/bash
2 #
3 # This is a template for a livebuild_pre_run script. These scripts are
4 # executed by build_livebuild.sh in the chroot environment.
5 #
6
7 ################################################################
8 #
9 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2 or 3 as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program (see the file COPYING); if not, write to the
22 # Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 #
25 ################################################################
26
27 fix_debootstrap()
28 {
29     # debootstrap in Debian 7.0 does not like dash
30
31     if [ -x /usr/sbin/debootstrap ] ; then
32         sed -i 's|^#!/bin/sh|#!/bin/bash|' /usr/sbin/debootstrap
33     fi
34 }
35
36 fix_lb_bootstrap_archive-keys()
37 {
38     if [ -e /usr/lib/live/build/bootstrap_archive-keys ] ; then
39         sed -i '/apt-get update/{ s/^/#/ }' \
40             /usr/lib/live/build/bootstrap_archive-keys
41     fi
42 }
43
44 #
45 # main
46 #
47
48 : ${TOPDIR:=/usr/src/packages}
49
50 # Distribution and live-build specific hooks
51 fix_debootstrap
52 fix_lb_bootstrap_archive-keys
53
54 # Expand configuration based on defaults
55 cd $TOPDIR/LIVEBUILD_ROOT && lb config || exit 1
56
57 # Replace all occurances of LB_MIRROR with local repository
58 sed -i "s|^\(LB_MIRROR_[^=]\+=\).*|\1\"file:$TOPDIR/SOURCES/repos/\"|" \
59     $TOPDIR/LIVEBUILD_ROOT/config/bootstrap
60 sed -i "s|^\(LB_PARENT_MIRROR_[^=]\+=\).*|\1\"file:$TOPDIR/SOURCES/repos/\"|" \
61     $TOPDIR/LIVEBUILD_ROOT/config/bootstrap
62
63 # Prevent debootstrap from cleaning our cache
64 sed -i 's|^\(LB_CACHE_PACKAGES=\).*|\1"false"|' \
65     $TOPDIR/LIVEBUILD_ROOT/config/common
66
67 # Disable GPG checking
68 sed -i 's|^\(LB_APT_SECURE=\).*|\1"false"|' \
69     $TOPDIR/LIVEBUILD_ROOT/config/common