-
Notifications
You must be signed in to change notification settings - Fork 185
/
build-pkg
104 lines (90 loc) · 2.61 KB
/
build-pkg
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# binary package specific functions for the build script
#
################################################################
#
# Copyright (c) 1995-2014 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (see the file COPYING); if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
################################################################
for i in rpm deb arch ; do
. "$BUILD_DIR/build-pkg-$i"
done
pkg_initdb() {
pkg_initdb_$PSUF "$@"
}
pkg_prepare() {
pkg_prepare_$PSUF "$@"
}
pkg_install() {
pkg_install_$PSUF "$@"
}
pkg_sysrootinstall() {
pkg_sysrootinstall_$PSUF "$@"
}
pkg_verify_installed() {
pkg_verify_installed_$PSUF "$@"
}
pkg_erase() {
pkg_erase_$PSUF "$@"
}
pkg_cumulate() {
pkg_cumulate_$PSUF "$@"
}
pkg_finalize() {
pkg_finalize_$PSUF "$@"
}
pkg_preinstall() {
pkg_preinstall_$PSUF "$@"
}
pkg_runscripts() {
pkg_runscripts_$PSUF "$@"
}
pkg_autodetect_type() {
if test -n "$PREINSTALL_IMAGE" ; then
cleanup_and_exit 1 "cannot autodetect build type when using a preinstall image"
fi
PSUF=
test -e $BUILD_ROOT/.init_b_cache/rpms/rpm.rpm && PSUF=rpm
test -e $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb && PSUF=deb
test -e $BUILD_ROOT/.init_b_cache/rpms/pacman.arch && PSUF=arch
if test -z "$PSUF" ; then
cleanup_and_exit 1 "could not autodetect package type"
fi
}
pkg_set_type() {
PSUF=`queryconfig binarytype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
test "$PSUF" = UNDEFINED && PSUF=
case "$PSUF" in
rpm|deb|arch)
;;
'')
pkg_autodetect_type
;;
*)
cleanup_and_exit 1 "unknown package type '$PSUF'"
;;
esac
}
pkg_finalize_sysroot() {
# fix absolute links to take sysroot into account
if test -n "$BUILD_SYSROOT" -a -d "$BUILD_ROOT/$BUILD_SYSROOT" ; then
chroot "$BUILD_ROOT" find "$BUILD_SYSROOT" -type l -lname '/*' | while read link; do
linktarget="$(chroot $BUILD_ROOT readlink "$link")"
ln -sf "$BUILD_SYSROOT$linktarget" "$BUILD_ROOT/$link"
done
fi
}