blob: ee8331db00f51f5c7cba850ae3b66f8698134f8c (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
|
#!/bin/bash
#
# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwebel@pengutronix.de>
# 2008, 2009, 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
# 2011 by George McCollister <george.mccollister@gmail.com>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#
#
# collect dependencies
#
# in some rare cases there is more than one xpkg per package and/or
# the names don't correspond, so we have to use the mapping file
#
# in: $pkg_run_deps (space seperated)
# out: $pkg_xpkg_deps (array)
#
ptxd_make_xpkg_deps() {
# do deps
if [ -z "${pkg_run_deps}" ]; then
return
fi
set -- ${pkg_run_deps[*]}
local dep
while [ ${#} -ne 0 ]; do
local map="${ptx_state_dir}/${1}.xpkg.map"
shift
if [ \! -e "${map}" ]; then
continue
fi
while read dep; do
pkg_xpkg_deps=( "${pkg_xpkg_deps[@]}" "${dep}" )
done < "${map}"
done
}
export -f ptxd_make_xpkg_deps
#
#
ptxd_make_xpkg_prepare() {
local dep
ptxd_make_xpkg_init || return
echo "install_init: preparing for image creation of '${pkg_xpkg}'..."
rm -fr -- \
"${pkg_xpkg_tmp}" \
"${pkg_xpkg_cmds}" \
"${pkg_xpkg_perms}" \
"${pkg_xpkg_install_deps}" &&
mkdir -p -- "${pkg_xpkg_control_dir}" &&
touch "${pkg_xpkg_cmds}" || return
ptxd_make_xpkg_deps || return
# replace space with ", "
dep="${pkg_xpkg_deps[*]}"
dep="${dep// /, }"
#
# replace ARCH PACKAGE, VERSION and DEPENDS in control file
#
echo -e "\
install_init: @ARCH@ -> ${PTXDIST_IPKG_ARCH_STRING}
install_init: @PACKAGE@ -> ${pkg_xpkg}
install_init: @VERSION@ -> ${pkg_xpkg_version}
install_init: @DEPENDS@ -> ${dep}"
ARCH="${PTXDIST_IPKG_ARCH_STRING}" \
PACKAGE="${pkg_xpkg}" \
VERSION="${pkg_xpkg_version}" \
DEPENDS="${dep}" \
ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \
"${pkg_xpkg_control}" || return
local script
for script in preinst postinst prerm postrm; do
echo -n "install_init: ${script} "
if ptxd_in_path PTXDIST_PATH_RULES "${pkg_xpkg}.${script}"; then
install -m 0755 \
-D "${ptxd_reply}" \
"${pkg_xpkg_control_dir}/${script}" || return
echo "packaging: '$(ptxd_print_path "${ptxd_reply}")'"
else
echo "not available"
fi
done
}
export -f ptxd_make_xpkg_prepare
|