1 |
#!/bin/bash |
#!/bin/bash |
2 |
# Magellan Linux Installer Functions (mage.functions.sh) |
# Magellan Linux Installer Functions (mage.functions.sh) |
3 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.14 2006-01-01 23:45:27 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.20 2006-07-17 20:48:22 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
1286 |
# returns 0=stable 1=unstable |
# returns 0=stable 1=unstable |
1287 |
check_stable_package() |
check_stable_package() |
1288 |
{ |
{ |
1289 |
|
# first check if this magefile is not blacklisted |
1290 |
|
blacklisted "$1" || return 1 |
1291 |
|
|
1292 |
local STATE |
local STATE |
1293 |
STATE="$(get_value_from_magefile STATE "$1")" |
STATE="$(get_value_from_magefile STATE "$1")" |
1294 |
|
|
1340 |
fi |
fi |
1341 |
done |
done |
1342 |
|
|
1343 |
# stop here if HIGHEST_MAGEFILE is zero |
# do not so anything |
1344 |
# this package must be unstable or old |
# # stop here if HIGHEST_MAGEFILE is zero |
1345 |
if [ -z "${HIGHEST_MAGEFILE}" ] |
# # this package must be unstable or old |
1346 |
then |
# if [ -z "${HIGHEST_MAGEFILE}" ] |
1347 |
echo |
# then |
1348 |
echo -n "All packages named " |
# echo |
1349 |
echo -en ${COLRED}\""${PKGNAME%-*-*-*}\""${COLDEFAULT} |
# echo -n "All packages named " |
1350 |
echo -n " are marked " |
# echo -en ${COLRED}\""${PKGNAME%-*-*-*}\""${COLDEFAULT} |
1351 |
echo -en ${COLRED}"*UNSTABLE*"${COLDEFAULT} |
# echo -n " are marked " |
1352 |
echo "." |
# echo -en ${COLRED}"*UNSTABLE*"${COLDEFAULT} |
1353 |
echo "You need to declare USE_UNSTABLE=true to install this." |
# echo "." |
1354 |
echo |
# echo "You need to declare USE_UNSTABLE=true to install this." |
1355 |
echo "Example:" |
# echo |
1356 |
echo " USE_UNSTABLE=true mage install ${PKGNAME%-*-*-*}" |
# echo "Example:" |
1357 |
echo |
# echo " USE_UNSTABLE=true mage install ${PKGNAME%-*-*-*}" |
1358 |
echo "Be warned that these packages are not stable and may cause serious problems." |
# echo |
1359 |
echo "You should know what you are doing, so don't complain about any damage." |
# echo "Be warned that these packages are not stable and may cause serious problems." |
1360 |
echo |
# echo "You should know what you are doing, so don't complain about any damage." |
1361 |
return 1 |
# echo |
1362 |
fi |
# return 1 |
1363 |
|
# fi |
1364 |
|
|
1365 |
echo "${HIGHEST_MAGEFILE}" |
echo "${HIGHEST_MAGEFILE}" |
1366 |
return 0 |
return 0 |
1472 |
shift |
shift |
1473 |
done |
done |
1474 |
|
|
1475 |
# sanity checks; abort if not given |
# it's not good to complain here about empty pnames; better to continue later anyway |
1476 |
[ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given." |
# # sanity checks; abort if not given |
1477 |
|
# [ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given." |
1478 |
|
|
1479 |
|
|
1480 |
# check needed global vars |
# check needed global vars |
1481 |
[ -z "${INSTALLDB}" ] && die "get_uninstall_candidates() \$INSTALLDB not set." |
[ -z "${INSTALLDB}" ] && die "get_uninstall_candidates() \$INSTALLDB not set." |
1482 |
|
|
1483 |
# set pcatdir to '*' if empty |
# set pcatdir to '*' if empty |
1484 |
[ -z "${pcatdir}" ] && pcatdir=* |
[ -z "${pcatdir}" ] && pcatdir='*' |
1485 |
|
|
1486 |
for pkg in ${MROOT}${INSTALLDB}/${pcatdir}/* |
for pkg in ${MROOT}${INSTALLDB}/${pcatdir}/* |
1487 |
do |
do |
1570 |
|
|
1571 |
if virtuals_read ${virtualname} |
if virtuals_read ${virtualname} |
1572 |
then |
then |
1573 |
# make shure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already |
# make sure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already |
1574 |
for i in $(virtuals_read ${virtualname} showpkgs) |
for i in $(virtuals_read ${virtualname} showpkgs) |
1575 |
do |
do |
1576 |
if [[ ${i} = ${pkgname} ]] |
if [[ ${i} = ${pkgname} ]] |
1763 |
echo -en ${COLRED}"An update for your packetmanager is available. "${COLDEFAULT} |
echo -en ${COLRED}"An update for your packetmanager is available. "${COLDEFAULT} |
1764 |
echo -e ${COLBLUE}"[ ${newest_mage} ]"${COLDEFAULT} |
echo -e ${COLBLUE}"[ ${newest_mage} ]"${COLDEFAULT} |
1765 |
echo "It is recommened to install this newer version" |
echo "It is recommened to install this newer version" |
1766 |
echo "or your current system installation may brake." |
echo "or your current system installation may break." |
1767 |
echo |
echo |
1768 |
echo -en "Please update mage by running " |
echo -en "Please update mage by running " |
1769 |
echo -e ${COLGREEN}"'mage install mage'"${COLDEFAULT} |
echo -e ${COLGREEN}"'mage install mage'"${COLDEFAULT} |
2035 |
local magefile="$2" |
local magefile="$2" |
2036 |
local value |
local value |
2037 |
|
|
2038 |
|
[[ -z ${var} ]] && return 1 |
2039 |
|
[[ -z ${magefile} ]] && return 1 |
2040 |
|
|
2041 |
# local all possible vars of a mage file |
# local all possible vars of a mage file |
2042 |
# to prevent bad issues |
# to prevent bad issues |
2043 |
local PKGNAME |
local PKGNAME |
2170 |
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2171 |
if [ -f "${smage2file}" ] |
if [ -f "${smage2file}" ] |
2172 |
then |
then |
2173 |
|
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |
2174 |
smage2 ${smage2file} || die "compile failed" |
smage2 ${smage2file} || die "compile failed" |
2175 |
else |
else |
2176 |
echo |
echo |
2184 |
if [[ ${PKGTYPE} != virtual ]] && \ |
if [[ ${PKGTYPE} != virtual ]] && \ |
2185 |
[[ ${PKGTYPE} != sources ]] |
[[ ${PKGTYPE} != sources ]] |
2186 |
then |
then |
2187 |
# show a verbose message on src-install |
echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " |
|
if [[ ${src_install} = true ]] |
|
|
then |
|
|
echo -ne "${COLBLUE} *** ${COLDEFAULT}" |
|
|
echo -ne "merging files: " |
|
|
echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
|
|
echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}" |
|
|
fi |
|
2188 |
build_doinstall ${PKGNAME} |
build_doinstall ${PKGNAME} |
2189 |
fi |
fi |
2190 |
|
|
2543 |
local ipbuild |
local ipbuild |
2544 |
|
|
2545 |
# only names no versions |
# only names no versions |
2546 |
result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name *${string}*)" |
result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*')" |
2547 |
#result="$(find ${MAGEDIR} -type f -name *${string}*.mage | sort)" |
#result="$(find ${MAGEDIR} -type f -name '*'${string}'*'.mage | sort)" |
2548 |
|
|
2549 |
# nothing found |
# nothing found |
2550 |
[[ -z ${result} ]] && die "No package found containing '${string}' in the name." |
[[ -z ${result} ]] && die "No package found containing '${string}' in the name." |
2629 |
shift |
shift |
2630 |
done |
done |
2631 |
} |
} |
2632 |
|
|
2633 |
|
mlibdir() |
2634 |
|
{ |
2635 |
|
local libdir=lib |
2636 |
|
[[ ${ARCH} = x86_64 ]] && libdir=lib64 |
2637 |
|
|
2638 |
|
echo "${libdir}" |
2639 |
|
} |
2640 |
|
|
2641 |
|
## blacklisted ${magefile} |
2642 |
|
blacklisted() |
2643 |
|
{ |
2644 |
|
[[ -z ${MAGE_DISTRIBUTION} ]] && local MAGE_DISTRIBUTION=stable |
2645 |
|
|
2646 |
|
# compat |
2647 |
|
[[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable |
2648 |
|
[[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing |
2649 |
|
|
2650 |
|
local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" |
2651 |
|
|
2652 |
|
# return 0 if the list not exist; nothin is masked |
2653 |
|
[[ ! -f ${EXCLUDED} ]] && return 0 |
2654 |
|
|
2655 |
|
local MAGEFILE="$1" |
2656 |
|
|
2657 |
|
local PCAT="$(magename2pcat ${MAGEFILE})" |
2658 |
|
local PNAME="$(magename2pname ${MAGEFILE})" |
2659 |
|
local PVER="$(magename2pver ${MAGEFILE})" |
2660 |
|
local PBUILD="$(magename2pbuild ${MAGEFILE})" |
2661 |
|
|
2662 |
|
local EXPCAT EXPNAME EXPVER EXPBUILD |
2663 |
|
while read EXPCAT EXPNAME EXPVER EXPBUILD |
2664 |
|
do |
2665 |
|
# ignore spaces and comments |
2666 |
|
case "${EXPCAT}" in |
2667 |
|
\#*|"") continue ;; |
2668 |
|
esac |
2669 |
|
|
2670 |
|
# exclude full pver |
2671 |
|
if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && |
2672 |
|
[[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && |
2673 |
|
[[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] && |
2674 |
|
[[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]] |
2675 |
|
then |
2676 |
|
[[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCAT}/${PNAME}-${PVER}-${PBUILD} ]] && return 1 |
2677 |
|
fi |
2678 |
|
|
2679 |
|
# exclude pcat/pname only |
2680 |
|
if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && |
2681 |
|
[[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && |
2682 |
|
[[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]] |
2683 |
|
then |
2684 |
|
[[ ${EXPCAT}/${EXPNAME} = ${PCAT}/${PNAME} ]] && return 1 |
2685 |
|
fi |
2686 |
|
done << EOF |
2687 |
|
$( cat ${EXCLUDED}; echo) |
2688 |
|
EOF |
2689 |
|
|
2690 |
|
return 0 |
2691 |
|
} |
2692 |
|
|