blob: 93209e98521fe5bd5d875fb4ce21ece642cdbbed (
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#!/bin/bash
#
# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwebel@pengutronix.de>
# 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
#
# 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.
#
#
# -p PACKET
#
ptxd_make_install_init() {
. ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return
ptxd_make_xpkg_init || return
local opt
while getopts "p:t:" opt; do
case "${opt}" in
p)
local packet="${OPTARG}"
;;
t)
local target="${OPTARG##*/}"
target="${target%%.targetinstall*}"
;;
*)
return 1
;;
esac
done
if [ -z "${packet}" ]; then
echo
echo "Error: empty parameter to 'install_init()'"
echo
return 1
fi
echo "install_init: preparing for image creation..."
rm -fr -- \
"${pkg_xpkg_tmp}" \
"${pkg_xpkg_cmds}" \
"${pkg_xpkg_perms}" \
"${pkg_xpkg_install_deps}" &&
mkdir -p -- "${pkg_ipkg_control_dir}" &&
touch "${pkg_xpkg_cmds}" || return
local replace_from="ARCH"
local replace_to="${PTXDIST_IPKG_ARCH_STRING}"
echo -n "install_init: @${replace_from}@ -> ${replace_to} ... "
sed -e "s,@${replace_from}@,${replace_to},g" "${RULESDIR}/default.ipkg" > \
"${pkg_ipkg_control}" || return
echo "done"
local script rd found
for script in \
preinst postinst prerm postrm; do
echo -n "install_init: ${script} "
unset found
for rd in \
"${PROJECTRULESDIR}" "${RULESDIR}"; do
local abs_script="${rd}/${packet}.${script}"
if [ -f "${abs_script}" ]; then
install -m 0755 \
-D "${abs_script}" \
"${pkg_ipkg_control_dir}/${script}" || return
echo "packaging: '${abs_script}'"
if [ "${script}" = "preinst" ]; then
echo "install_init: executing '${abs_script}'"
DESTDIR="${ROOTDIR}" /bin/sh "${abs_script}" || return
fi
found=true
break
fi
done
if [ -z "${found}" ]; then
echo "not available"
fi
done
}
export -f ptxd_make_install_init
#
#
#
ptxd_make_install_fixup() {
. ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return
ptxd_make_xpkg_init || return
local opt
while getopts "p:f:t:s:" opt; do
case "${opt}" in
p)
local packet="${OPTARG}"
;;
f)
local replace_from="${OPTARG}"
;;
t)
local replace_to="${OPTARG}"
;;
s)
local target="${OPTARG##*/}"
target="${target%%.targetinstall*}"
;;
*)
return 1
;;
esac
done
if [ -z "${packet}" ]; then
echo
echo "Error: empty parameter to 'install_fixup()'"
echo
return 1
fi
case "${replace_from}" in
AUTHOR)
replace_to="`echo ${replace_to} | sed -e 's/\([^\\]\)@/\1\\\@/g'`"
;;
PACKAGE)
replace_to="`echo ${replace_to} | sed -e 's/_/-/g'`"
#
# track "pkg name" to "xpkg filename"
#
if [ -e "${pkg_xpkg_map}" ]; then
sed -i -e "/^${replace_to}$/d" "${pkg_xpkg_map}" &&
if [ -s "${pkg_xpkg_map}" ]; then
cat >&2 <<EOF
${PREFIX}warning: more than one ipkg per PTXdist package detected:
pkg: '${target}'
ipkg: '${replace_to}' and '$(cat "${pkg_xpkg_map}")'
EOF
fi
fi &&
echo "${replace_to}" >> "${pkg_xpkg_map}" || return
;;
VERSION)
replace_to="${replace_to//[-_]/.}${PTXCONF_PROJECT_BUILD//[-_]/.}"
;;
DEPENDS)
return
;;
esac
echo -n "install_fixup: @${replace_from}@ -> ${replace_to} ... "
sed -i -e "s,@$replace_from@,$replace_to,g" "${pkg_ipkg_control}" || return
echo "done."
}
export -f ptxd_make_install_fixup
|