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.13 2006-01-01 23:15:48 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
361 |
local pkgname="$1" |
local pkgname="$1" |
362 |
local pathto |
local pathto |
363 |
local posix |
local posix |
364 |
|
local major |
365 |
|
local minor |
366 |
local IFS |
local IFS |
367 |
|
|
368 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
376 |
# sets fieldseperator to "§" instead of " " |
# sets fieldseperator to "§" instead of " " |
377 |
IFS=§ |
IFS=§ |
378 |
|
|
379 |
while read pathto posix |
while read pathto posix major minor |
380 |
do |
do |
381 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
382 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
383 |
|
|
384 |
mknode -m ${posix} -c "${MROOT}${pathto}" |
mknod -m ${posix} -c "${MROOT}${pathto}" ${major} ${minor} |
385 |
done < ${BUILDDIR}/${pkgname}/.char |
done < ${BUILDDIR}/${pkgname}/.char |
386 |
|
|
387 |
# very important: unsetting the '§' fieldseperator |
# very important: unsetting the '§' fieldseperator |
558 |
# abort if mage file not exists |
# abort if mage file not exists |
559 |
[ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist." |
[ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist." |
560 |
|
|
561 |
# first unregister virtuals |
# remove virtuals only if no other exist |
562 |
provide="$(get_value_from_magefile PROVIDE ${magefile})" |
if [[ $(count_installed_pkgs --pcat ${pcat} --pname ${pname}) -le 1 ]] |
|
if [ -n "${provide}" ] |
|
563 |
then |
then |
564 |
for i in ${provide} |
# first unregister virtuals |
565 |
do |
provide="$(get_value_from_magefile PROVIDE ${magefile})" |
566 |
virtuals_del "${i}" "${pcat}/${pname}" |
if [ -n "${provide}" ] |
567 |
done |
then |
568 |
|
for i in ${provide} |
569 |
|
do |
570 |
|
virtuals_del "${i}" "${pcat}/${pname}" |
571 |
|
done |
572 |
|
fi |
573 |
fi |
fi |
574 |
|
|
575 |
# removes database entry |
# removes database entry |
579 |
fi |
fi |
580 |
} |
} |
581 |
|
|
582 |
|
# get the number of installed packages |
583 |
|
count_installed_pkgs() |
584 |
|
{ |
585 |
|
local pcat |
586 |
|
local pname |
587 |
|
local pkg |
588 |
|
local i |
589 |
|
|
590 |
|
# very basic getops |
591 |
|
for i in $* |
592 |
|
do |
593 |
|
case $1 in |
594 |
|
--pcat|-c) shift; pcat="$1" ;; |
595 |
|
--pname|-n) shift; pname="$1" ;; |
596 |
|
esac |
597 |
|
shift |
598 |
|
done |
599 |
|
|
600 |
|
# sanity checks; abort if not given |
601 |
|
[ -z "${pcat}" ] && die "pkg_count() \$pcat not given." |
602 |
|
[ -z "${pname}" ] && die "pkg_count() \$pname not given." |
603 |
|
|
604 |
|
declare -i i=0 |
605 |
|
for pkg in $(get_uninstall_candidates --pcat ${pcat} --pname ${pname}) |
606 |
|
do |
607 |
|
(( i++ )) |
608 |
|
#echo "$i ${pkg}" |
609 |
|
done |
610 |
|
|
611 |
|
# return the value |
612 |
|
echo "${i}" |
613 |
|
} |
614 |
|
|
615 |
|
|
616 |
################################################### |
################################################### |
617 |
# function compare_mtime # |
# function compare_mtime # |
1158 |
--continue \ |
--continue \ |
1159 |
--progress bar \ |
--progress bar \ |
1160 |
--directory-prefix=${PKGDIR} \ |
--directory-prefix=${PKGDIR} \ |
1161 |
${opt} ${mirr}/packages/${pkg} |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
1162 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1163 |
then |
then |
1164 |
break |
break |
1290 |
STATE="$(get_value_from_magefile STATE "$1")" |
STATE="$(get_value_from_magefile STATE "$1")" |
1291 |
|
|
1292 |
# state testing |
# state testing |
1293 |
if [[ ${USE_TESTING} = true ]] |
if [[ ${USE_TESTING} = true ]] || [[ ${MAGE_DISTRIBUTION} = testing ]] |
1294 |
then |
then |
1295 |
case ${STATE} in |
case ${STATE} in |
1296 |
testing|stable) return 0 ;; |
testing|stable) return 0 ;; |
1299 |
fi |
fi |
1300 |
|
|
1301 |
# state unstable |
# state unstable |
1302 |
if [[ ${USE_UNSTABLE} = true ]] |
if [[ ${USE_UNSTABLE} = true ]] || [[ ${MAGE_DISTRIBUTION} = unstable ]] |
1303 |
then |
then |
1304 |
case ${STATE} in |
case ${STATE} in |
1305 |
unstable|testing|stable) return 0 ;; |
unstable|testing|stable) return 0 ;; |