38 |
return 0 |
return 0 |
39 |
} |
} |
40 |
|
|
41 |
|
mchecksum() |
42 |
|
{ |
43 |
|
local i |
44 |
|
local rundir |
45 |
|
local file |
46 |
|
local method |
47 |
|
local cmd |
48 |
|
local retval |
49 |
|
|
50 |
|
# very basic getops |
51 |
|
for i in $* |
52 |
|
do |
53 |
|
case $1 in |
54 |
|
--rundir|-r) shift; rundir="$1" ;; |
55 |
|
--file|-f) shift; file="$1" ;; |
56 |
|
--method|-m) shift; method="$1" ;; |
57 |
|
esac |
58 |
|
shift |
59 |
|
done |
60 |
|
|
61 |
|
# sanity checks |
62 |
|
[[ -z ${rundir} ]] && die "mchecksum(): rundir missing" |
63 |
|
[[ -z ${file} ]] && die "mchecksum(): file missing" |
64 |
|
[[ -z ${method} ]] && die "mchecksum(): method missing" |
65 |
|
|
66 |
|
case ${method} in |
67 |
|
md5) cmd="md5sum" ;; |
68 |
|
sha256) cmd="sha256sum" ;; |
69 |
|
*) die "mchecksum(): unknown method '${method}'" ;; |
70 |
|
esac |
71 |
|
|
72 |
|
if [[ -d ${rundir} ]] |
73 |
|
then |
74 |
|
pushd ${rundir} &> /dev/null |
75 |
|
${cmd} -c ${file} &> /dev/null |
76 |
|
retval="$?" |
77 |
|
popd &> /dev/null |
78 |
|
else |
79 |
|
retval=1 |
80 |
|
fi |
81 |
|
|
82 |
|
return "${retval}" |
83 |
|
} |
84 |
|
|
85 |
unpack_packages() |
unpack_packages() |
86 |
{ |
{ |
87 |
local list="$@" |
local list="$@" |
206 |
while read pathto posix user group |
while read pathto posix user group |
207 |
do |
do |
208 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
209 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> DIR: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> DIR: ${MROOT}${pathto}" |
210 |
|
|
211 |
# monitors /etc/env.d -> env-rebuild |
# monitors /etc/env.d -> env-rebuild |
212 |
[[ ${pathto} = /etc/env.d ]] && export MAGE_ENV_REBUILD=true |
[[ ${pathto} = /etc/env.d ]] && export MAGE_ENV_REBUILD=true |
282 |
case ${retval} in |
case ${retval} in |
283 |
# file is not protected - (over)write it |
# file is not protected - (over)write it |
284 |
0|3) |
0|3) |
285 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> FILE: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> FILE: ${MROOT}${pathto}" |
286 |
install -m "${posix}" -o "${user}" -g "${group}" \ |
install -m "${posix}" -o "${user}" -g "${group}" \ |
287 |
${BUILDDIR}/${pkgname}/binfiles/"${pathto}" \ |
${BUILDDIR}/${pkgname}/binfiles/"${pathto}" \ |
288 |
"${MROOT}${pathto}" |
"${MROOT}${pathto}" |
300 |
|
|
301 |
# file is protected, write backup file |
# file is protected, write backup file |
302 |
2) |
2) |
303 |
if [[ ${VERBOSE} = on ]] |
if mqueryfeature "verbose" |
304 |
then |
then |
305 |
echo -en "${COLRED}" |
echo -en "${COLRED}" |
306 |
echo -n "! prot " |
echo -n "! prot " |
331 |
|
|
332 |
# file is protected but ignored, delete the update/do nothing |
# file is protected but ignored, delete the update/do nothing |
333 |
4) |
4) |
334 |
if [[ ${VERBOSE} = on ]] |
if mqueryfeature "verbose" |
335 |
then |
then |
336 |
echo -en "${COLRED}" |
echo -en "${COLRED}" |
337 |
echo -n "! ignr " |
echo -n "! ignr " |
390 |
while read pathto posix link mtime |
while read pathto posix link mtime |
391 |
do |
do |
392 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
393 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> LINK: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> LINK: ${MROOT}${pathto}" |
394 |
|
|
395 |
ln -snf "${link}" "${MROOT}${pathto}" |
ln -snf "${link}" "${MROOT}${pathto}" |
396 |
|
|
440 |
while read pathto posix major minor user group |
while read pathto posix major minor user group |
441 |
do |
do |
442 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
443 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> PIPE: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> PIPE: ${MROOT}${pathto}" |
444 |
|
|
445 |
mknod -m "${posix}" "${MROOT}${pathto}" |
mknod -m "${posix}" "${MROOT}${pathto}" |
446 |
# make it optional atm !! |
# make it optional atm !! |
484 |
while read pathto posix major minor user group |
while read pathto posix major minor user group |
485 |
do |
do |
486 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
487 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
488 |
|
|
489 |
mknod -m ${posix} "${MROOT}${pathto}" b "${major}" "${minor}" |
mknod -m ${posix} "${MROOT}${pathto}" b "${major}" "${minor}" |
490 |
|
|
528 |
while read pathto posix user group |
while read pathto posix user group |
529 |
do |
do |
530 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
531 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> FIFO: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t>>> FIFO: ${MROOT}${pathto}" |
532 |
|
|
533 |
mkfifo -m "${posix}" "${MROOT}${pathto}" |
mkfifo -m "${posix}" "${MROOT}${pathto}" |
534 |
chown "${user}:${group}" "${MROOT}${pathto}" |
chown "${user}:${group}" "${MROOT}${pathto}" |
862 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
863 |
if [ ! -L "${MROOT}${pathto}" ] |
if [ ! -L "${MROOT}${pathto}" ] |
864 |
then |
then |
865 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
866 |
echo -e "${COLRED}! exist${COLDEFAULT} === LINK: ${MROOT}${pathto}" |
echo -e "${COLRED}! exist${COLDEFAULT} === LINK: ${MROOT}${pathto}" |
867 |
continue |
continue |
868 |
fi |
fi |
874 |
# 1=keep me # |
# 1=keep me # |
875 |
case ${retval} in |
case ${retval} in |
876 |
0) |
0) |
877 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< LINK: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< LINK: ${MROOT}${pathto}" |
878 |
rm "${MROOT}${pathto}" |
rm "${MROOT}${pathto}" |
879 |
;; |
;; |
880 |
|
|
881 |
1) |
1) |
882 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
883 |
echo -e "${COLRED}! mtime${COLDEFAULT} === LINK: ${MROOT}${pathto}" |
echo -e "${COLRED}! mtime${COLDEFAULT} === LINK: ${MROOT}${pathto}" |
884 |
;; |
;; |
885 |
esac |
esac |
946 |
|
|
947 |
if [ ! -e "${MROOT}${pathto}" ] |
if [ ! -e "${MROOT}${pathto}" ] |
948 |
then |
then |
949 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
950 |
echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}" |
echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}" |
951 |
continue |
continue |
952 |
fi |
fi |
972 |
case ${retval} in |
case ${retval} in |
973 |
# file is not protected - delete it |
# file is not protected - delete it |
974 |
0|3) |
0|3) |
975 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< FILE: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< FILE: ${MROOT}${pathto}" |
976 |
rm "${MROOT}${pathto}" |
rm "${MROOT}${pathto}" |
977 |
;; |
;; |
978 |
|
|
979 |
# file is protected, do not delete |
# file is protected, do not delete |
980 |
2) |
2) |
981 |
if [[ ${VERBOSE} = on ]] |
if mqueryfeature "verbose" |
982 |
then |
then |
983 |
echo -en "${COLRED}" |
echo -en "${COLRED}" |
984 |
echo -n "! prot " |
echo -n "! prot " |
989 |
|
|
990 |
# file is protected but ignored, delete the update/do nothing |
# file is protected but ignored, delete the update/do nothing |
991 |
4) |
4) |
992 |
if [[ ${VERBOSE} = on ]] |
if mqueryfeature "verbose" |
993 |
then |
then |
994 |
echo -en "${COLRED}" |
echo -en "${COLRED}" |
995 |
echo -n "! ignr " |
echo -n "! ignr " |
1001 |
esac |
esac |
1002 |
;; |
;; |
1003 |
1) |
1) |
1004 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
1005 |
echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: ${MROOT}${pathto}" |
echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: ${MROOT}${pathto}" |
1006 |
;; |
;; |
1007 |
esac |
esac |
1063 |
do |
do |
1064 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
1065 |
|
|
1066 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< PIPE: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< PIPE: ${MROOT}${pathto}" |
1067 |
rm "${MROOT}${pathto}" |
rm "${MROOT}${pathto}" |
1068 |
done < ${MROOT}${INSTALLDB}/${pfull}/.pipes |
done < ${MROOT}${INSTALLDB}/${pfull}/.pipes |
1069 |
|
|
1123 |
do |
do |
1124 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
1125 |
|
|
1126 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< CHAR: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< CHAR: ${MROOT}${pathto}" |
1127 |
rm "${MROOT}${pathto}" |
rm "${MROOT}${pathto}" |
1128 |
done < ${MROOT}${INSTALLDB}/${pfull}/.char |
done < ${MROOT}${INSTALLDB}/${pfull}/.char |
1129 |
|
|
1185 |
do |
do |
1186 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
1187 |
|
|
1188 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< FIFO: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< FIFO: ${MROOT}${pathto}" |
1189 |
rm "${MROOT}${pathto}" |
rm "${MROOT}${pathto}" |
1190 |
done < ${MROOT}${INSTALLDB}/${pfull}/.fifo |
done < ${MROOT}${INSTALLDB}/${pfull}/.fifo |
1191 |
|
|
1246 |
|
|
1247 |
if [ ! -d "${MROOT}${pathto}" ] |
if [ ! -d "${MROOT}${pathto}" ] |
1248 |
then |
then |
1249 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
1250 |
echo -e "${COLRED}! exist${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
echo -e "${COLRED}! exist${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
1251 |
continue |
continue |
1252 |
fi |
fi |
1254 |
# exclude .keep directories |
# exclude .keep directories |
1255 |
if [ -f "${MROOT}${pathto}/.keep" ] |
if [ -f "${MROOT}${pathto}/.keep" ] |
1256 |
then |
then |
1257 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
1258 |
echo -e "${COLRED}! .keep${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
echo -e "${COLRED}! .keep${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
1259 |
continue |
continue |
1260 |
fi |
fi |
1267 |
|
|
1268 |
if rmdir "${MROOT}${pathto}" &> /dev/null |
if rmdir "${MROOT}${pathto}" &> /dev/null |
1269 |
then |
then |
1270 |
[[ ${VERBOSE} = on ]] && echo -e "\t<<< DIR: ${MROOT}${pathto}" |
mqueryfeature "verbose" && echo -e "\t<<< DIR: ${MROOT}${pathto}" |
1271 |
else |
else |
1272 |
[[ ${VERBOSE} = on ]] && \ |
mqueryfeature "verbose" && \ |
1273 |
echo -e "${COLRED}! empty${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
echo -e "${COLRED}! empty${COLDEFAULT} === DIR: ${MROOT}${pathto}" |
1274 |
fi |
fi |
1275 |
done |
done |
1327 |
done |
done |
1328 |
} |
} |
1329 |
|
|
1330 |
|
# convertmirrors [uri] |
1331 |
|
convertmirrors() |
1332 |
|
{ |
1333 |
|
local uri="$1" |
1334 |
|
local scheme |
1335 |
|
local mirror |
1336 |
|
local mirrors |
1337 |
|
local addon |
1338 |
|
local real_uri |
1339 |
|
local output |
1340 |
|
|
1341 |
|
# needs |
1342 |
|
[[ -z ${MIRRORS} ]] && die "convertmirrors(): no mirrors defined!" |
1343 |
|
[[ -z ${SOURCEFORGE_MIRRORS} ]] && die "convertmirrors(): no sourceforge mirrors defined!" |
1344 |
|
[[ -z ${GNU_MIRRORS} ]] && die "convertmirrors(): no gnu mirrors defined!" |
1345 |
|
[[ -z ${GNOME_MIRRORS} ]] && die "convertmirrors(): no gnome mirrors defined!" |
1346 |
|
[[ -z ${KDE_MIRRORS} ]] && die "convertmirrors(): no kde mirrors defined!" |
1347 |
|
|
1348 |
|
# check known uri schemes |
1349 |
|
case ${uri} in |
1350 |
|
http://*|https://*|ftp://*|ftps://*) mirrors="" ;; |
1351 |
|
mirror://*) mirrors="${MIRRORS}"; scheme="mirror://"; addon="/sources" ;; |
1352 |
|
package://*) mirrors="${MIRRORS}"; scheme="package://"; addon="/${PACKAGES_SERVER_PATH}" ;; |
1353 |
|
gnu://*) mirrors="${GNU_MIRRORS}"; scheme="gnu://" ;; |
1354 |
|
sourceforge://*) mirrors="${SOURCEFORGE_MIRRORS}"; scheme="sourceforge://" ;; |
1355 |
|
gnome://*) mirrors="${GNOME_MIRRORS}"; scheme="gnome://" ;; |
1356 |
|
kde://*) mirrors="${KDE_MIRRORS}"; scheme="kde://" ;; |
1357 |
|
*) die "convertmirror(): unsupported uri scheme in '${uri}'!" ;; |
1358 |
|
esac |
1359 |
|
|
1360 |
|
if [[ ! -z ${mirrors} ]] |
1361 |
|
then |
1362 |
|
for mirror in ${mirrors} |
1363 |
|
do |
1364 |
|
# add a whitespace to the output |
1365 |
|
[[ -z ${output} ]] || output+=" " |
1366 |
|
output+="${mirror}${addon}/${uri/${scheme}/}" |
1367 |
|
done |
1368 |
|
else |
1369 |
|
output="${uri}" |
1370 |
|
fi |
1371 |
|
|
1372 |
|
echo "${output}" |
1373 |
|
} |
1374 |
|
|
1375 |
|
mdownload() |
1376 |
|
{ |
1377 |
|
local i |
1378 |
|
local uri |
1379 |
|
local real_uris |
1380 |
|
local mirror |
1381 |
|
local outputfile |
1382 |
|
local outputdir |
1383 |
|
local retval |
1384 |
|
local wget_opts |
1385 |
|
|
1386 |
|
# very basic getops |
1387 |
|
for i in $* |
1388 |
|
do |
1389 |
|
case $1 in |
1390 |
|
--uri|-u) shift; uri="$1" ;; |
1391 |
|
--dir|-d) shift; outputdir="$1" ;; |
1392 |
|
esac |
1393 |
|
shift |
1394 |
|
done |
1395 |
|
|
1396 |
|
# sanity checks; abort if not given |
1397 |
|
[[ -z ${uri} ]] && die "mdownload(): no uri given!" |
1398 |
|
[[ -z ${outputdir} ]] && die "mdownload(): no dir given!" |
1399 |
|
|
1400 |
|
# convert mirrored uris to the real ones |
1401 |
|
real_uris="$(convertmirrors ${uri})" |
1402 |
|
|
1403 |
|
# verbose or not |
1404 |
|
mqueryfeature "!verbose" && wget_opts+=" --quiet" |
1405 |
|
|
1406 |
|
# filter wget options if busybox was found |
1407 |
|
wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
1408 |
|
|
1409 |
|
# create outputdir |
1410 |
|
[[ ! -d ${outputdir} ]] && install -d "${outputdir}" |
1411 |
|
|
1412 |
|
for mirror in ${real_uris} |
1413 |
|
do |
1414 |
|
# get the name of the output file |
1415 |
|
outputfile="${mirror##*/}" |
1416 |
|
|
1417 |
|
wget ${wget_opts} --output-document="${outputdir}/${outputfile}" "${mirror}" |
1418 |
|
retval="$?" |
1419 |
|
if [[ ${retval} = 0 ]] |
1420 |
|
then |
1421 |
|
break |
1422 |
|
else |
1423 |
|
continue |
1424 |
|
fi |
1425 |
|
done |
1426 |
|
|
1427 |
|
# return wget retval |
1428 |
|
return "${retval}" |
1429 |
|
} |
1430 |
|
|
1431 |
# fetch_packages /path/to/mage/file1 /path/to/mage/file2 |
# fetch_packages /path/to/mage/file1 /path/to/mage/file2 |
1432 |
fetch_packages() |
fetch_packages() |
1433 |
{ |
{ |
1434 |
|
local i |
1435 |
local list="$@" |
local list="$@" |
1436 |
local pkg |
local pkg |
1437 |
local mirr |
local mirr |
1485 |
continue |
continue |
1486 |
fi |
fi |
1487 |
|
|
1488 |
for mirr in ${MIRRORS} |
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
1489 |
do |
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
1490 |
echo -ne " ${COLBLUE}***${COLDEFAULT}" |
mdownload --uri "package://${pkg}" --dir "${PKGDIR}" || die "Could not download ${pkg}" |
|
#echo -e " fetching (${count_current}/${count_total}): ${mirr}/${pkg} ... " |
|
|
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
|
|
[[ ${VERBOSE} = off ]] && opt="--quiet" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--directory-prefix=${PKGDIR} \ |
|
|
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
done |
|
|
|
|
1491 |
if [ ! -f ${PKGDIR}/${pkg} ] |
if [ ! -f ${PKGDIR}/${pkg} ] |
1492 |
then |
then |
1493 |
die "Could not download ${pkg}" |
die "Package '${pkg}' after download not found in '${PKGDIR}'" |
1494 |
fi |
fi |
1495 |
done |
done |
1496 |
|
|
1550 |
|
|
1551 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1552 |
echo "fetching latest md5 from ${mymirr} ..." |
echo "fetching latest md5 from ${mymirr} ..." |
1553 |
[[ ${VERBOSE} = off ]] && opt="--quiet" |
mqueryfeature "!verbose" && opt="--quiet" |
1554 |
wget \ |
wget \ |
1555 |
${wget_opts} \ |
${wget_opts} \ |
1556 |
--directory-prefix=${temp} \ |
--directory-prefix=${temp} \ |
1645 |
} |
} |
1646 |
|
|
1647 |
|
|
1648 |
# cuts full pathnames or versionized names down to basename |
# unused? |
1649 |
choppkgname() |
# |
1650 |
{ |
# # cuts full pathnames or versionized names down to basename |
1651 |
#we want this only if full name was used |
# choppkgname() |
1652 |
if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
# { |
1653 |
then |
# #we want this only if full name was used |
1654 |
#cuts ARCH and PBUILD |
# if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
1655 |
#ARCH comes from ${MAGERC} |
# then |
1656 |
MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") |
# #cuts ARCH and PBUILD |
1657 |
|
# #ARCH comes from ${MAGERC} |
1658 |
|
# MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g") |
1659 |
|
# |
1660 |
|
# #cuts version number |
1661 |
|
# MAGENAME=$(basename ${MAGENAME%-*} .mage) |
1662 |
|
# fi |
1663 |
|
# } |
1664 |
|
|
|
#cuts version number |
|
|
MAGENAME=$(basename ${MAGENAME%-*} .mage) |
|
|
fi |
|
|
} |
|
1665 |
|
|
1666 |
# get_categorie $PNAME, returns CATEGORIE |
# get_categorie $PNAME, returns CATEGORIE |
1667 |
# $1=pname |
# $1=pname |
1740 |
then |
then |
1741 |
HIGHEST_MAGEFILE=${magefile} |
HIGHEST_MAGEFILE=${magefile} |
1742 |
#for debug only |
#for debug only |
1743 |
[[ ${MAGEDEBUG} = on ]] && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" |
mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" |
1744 |
fi |
fi |
1745 |
done |
done |
1746 |
|
|
2148 |
then |
then |
2149 |
for i in $* |
for i in $* |
2150 |
do |
do |
2151 |
[[ ${MAGEDEBUG} = on ]] && \ |
mqueryfeature "debug" && \ |
2152 |
echo "--- Including ${MAGEDIR}/include/${i}.minc" |
echo "--- Including ${MAGEDIR}/include/${i}.minc" |
2153 |
source ${MAGEDIR}/include/${i}.minc |
source ${MAGEDIR}/include/${i}.minc |
2154 |
done |
done |
2155 |
[[ ${MAGEDEBUG} = on ]] && echo |
mqueryfeature "debug" && echo |
2156 |
fi |
fi |
2157 |
} |
} |
2158 |
|
|
3002 |
local state |
local state |
3003 |
local descriptiom |
local descriptiom |
3004 |
local homepage |
local homepage |
3005 |
|
local license |
3006 |
local i |
local i |
3007 |
local all_installed |
local all_installed |
3008 |
local ipver |
local ipver |
3039 |
state="$(get_value_from_magefile STATE ${magefile})" |
state="$(get_value_from_magefile STATE ${magefile})" |
3040 |
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
3041 |
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
3042 |
|
license="$(get_value_from_magefile LICENSE ${magefile})" |
3043 |
|
|
3044 |
# all installed |
# all installed |
3045 |
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
3046 |
do |
do |
3047 |
ipver="$(magename2pver ${i})" |
ipver="$(magename2pver ${i})" |
3048 |
ipbuild="$(magename2pbuild ${i})" |
ipbuild="$(magename2pbuild ${i})" |
3049 |
|
|
3050 |
if [[ -z ${all_installed} ]] |
if [[ -z ${all_installed} ]] |
3051 |
then |
then |
3052 |
all_installed="${ipver}-${ipbuild}" |
all_installed="${ipver}-${ipbuild}" |
3055 |
fi |
fi |
3056 |
done |
done |
3057 |
[[ -z ${all_installed} ]] && all_installed="none" |
[[ -z ${all_installed} ]] && all_installed="none" |
3058 |
|
|
3059 |
case ${state} in |
case ${state} in |
3060 |
stable) state=${COLGREEN}"[s] ";; |
stable) state=${COLGREEN}"[s] ";; |
3061 |
testing) state=${COLYELLOW}"[t] ";; |
testing) state=${COLYELLOW}"[t] ";; |
3100 |
echo " Installed versions: ${all_installed}" |
echo " Installed versions: ${all_installed}" |
3101 |
echo " Description: ${description}" |
echo " Description: ${description}" |
3102 |
echo " Homepage: ${homepage}" |
echo " Homepage: ${homepage}" |
3103 |
|
if [[ ! -z ${license} ]] |
3104 |
|
then |
3105 |
|
echo " License: ${license}" |
3106 |
|
fi |
3107 |
echo " Depends: ${deps}" |
echo " Depends: ${deps}" |
3108 |
echo " SDepends: ${sdeps}" |
echo " SDepends: ${sdeps}" |
3109 |
echo |
echo |
3144 |
eval "${functions}() { ${include}_${functions} ; }" |
eval "${functions}() { ${include}_${functions} ; }" |
3145 |
|
|
3146 |
# debug |
# debug |
3147 |
[[ ${MAGEDEBUG} = on ]] && typeset -f "${functions}" |
mqueryfeature "debug" && typeset -f "${functions}" |
3148 |
|
|
3149 |
shift |
shift |
3150 |
done |
done |
3282 |
|
|
3283 |
return ${retval} |
return ${retval} |
3284 |
} |
} |
3285 |
|
|
3286 |
|
known_mage_feature() |
3287 |
|
{ |
3288 |
|
local feature="$1" |
3289 |
|
local retval |
3290 |
|
|
3291 |
|
case "${feature}" in |
3292 |
|
autosvc|!autosvc) retval=0 ;; |
3293 |
|
buildlog|!buildlog) retval=0 ;; |
3294 |
|
ccache|!ccache) retval=0 ;; |
3295 |
|
check|!check) retval=0 ;; |
3296 |
|
compressdoc|!compressdoc) retval=0 ;; |
3297 |
|
debug|!debug) retval=0 ;; |
3298 |
|
distcc|!distcc) retval=0 ;; |
3299 |
|
kernelsrcunpack|!kernelsrcunpack) retval=0 ;; |
3300 |
|
libtool|!libtool) retval=0 ;; |
3301 |
|
linuxsymlink|!linuxsymlink) retval=0 ;; |
3302 |
|
pkgbuild|!pkgbuild) retval=0 ;; |
3303 |
|
pkgdistrotag|!pkgdistrotag) retval=0 ;; |
3304 |
|
purge|!purge) retval=0 ;; |
3305 |
|
qalint|!qalint) retval=0 ;; |
3306 |
|
regentree|!regentree) retval=0 ;; |
3307 |
|
resume|!resume) retval=0 ;; |
3308 |
|
srcpkgbuild|!srcpkgbuild) retval=0 ;; |
3309 |
|
srcpkgtarball|!srcpkgtarball) retval=0 ;; |
3310 |
|
static|!static) retval=0 ;; |
3311 |
|
stepbystep|!stepbystep) retval=0 ;; |
3312 |
|
strip|!strip) retval=0 ;; |
3313 |
|
verbose|!verbose) retval=0 ;; |
3314 |
|
*) retval=1 ;; |
3315 |
|
esac |
3316 |
|
|
3317 |
|
return "${retval}" |
3318 |
|
} |
3319 |
|
|
3320 |
|
load_mage_features() |
3321 |
|
{ |
3322 |
|
for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]} |
3323 |
|
do |
3324 |
|
FVERBOSE=off msetfeature ${i} |
3325 |
|
done |
3326 |
|
} |
3327 |
|
|
3328 |
|
msetfeature() |
3329 |
|
{ |
3330 |
|
local feature |
3331 |
|
local count |
3332 |
|
local i |
3333 |
|
local found |
3334 |
|
|
3335 |
|
for feature in $@ |
3336 |
|
do |
3337 |
|
found=0 |
3338 |
|
count="${#MAGE_FEATURES_CURRENT[*]}" |
3339 |
|
|
3340 |
|
if ! known_mage_feature "${feature}" |
3341 |
|
then |
3342 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" |
3343 |
|
return 3 |
3344 |
|
fi |
3345 |
|
|
3346 |
|
for ((i=0; i<count; i++)) |
3347 |
|
do |
3348 |
|
if [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature} ]] |
3349 |
|
then |
3350 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' already enabled${COLDEFAULT}" |
3351 |
|
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3352 |
|
found=1 |
3353 |
|
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = !${feature} ]] |
3354 |
|
then |
3355 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' currently disabled, enabling it!${COLDEFAULT}" |
3356 |
|
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3357 |
|
found=1 |
3358 |
|
elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature//!} ]] |
3359 |
|
then |
3360 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature//!}' currently enabled, disabling it!${COLDEFAULT}" |
3361 |
|
MAGE_FEATURES_CURRENT[${i}]="${feature}" |
3362 |
|
found=1 |
3363 |
|
fi |
3364 |
|
done |
3365 |
|
|
3366 |
|
# if the feature was not found after proccessing the whole array |
3367 |
|
# it was not declared. in this case enable it |
3368 |
|
if [[ ${found} = 0 ]] |
3369 |
|
then |
3370 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' was not declared, enabling it!${COLDEFAULT}" |
3371 |
|
MAGE_FEATURES_CURRENT=( ${MAGE_FEATURES_CURRENT[*]} "${feature}" ) |
3372 |
|
fi |
3373 |
|
|
3374 |
|
export MAGE_FEATURE_CURRENT |
3375 |
|
done |
3376 |
|
} |
3377 |
|
|
3378 |
|
mqueryfeature() |
3379 |
|
{ |
3380 |
|
local feature="$1" |
3381 |
|
local retval=1 |
3382 |
|
local i |
3383 |
|
|
3384 |
|
if known_mage_feature "${feature}" |
3385 |
|
then |
3386 |
|
for i in ${MAGE_FEATURES_CURRENT[*]} |
3387 |
|
do |
3388 |
|
if [[ ${i} = ${feature} ]] |
3389 |
|
then |
3390 |
|
retval=0 |
3391 |
|
break # found break here |
3392 |
|
fi |
3393 |
|
done |
3394 |
|
else |
3395 |
|
[[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}" |
3396 |
|
retval=3 |
3397 |
|
fi |
3398 |
|
|
3399 |
|
return ${retval} |
3400 |
|
} |
3401 |
|
|
3402 |
|
mprintfeatures() |
3403 |
|
{ |
3404 |
|
echo "Global features: ${MAGE_FEATURES_GLOBAL[*]}" |
3405 |
|
echo "Local features: ${MAGE_FEATURES[*]}" |
3406 |
|
echo "Current features: ${MAGE_FEATURES_CURRENT[*]}" |
3407 |
|
} |