102 |
return ${retval} |
return ${retval} |
103 |
} |
} |
104 |
|
|
105 |
|
unpack_package() |
106 |
|
{ |
107 |
|
local magefile="$1" |
108 |
|
local pkg |
109 |
|
local pkgtype |
110 |
|
local tar_opts |
111 |
|
|
112 |
|
pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" |
113 |
|
pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" |
114 |
|
|
115 |
|
xtitle "[ Unpacking ${pkg} ]" |
116 |
|
|
117 |
|
# abort on virtual pkg |
118 |
|
if [[ ${pkgtype} = virtual ]] |
119 |
|
then |
120 |
|
echo -ne " ${COLBLUE}---${COLDEFAULT}" |
121 |
|
echo " !unpack virtual ${pkg/.${PKGSUFFIX}/} ... " |
122 |
|
continue |
123 |
|
fi |
124 |
|
|
125 |
|
# abort on sources pkg |
126 |
|
if [[ ${pkgtype} = sources ]] |
127 |
|
then |
128 |
|
echo -ne " ${COLBLUE}---${COLDEFAULT}" |
129 |
|
echo " !unpack sources ${pkg/.${PKGSUFFIX}/} ... " |
130 |
|
continue |
131 |
|
fi |
132 |
|
|
133 |
|
# busybox? |
134 |
|
if need_busybox_support tar |
135 |
|
then |
136 |
|
tar_opts="xjf" |
137 |
|
else |
138 |
|
tar_opts="xjmf" |
139 |
|
fi |
140 |
|
|
141 |
|
echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkg} ... " |
142 |
|
tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}" |
143 |
|
} |
144 |
|
|
145 |
unpack_packages() |
unpack_packages() |
146 |
{ |
{ |
147 |
local list="$@" |
local list="$@" |
148 |
local magefile |
local magefile |
|
local pkg |
|
|
local pkgtype |
|
149 |
local count_current |
local count_current |
150 |
local count_total |
local count_total |
151 |
local tar_opts |
local tar_opts |
158 |
|
|
159 |
for magefile in ${list} |
for magefile in ${list} |
160 |
do |
do |
161 |
pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" |
unpack_package "${magefile}" |
|
pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" |
|
|
|
|
162 |
(( count_current++ )) |
(( count_current++ )) |
|
xtitle "[ (${count_current}/${count_total}) Unpacking ${pkg} ]" |
|
|
|
|
|
# abort on virtual pkg |
|
|
if [[ ${pkgtype} = virtual ]] |
|
|
then |
|
|
echo -ne " ${COLBLUE}---${COLDEFAULT}" |
|
|
echo " !unpack virtual (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " |
|
|
continue |
|
|
fi |
|
|
|
|
|
# abort on sources pkg |
|
|
if [[ ${pkgtype} = sources ]] |
|
|
then |
|
|
echo -ne " ${COLBLUE}---${COLDEFAULT}" |
|
|
echo " !unpack sources (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " |
|
|
continue |
|
|
fi |
|
|
|
|
|
# busybox? |
|
|
if need_busybox_support tar |
|
|
then |
|
|
tar_opts="xjf" |
|
|
else |
|
|
tar_opts="xjmf" |
|
|
fi |
|
|
|
|
|
echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... " |
|
|
tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}" |
|
163 |
done |
done |
164 |
|
|
165 |
# add a crlf for a better view |
# add a crlf for a better view |
1613 |
then |
then |
1614 |
if ! mcheckemptydir ${MAGEDIR} |
if ! mcheckemptydir ${MAGEDIR} |
1615 |
then |
then |
1616 |
find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r |
find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xargs --no-run-if-empty rm -r |
1617 |
fi |
fi |
1618 |
else |
else |
1619 |
rm -rf ${MAGEDIR} |
rm -rf ${MAGEDIR} |
1895 |
count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')" |
count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')" |
1896 |
done |
done |
1897 |
|
|
1898 |
# dirty hack to convert 0001 -> 1; 0120 -> 120 etc |
# convert 0001 -> 1; 0120 -> 120 etc |
1899 |
x="${#count}" |
# use bash internal base functions to this task |
1900 |
|
x="$((10#${count}))" |
1901 |
for (( i=0; i<x; i++ )) |
for (( i=0; i<x; i++ )) |
1902 |
do |
do |
1903 |
if [[ ${count:${i}:1} != 0 ]] |
if [[ ${count:${i}:1} != 0 ]] |
1907 |
fi |
fi |
1908 |
done |
done |
1909 |
|
|
1910 |
count="${count}+1" |
count="$(( ${count}+1 ))" |
1911 |
|
|
1912 |
# fill output up with zeros |
# fill output up with zeros |
1913 |
for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done |
for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done |
2697 |
if [[ ${PKGTYPE} != virtual ]] && \ |
if [[ ${PKGTYPE} != virtual ]] && \ |
2698 |
[[ ${PKGTYPE} != sources ]] |
[[ ${PKGTYPE} != sources ]] |
2699 |
then |
then |
2700 |
|
unpack_package "${magefile}" |
2701 |
echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " |
echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " |
2702 |
build_doinstall ${PKGNAME} |
build_doinstall ${PKGNAME} |
2703 |
fi |
fi |
3129 |
"") continue;; |
"") continue;; |
3130 |
esac |
esac |
3131 |
|
|
3132 |
deps="${deps} $(basename ${dep%-*})" |
if [[ -z ${deps} ]] |
3133 |
|
then |
3134 |
|
deps="$(basename ${dep%-*})" |
3135 |
|
else |
3136 |
|
deps="${deps} $(basename ${dep%-*})" |
3137 |
|
fi |
3138 |
done << EOF |
done << EOF |
3139 |
${depsfull} |
${depsfull} |
3140 |
EOF |
EOF |
3145 |
"") continue;; |
"") continue;; |
3146 |
esac |
esac |
3147 |
|
|
3148 |
sdeps="${sdeps} $(basename ${dep%-*})" |
if [[ -z ${sdeps} ]] |
3149 |
|
then |
3150 |
|
sdeps="$(basename ${dep%-*})" |
3151 |
|
else |
3152 |
|
sdeps="${sdeps} $(basename ${dep%-*})" |
3153 |
|
fi |
3154 |
done << EOF |
done << EOF |
3155 |
${sdepsfull} |
${sdepsfull} |
3156 |
EOF |
EOF |
3164 |
then |
then |
3165 |
echo " License: ${license}" |
echo " License: ${license}" |
3166 |
fi |
fi |
3167 |
echo " Depends: ${deps}" |
echo " Depends: ${deps}" |
3168 |
echo " SDepends: ${sdeps}" |
echo " SDepends: ${sdeps}" |
3169 |
echo |
echo |
3170 |
|
|
3281 |
need_busybox_support() |
need_busybox_support() |
3282 |
{ |
{ |
3283 |
local cmd |
local cmd |
3284 |
|
local busybox |
3285 |
cmd="$1" |
cmd="$1" |
3286 |
|
|
3287 |
if [[ -x /bin/busybox ]] |
for busybox in {,/usr}/bin/busybox |
3288 |
then |
do |
3289 |
if [[ $(readlink $(which ${cmd})) = /bin/busybox ]] |
if [[ -x ${busybox} ]] |
3290 |
then |
then |
3291 |
# needs busybox support |
if [[ $(readlink $(type -P ${cmd})) = ${busybox} ]] |
3292 |
return 0 |
then |
3293 |
|
# needs busybox support |
3294 |
|
return 0 |
3295 |
|
fi |
3296 |
fi |
fi |
3297 |
fi |
done |
3298 |
|
|
3299 |
# no busybox |
# no busybox |
3300 |
return 1 |
return 1 |
3351 |
{ |
{ |
3352 |
local feature="$1" |
local feature="$1" |
3353 |
local retval |
local retval |
3354 |
|
|
3355 |
case "${feature}" in |
case "${feature}" in |
3356 |
autosvc|!autosvc) retval=0 ;; |
autosvc|!autosvc) retval=0 ;; |
3357 |
buildlog|!buildlog) retval=0 ;; |
buildlog|!buildlog) retval=0 ;; |
3360 |
compressdoc|!compressdoc) retval=0 ;; |
compressdoc|!compressdoc) retval=0 ;; |
3361 |
debug|!debug) retval=0 ;; |
debug|!debug) retval=0 ;; |
3362 |
distcc|!distcc) retval=0 ;; |
distcc|!distcc) retval=0 ;; |
3363 |
|
icecc|!icecc) retval=0 ;; |
3364 |
kernelsrcunpack|!kernelsrcunpack) retval=0 ;; |
kernelsrcunpack|!kernelsrcunpack) retval=0 ;; |
3365 |
libtool|!libtool) retval=0 ;; |
libtool|!libtool) retval=0 ;; |
3366 |
linuxsymlink|!linuxsymlink) retval=0 ;; |
linuxsymlink|!linuxsymlink) retval=0 ;; |
3466 |
|
|
3467 |
mprintfeatures() |
mprintfeatures() |
3468 |
{ |
{ |
3469 |
echo "Global features: ${MAGE_FEATURES_GLOBAL[*]}" |
echo -e "${COLRED}Global features:${COLDEFAULT} ${MAGE_FEATURES_GLOBAL[*]}" |
3470 |
echo "Local features: ${MAGE_FEATURES[*]}" |
echo -e "${COLYELLOW}Local features:${COLDEFAULT} ${MAGE_FEATURES[*]}" |
3471 |
echo "Current features: ${MAGE_FEATURES_CURRENT[*]}" |
echo -e "${COLGREEN}Current features:${COLDEFAULT} ${MAGE_FEATURES_CURRENT[*]}" |
3472 |
} |
} |