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.9 2005-10-21 16:01:40 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.12 2006-01-01 22:59:52 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
379 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
380 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
381 |
|
|
382 |
mknode -m ${posix} -c "${MROOT}${pathto}" |
mknod -m ${posix} -c "${MROOT}${pathto}" |
383 |
done < ${BUILDDIR}/${pkgname}/.char |
done < ${BUILDDIR}/${pkgname}/.char |
384 |
|
|
385 |
# very important: unsetting the '§' fieldseperator |
# very important: unsetting the '§' fieldseperator |
556 |
# abort if mage file not exists |
# abort if mage file not exists |
557 |
[ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist." |
[ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist." |
558 |
|
|
559 |
# first unregister virtuals |
# remove virtuals only if no other exist |
560 |
provide="$(get_value_from_magefile PROVIDE ${magefile})" |
if [[ $(count_installed_pkgs --pcat ${pcat} --pname ${pname}) -le 1 ]] |
|
if [ -n "${provide}" ] |
|
561 |
then |
then |
562 |
for i in ${provide} |
# first unregister virtuals |
563 |
do |
provide="$(get_value_from_magefile PROVIDE ${magefile})" |
564 |
virtuals_del "${i}" "${pcat}/${pname}" |
if [ -n "${provide}" ] |
565 |
done |
then |
566 |
|
for i in ${provide} |
567 |
|
do |
568 |
|
virtuals_del "${i}" "${pcat}/${pname}" |
569 |
|
done |
570 |
|
fi |
571 |
fi |
fi |
572 |
|
|
573 |
# removes database entry |
# removes database entry |
577 |
fi |
fi |
578 |
} |
} |
579 |
|
|
580 |
|
# get the number of installed packages |
581 |
|
count_installed_pkgs() |
582 |
|
{ |
583 |
|
local pcat |
584 |
|
local pname |
585 |
|
local pkg |
586 |
|
local i |
587 |
|
|
588 |
|
# very basic getops |
589 |
|
for i in $* |
590 |
|
do |
591 |
|
case $1 in |
592 |
|
--pcat|-c) shift; pcat="$1" ;; |
593 |
|
--pname|-n) shift; pname="$1" ;; |
594 |
|
esac |
595 |
|
shift |
596 |
|
done |
597 |
|
|
598 |
|
# sanity checks; abort if not given |
599 |
|
[ -z "${pcat}" ] && die "pkg_count() \$pcat not given." |
600 |
|
[ -z "${pname}" ] && die "pkg_count() \$pname not given." |
601 |
|
|
602 |
|
declare -i i=0 |
603 |
|
for pkg in $(get_uninstall_candidates --pcat ${pcat} --pname ${pname}) |
604 |
|
do |
605 |
|
(( i++ )) |
606 |
|
#echo "$i ${pkg}" |
607 |
|
done |
608 |
|
|
609 |
|
# return the value |
610 |
|
echo "${i}" |
611 |
|
} |
612 |
|
|
613 |
|
|
614 |
################################################### |
################################################### |
615 |
# function compare_mtime # |
# function compare_mtime # |
1156 |
--continue \ |
--continue \ |
1157 |
--progress bar \ |
--progress bar \ |
1158 |
--directory-prefix=${PKGDIR} \ |
--directory-prefix=${PKGDIR} \ |
1159 |
${opt} ${mirr}/packages/${pkg} |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
1160 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1161 |
then |
then |
1162 |
break |
break |
1288 |
STATE="$(get_value_from_magefile STATE "$1")" |
STATE="$(get_value_from_magefile STATE "$1")" |
1289 |
|
|
1290 |
# state testing |
# state testing |
1291 |
if [[ ${USE_TESTING} = true ]] |
if [[ ${USE_TESTING} = true ]] || [[ ${MAGE_DISTRIBUTION} = testing ]] |
1292 |
then |
then |
1293 |
case ${STATE} in |
case ${STATE} in |
1294 |
testing|stable) return 0 ;; |
testing|stable) return 0 ;; |
1297 |
fi |
fi |
1298 |
|
|
1299 |
# state unstable |
# state unstable |
1300 |
if [[ ${USE_UNSTABLE} = true ]] |
if [[ ${USE_UNSTABLE} = true ]] || [[ ${MAGE_DISTRIBUTION} = unstable ]] |
1301 |
then |
then |
1302 |
case ${STATE} in |
case ${STATE} in |
1303 |
unstable|testing|stable) return 0 ;; |
unstable|testing|stable) return 0 ;; |