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.33 2007-06-30 15:38:50 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.35 2008-02-10 12:26:09 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 |
2177 |
echo B:${pbuild} |
echo B:${pbuild} |
2178 |
fi |
fi |
2179 |
|
|
2180 |
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
if [[ -z ${MAGE_TARGETS} ]] |
2181 |
|
then |
2182 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2183 |
|
else |
2184 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 |
2185 |
|
fi |
2186 |
if [ -f "${smage2file}" ] |
if [ -f "${smage2file}" ] |
2187 |
then |
then |
2188 |
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |