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.32 2007-06-30 15:31:46 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.34 2007-11-05 19:34:36 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
1430 |
################################################### |
################################################### |
1431 |
count_protected_files() |
count_protected_files() |
1432 |
{ |
{ |
1433 |
${MLIBDIR}/writeprotected "$1" |
local file="$1" |
1434 |
|
local dirname="${file%/*}" |
1435 |
|
local filename="${file##*/}" |
1436 |
|
local count |
1437 |
|
local output |
1438 |
|
local i |
1439 |
|
|
1440 |
|
declare -i count=0 |
1441 |
|
|
1442 |
|
# check if there are already protected files |
1443 |
|
for oldpretected in $(find ${dirname} -iname "._cfg????_${filename}" | |
1444 |
|
sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" | |
1445 |
|
sort -t'%' -k3 -k2 | cut -f1 -d'%') |
1446 |
|
do |
1447 |
|
count=$(echo ${oldpretected} | cut -d_ -f2 | sed -e "s:cfg::") |
1448 |
|
done |
1449 |
|
(( count ++ )) |
1450 |
|
|
1451 |
|
# fill output up with zeros |
1452 |
|
for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done |
1453 |
|
output="${output}${count}" |
1454 |
|
|
1455 |
|
echo "${output}" |
1456 |
} |
} |
1457 |
|
|
1458 |
# call with |
# call with |
2362 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
2363 |
echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}" |
echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}" |
2364 |
echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}" |
echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}" |
2365 |
echo [04] app-emulation/virtualbox-1.4.0-r3 |
echo |
2366 |
if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ] |
if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ] |
2367 |
then |
then |
2368 |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
2428 |
for i in $* |
for i in $* |
2429 |
do |
do |
2430 |
case $1 in |
case $1 in |
2431 |
--pcat|-c) shift; pcat="$1" ;; [04] app-emulation/virtualbox-1.4.0-r3 |
--pcat|-c) shift; pcat="$1" ;; |
2432 |
--pname|-n) shift; pname="$1" ;; |
--pname|-n) shift; pname="$1" ;; |
2433 |
--pver|-v) shift; pver="$1" ;; |
--pver|-v) shift; pver="$1" ;; |
2434 |
--pbuild|-b) shift; pbuild="$1" ;; [04] app-emulation/virtualbox-1.4.0-r3 |
--pbuild|-b) shift; pbuild="$1" ;; |
2435 |
esac |
esac |
2436 |
shift |
shift |
2437 |
done [04] app-emulation/virtualbox-1.4.0-r3 |
done |
2438 |
|
|
2439 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
2440 |
[ -z "${pcat}" ] && die "mage_uninstall() \$pcat not given." [04] app-emulation/virtualbox-1.4.0-r3 |
[ -z "${pcat}" ] && die "mage_uninstall() \$pcat not given." |
2441 |
[ -z "${pname}" ] && die "mage_uninstall() \$pname not given." |
[ -z "${pname}" ] && die "mage_uninstall() \$pname not given." |
2442 |
[ -z "${pver}" ] && die "mage_uninstall() \$pver not given." |
[ -z "${pver}" ] && die "mage_uninstall() \$pver not given." |
2443 |
[ -z "${pbuild}" ] && die "mage_uninstall() \$pbuild not given." [04] app-emulation/virtualbox-1.4.0-r3 |
[ -z "${pbuild}" ] && die "mage_uninstall() \$pbuild not given." |
2444 |
|
|
2445 |
# check needed global vars |
# check needed global vars |
2446 |
[ -z "${MAGEDIR}" ] && die "mage_uninstall() \$MAGEDIR not set." |
[ -z "${MAGEDIR}" ] && die "mage_uninstall() \$MAGEDIR not set." |