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.1 2005-09-09 16:35:38 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.2 2005-09-10 13:35:55 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
2415 |
echo "Please run 'etc-update' to update your configuration files." |
echo "Please run 'etc-update' to update your configuration files." |
2416 |
echo |
echo |
2417 |
} |
} |
2418 |
|
|
2419 |
|
pkgsearch() |
2420 |
|
{ |
2421 |
|
local string="$1" |
2422 |
|
local result |
2423 |
|
local pkg |
2424 |
|
local pcat |
2425 |
|
local pname |
2426 |
|
local magefile |
2427 |
|
local pver |
2428 |
|
local pbuild |
2429 |
|
local state |
2430 |
|
local descriptiom |
2431 |
|
local homepage |
2432 |
|
local i |
2433 |
|
local all_installed |
2434 |
|
local ipver |
2435 |
|
local ipbuild |
2436 |
|
|
2437 |
|
# only names no versions |
2438 |
|
result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name *${string}*)" |
2439 |
|
#result="$(find ${MAGEDIR} -type f -name *${string}*.mage | sort)" |
2440 |
|
|
2441 |
|
# nothing found |
2442 |
|
[[ -z ${result} ]] && die "No package found containing '${string}' in the name." |
2443 |
|
|
2444 |
|
for pkg in ${result} |
2445 |
|
do |
2446 |
|
# dirty, but does the job |
2447 |
|
pcat="$(magename2pcat ${pkg}/foo)" |
2448 |
|
pname="$(magename2pname ${pkg}-foo-foo)" |
2449 |
|
|
2450 |
|
# get highest version available |
2451 |
|
magefile=$(get_highest_magefile ${pcat} ${pname}) |
2452 |
|
|
2453 |
|
# now get all needed infos to print a nice output |
2454 |
|
pver="$(magename2pver ${magefile})" |
2455 |
|
pbuild="$(magename2pbuild ${magefile})" |
2456 |
|
state="$(get_value_from_magefile STATE ${magefile})" |
2457 |
|
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
2458 |
|
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
2459 |
|
|
2460 |
|
# all installed |
2461 |
|
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
2462 |
|
do |
2463 |
|
ipver="$(magename2pver ${i})" |
2464 |
|
ipbuild="$(magename2pbuild ${i})" |
2465 |
|
|
2466 |
|
if [[ -z ${all_installed} ]] |
2467 |
|
then |
2468 |
|
all_installed="${ipver}-${ipbuild}" |
2469 |
|
else |
2470 |
|
all_installed="${all_installed} ${ipver}-${ipbuild}" |
2471 |
|
fi |
2472 |
|
done |
2473 |
|
[[ -z ${all_installed} ]] && all_installed="none" |
2474 |
|
|
2475 |
|
case ${state} in |
2476 |
|
stable) state=${COLGREEN}"[s] ";; |
2477 |
|
testing) state=${COLYELLOW}"[t] ";; |
2478 |
|
unstable) state=${COLRED}"[u] ";; |
2479 |
|
old) state=${COLGRAY}"[o] ";; |
2480 |
|
esac |
2481 |
|
|
2482 |
|
echo -e "${state}${pcat}/${pname}"${COLDEFAULT} |
2483 |
|
echo " Latest available: ${pver}-${pbuild}" |
2484 |
|
echo " Installed versions: ${all_installed}" |
2485 |
|
echo " Description: ${description}" |
2486 |
|
echo " Homepage: ${homepage}" |
2487 |
|
echo |
2488 |
|
|
2489 |
|
unset pcat |
2490 |
|
unset pname |
2491 |
|
unset magefile |
2492 |
|
unset pver |
2493 |
|
unset pbuild |
2494 |
|
unset state |
2495 |
|
unset descriptiom |
2496 |
|
unset homepage |
2497 |
|
unset all_installed |
2498 |
|
unset ipver |
2499 |
|
unset ipbuild |
2500 |
|
done |
2501 |
|
} |