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.3 2005-09-11 19:47:08 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.6 2005-10-02 14:09:41 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
1667 |
local newest_mage |
local newest_mage |
1668 |
local installed_mage |
local installed_mage |
1669 |
|
|
1670 |
newest_mage="$( CATEGORIE=app-mage MAGENAME=mage get_highest_magefile;echo $(basename ${MAGEFILE} .mage) )" |
newest_mage="$(basename $(get_highest_magefile app-mage mage) .mage)" |
1671 |
installed_mage="$(magequery -n mage | cut -d' ' -f5)" |
installed_mage="$(magequery -n mage | cut -d' ' -f5)" |
1672 |
|
|
1673 |
if [[ ${newest_mage} > ${installed_mage} ]] |
if [[ ${newest_mage} > ${installed_mage} ]] |
1960 |
local PKGTYPE |
local PKGTYPE |
1961 |
local preinstall |
local preinstall |
1962 |
local postinstall |
local postinstall |
1963 |
|
local preremove |
1964 |
|
local postremove |
1965 |
|
|
1966 |
# sanity checks |
# sanity checks |
1967 |
[ -f ${magefile} ] && source ${magefile} || \ |
[ -f ${magefile} ] && source ${magefile} || \ |
1971 |
source ${magefile} |
source ${magefile} |
1972 |
eval value=\$$(echo ${var}) |
eval value=\$$(echo ${var}) |
1973 |
echo "${value}" |
echo "${value}" |
1974 |
|
|
1975 |
|
unset preinstall |
1976 |
|
unset postinstall |
1977 |
|
unset preremove |
1978 |
|
unset postremove |
1979 |
} |
} |
1980 |
|
|
1981 |
mage_install() |
mage_install() |
1992 |
local PKGTYPE |
local PKGTYPE |
1993 |
local preinstall |
local preinstall |
1994 |
local postinstall |
local postinstall |
1995 |
|
local preremove |
1996 |
|
local postremove |
1997 |
|
|
1998 |
local pcat |
local pcat |
1999 |
local pname |
local pname |
2155 |
# echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
# echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
2156 |
# echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} " |
# echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} " |
2157 |
echo "successfully installed." |
echo "successfully installed." |
2158 |
|
|
2159 |
|
unset preinstall |
2160 |
|
unset postinstall |
2161 |
|
unset preremove |
2162 |
|
unset postremove |
2163 |
} |
} |
2164 |
|
|
2165 |
md5sum_packages() |
md5sum_packages() |
2318 |
local PKGTYPE |
local PKGTYPE |
2319 |
local preinstall |
local preinstall |
2320 |
local postinstall |
local postinstall |
2321 |
|
local preremove |
2322 |
|
local postremove |
2323 |
|
|
2324 |
local pcat |
local pcat |
2325 |
local pname |
local pname |
2417 |
# echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
# echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
2418 |
# echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} " |
# echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} " |
2419 |
echo "successfully removed." |
echo "successfully removed." |
2420 |
|
|
2421 |
|
unset preinstall |
2422 |
|
unset postinstall |
2423 |
|
unset preremove |
2424 |
|
unset postremove |
2425 |
} |
} |
2426 |
|
|
2427 |
show_etc_update_mesg() { |
show_etc_update_mesg() { |
2520 |
unset ipbuild |
unset ipbuild |
2521 |
done |
done |
2522 |
} |
} |
2523 |
|
|
2524 |
|
export_inherits() |
2525 |
|
{ |
2526 |
|
local include="$1" |
2527 |
|
shift |
2528 |
|
|
2529 |
|
while [ "$1" ] |
2530 |
|
do |
2531 |
|
local functions="$1" |
2532 |
|
|
2533 |
|
# sanity checks |
2534 |
|
[ -z "${include}" ] && die "export_inherits(): \$include not given." |
2535 |
|
[ -z "${functions}" ] && die "export_inherits(): \$functions not given." |
2536 |
|
|
2537 |
|
eval "${functions}() { ${include}_${functions} ; }" |
2538 |
|
|
2539 |
|
# debug |
2540 |
|
[[ ${MAGEDEBUG} = on ]] && typeset -f "${functions}" |
2541 |
|
|
2542 |
|
shift |
2543 |
|
done |
2544 |
|
} |