--- trunk/mage/usr/lib/mage/mage4.functions.sh 2006/01/01 23:15:54 312 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2007/01/22 00:24:14 419 @@ -1,6 +1,6 @@ #!/bin/bash # Magellan Linux Installer Functions (mage.functions.sh) -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.13 2006-01-01 23:15:48 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.26 2007-01-22 00:24:14 niro Exp $ mage_setup() { @@ -381,7 +381,7 @@ [ -z "${pathto}" ] && continue [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" - mknod -m ${posix} -c "${MROOT}${pathto}" ${major} ${minor} + mknod -m ${posix} "${MROOT}${pathto}" c ${major} ${minor} done < ${BUILDDIR}/${pkgname}/.char # very important: unsetting the '§' fieldseperator @@ -1106,7 +1106,7 @@ local count_current local count_total - [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your /etc/mage.rc." + [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}." # get count of total packages declare -i count_current=0 @@ -1181,26 +1181,13 @@ { if [ -z "${RSYNC}" ] then - die "You have no rsync-mirrors defined. Please edit your /etc/mage.rc." + die "You have no rsync-mirrors defined. Please edit your ${MAGERC}." fi local i for i in ${RSYNC} do - rsync \ - --recursive \ - --links \ - --perms \ - --times \ - --devices \ - --timeout=600 \ - --verbose \ - --compress \ - --progress \ - --stats \ - --delete \ - --delete-after \ - ${i} ${MAGEDIR} + rsync ${RSYNC_FETCH_OPTIONS} ${i} ${MAGEDIR} if [[ $? = 0 ]] then break @@ -1253,7 +1240,7 @@ if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] then #cuts ARCH and PBUILD - #ARCH comes from /etc/mage.rc + #ARCH comes from ${MAGERC} MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") #cuts version number @@ -1286,6 +1273,9 @@ # returns 0=stable 1=unstable check_stable_package() { + # first check if this magefile is not blacklisted + blacklisted "$1" || return 1 + local STATE STATE="$(get_value_from_magefile STATE "$1")" @@ -1337,26 +1327,27 @@ fi done - # stop here if HIGHEST_MAGEFILE is zero - # this package must be unstable or old - if [ -z "${HIGHEST_MAGEFILE}" ] - then - echo - echo -n "All packages named " - echo -en ${COLRED}\""${PKGNAME%-*-*-*}\""${COLDEFAULT} - echo -n " are marked " - echo -en ${COLRED}"*UNSTABLE*"${COLDEFAULT} - echo "." - echo "You need to declare USE_UNSTABLE=true to install this." - echo - echo "Example:" - echo " USE_UNSTABLE=true mage install ${PKGNAME%-*-*-*}" - echo - echo "Be warned that these packages are not stable and may cause serious problems." - echo "You should know what you are doing, so don't complain about any damage." - echo - return 1 - fi +# do not so anything +# # stop here if HIGHEST_MAGEFILE is zero +# # this package must be unstable or old +# if [ -z "${HIGHEST_MAGEFILE}" ] +# then +# echo +# echo -n "All packages named " +# echo -en ${COLRED}\""${PKGNAME%-*-*-*}\""${COLDEFAULT} +# echo -n " are marked " +# echo -en ${COLRED}"*UNSTABLE*"${COLDEFAULT} +# echo "." +# echo "You need to declare USE_UNSTABLE=true to install this." +# echo +# echo "Example:" +# echo " USE_UNSTABLE=true mage install ${PKGNAME%-*-*-*}" +# echo +# echo "Be warned that these packages are not stable and may cause serious problems." +# echo "You should know what you are doing, so don't complain about any damage." +# echo +# return 1 +# fi echo "${HIGHEST_MAGEFILE}" return 0 @@ -1468,15 +1459,16 @@ shift done - # sanity checks; abort if not given - [ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given." +# it's not good to complain here about empty pnames; better to continue later anyway +# # sanity checks; abort if not given +# [ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given." # check needed global vars [ -z "${INSTALLDB}" ] && die "get_uninstall_candidates() \$INSTALLDB not set." # set pcatdir to '*' if empty - [ -z "${pcatdir}" ] && pcatdir=* + [ -z "${pcatdir}" ] && pcatdir='*' for pkg in ${MROOT}${INSTALLDB}/${pcatdir}/* do @@ -1565,7 +1557,7 @@ if virtuals_read ${virtualname} then - # make shure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already + # make sure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already for i in $(virtuals_read ${virtualname} showpkgs) do if [[ ${i} = ${pkgname} ]] @@ -1716,7 +1708,7 @@ { local i - if [ -n "$@" ] + if [[ -n $@ ]] then for i in $@ do @@ -1758,7 +1750,7 @@ echo -en ${COLRED}"An update for your packetmanager is available. "${COLDEFAULT} echo -e ${COLBLUE}"[ ${newest_mage} ]"${COLDEFAULT} echo "It is recommened to install this newer version" - echo "or your current system installation may brake." + echo "or your current system installation may break." echo echo -en "Please update mage by running " echo -e ${COLGREEN}"'mage install mage'"${COLDEFAULT} @@ -2030,6 +2022,9 @@ local magefile="$2" local value + [[ -z ${var} ]] && return 1 + [[ -z ${magefile} ]] && return 1 + # local all possible vars of a mage file # to prevent bad issues local PKGNAME @@ -2162,6 +2157,7 @@ smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 if [ -f "${smage2file}" ] then + echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " smage2 ${smage2file} || die "compile failed" else echo @@ -2175,14 +2171,7 @@ if [[ ${PKGTYPE} != virtual ]] && \ [[ ${PKGTYPE} != sources ]] then - # show a verbose message on src-install - 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 + echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " build_doinstall ${PKGNAME} fi @@ -2439,7 +2428,7 @@ echo -ne "${COLBLUE} <<< ${COLDEFAULT}" echo -n "removing: " echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" - echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}" + echo -e "${COLRED}${pname}-${pver}-${pbuild}${COLDEFAULT}" magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage" source ${magefile} @@ -2541,8 +2530,8 @@ local ipbuild # only names no versions - result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name *${string}*)" - #result="$(find ${MAGEDIR} -type f -name *${string}*.mage | sort)" + result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*'| sed '/profiles/d' | sed '/includes/d')" + #result="$(find ${MAGEDIR} -type f -name '*'${string}'*'.mage | sort)" # nothing found [[ -z ${result} ]] && die "No package found containing '${string}' in the name." @@ -2627,3 +2616,64 @@ shift done } + +mlibdir() +{ + local libdir=lib + [[ ${ARCH} = x86_64 ]] && libdir=lib64 + + echo "${libdir}" +} + +## blacklisted ${magefile} +blacklisted() +{ + [[ -z ${MAGE_DISTRIBUTION} ]] && local MAGE_DISTRIBUTION=stable + + # compat + [[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable + [[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing + + local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" + + # return 0 if the list not exist; nothin is masked + [[ ! -f ${EXCLUDED} ]] && return 0 + + local MAGEFILE="$1" + + local PCAT="$(magename2pcat ${MAGEFILE})" + local PNAME="$(magename2pname ${MAGEFILE})" + local PVER="$(magename2pver ${MAGEFILE})" + local PBUILD="$(magename2pbuild ${MAGEFILE})" + + local EXPCAT EXPNAME EXPVER EXPBUILD + while read EXPCAT EXPNAME EXPVER EXPBUILD + do + # ignore spaces and comments + case "${EXPCAT}" in + \#*|"") continue ;; + esac + + # exclude full pver + if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && + [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && + [[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] && + [[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]] + then + [[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCAT}/${PNAME}-${PVER}-${PBUILD} ]] && return 1 + fi + + # exclude pcat/pname only + if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && + [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && + [[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]] + then + [[ ${EXPCAT}/${EXPNAME} = ${PCAT}/${PNAME} ]] && return 1 + fi + done << EOF +$( cat ${EXCLUDED}; echo) +EOF + + return 0 +} +