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.18 2006-04-27 11:52:53 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.38 2008-10-05 10:32:24 niro Exp $ |
4 |
|
|
5 |
mage_setup() |
mage_setup() |
6 |
{ |
{ |
198 |
is_config_protected "${pathto}" |
is_config_protected "${pathto}" |
199 |
retval="$?" |
retval="$?" |
200 |
|
|
201 |
# 0 - not protected # |
# 0 - not protected # |
202 |
# 1 - error # |
# 1 - error # |
203 |
# 2 - protected # |
# 2 - protected # |
204 |
# 3 - protected but masked # |
# 3 - protected but masked # |
205 |
|
# 4 - protected but ignored # |
206 |
|
|
207 |
case ${retval} in |
case ${retval} in |
208 |
# file is not protected - (over)write it |
# file is not protected - (over)write it |
253 |
(( MAGE_PROTECT_COUNTER++ )) |
(( MAGE_PROTECT_COUNTER++ )) |
254 |
export MAGE_PROTECT_COUNTER |
export MAGE_PROTECT_COUNTER |
255 |
;; |
;; |
256 |
|
|
257 |
|
# file is protected but ignored, delete the update/do nothing |
258 |
|
4) |
259 |
|
if [[ ${VERBOSE} = on ]] |
260 |
|
then |
261 |
|
echo -en "${COLRED}" |
262 |
|
echo -n "! ignr " |
263 |
|
echo -en "${COLDEFAULT}" |
264 |
|
echo " === FILE: ${MROOT}${pathto}" |
265 |
|
fi |
266 |
|
# simply do nothing here |
267 |
|
;; |
268 |
esac |
esac |
269 |
done < ${BUILDDIR}/${pkgname}/.files |
done < ${BUILDDIR}/${pkgname}/.files |
270 |
|
|
311 |
|
|
312 |
ln -snf "${link}" "${MROOT}${pathto}" |
ln -snf "${link}" "${MROOT}${pathto}" |
313 |
|
|
314 |
# fix mtime and db |
# # fix mtime and db |
315 |
fix_descriptor ${pkgname}/.symlinks \ |
# fix_descriptor ${pkgname}/.symlinks \ |
316 |
"${pathto}" \ |
# "${pathto}" \ |
317 |
"${posix}" \ |
# "${posix}" \ |
318 |
"${link}" \ |
# "${link}" \ |
319 |
"$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ |
# "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ |
320 |
"${MROOT}${pathto}")" |
# "${MROOT}${pathto}")" |
321 |
|
|
322 |
done < ${BUILDDIR}/${pkgname}/.symlinks |
done < ${BUILDDIR}/${pkgname}/.symlinks |
323 |
|
|
324 |
# now copy the fixed file over the old one |
# # now copy the fixed file over the old one |
325 |
[ -f ${BUILDDIR}/${pkgname}/.symlinks_fixed ] && \ |
# [ -f ${BUILDDIR}/${pkgname}/.symlinks_fixed ] && \ |
326 |
cp -f ${BUILDDIR}/${pkgname}/.symlinks{_fixed,} |
# cp -f ${BUILDDIR}/${pkgname}/.symlinks{_fixed,} |
327 |
|
|
328 |
# very important: unsetting the '§' fieldseperator |
# very important: unsetting the '§' fieldseperator |
329 |
IFS=$'\n' |
IFS=$'\n' |
822 |
is_config_protected "${pathto}" |
is_config_protected "${pathto}" |
823 |
retval="$?" |
retval="$?" |
824 |
|
|
825 |
# 0 - not protected # |
# 0 - not protected # |
826 |
# 1 - error # |
# 1 - error # |
827 |
# 2 - protected # |
# 2 - protected # |
828 |
# 3 - protected but masked # |
# 3 - protected but masked # |
829 |
|
# 4 - protected but ignored # |
830 |
|
|
831 |
case ${retval} in |
case ${retval} in |
832 |
# file is not protected - delete it |
# file is not protected - delete it |
845 |
echo " === FILE: ${MROOT}${pathto}" |
echo " === FILE: ${MROOT}${pathto}" |
846 |
fi |
fi |
847 |
;; |
;; |
848 |
|
|
849 |
|
# file is protected but ignored, delete the update/do nothing |
850 |
|
4) |
851 |
|
if [[ ${VERBOSE} = on ]] |
852 |
|
then |
853 |
|
echo -en "${COLRED}" |
854 |
|
echo -n "! ignr " |
855 |
|
echo -en "${COLDEFAULT}" |
856 |
|
echo " === FILE: ${MROOT}${pathto}" |
857 |
|
fi |
858 |
|
# simply do nothing here |
859 |
|
;; |
860 |
esac |
esac |
861 |
;; |
;; |
862 |
1) |
1) |
1132 |
local count_current |
local count_current |
1133 |
local count_total |
local count_total |
1134 |
|
|
1135 |
[ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your /etc/mage.rc." |
[ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}." |
1136 |
|
|
1137 |
# get count of total packages |
# get count of total packages |
1138 |
declare -i count_current=0 |
declare -i count_current=0 |
1207 |
{ |
{ |
1208 |
if [ -z "${RSYNC}" ] |
if [ -z "${RSYNC}" ] |
1209 |
then |
then |
1210 |
die "You have no rsync-mirrors defined. Please edit your /etc/mage.rc." |
die "You have no rsync-mirrors defined. Please edit your ${MAGERC}." |
1211 |
fi |
fi |
1212 |
|
|
1213 |
local i |
local i |
1214 |
for i in ${RSYNC} |
for i in ${RSYNC} |
1215 |
do |
do |
1216 |
rsync \ |
rsync ${RSYNC_FETCH_OPTIONS} ${i} ${MAGEDIR} |
|
--recursive \ |
|
|
--links \ |
|
|
--perms \ |
|
|
--times \ |
|
|
--devices \ |
|
|
--timeout=600 \ |
|
|
--verbose \ |
|
|
--compress \ |
|
|
--progress \ |
|
|
--stats \ |
|
|
--delete \ |
|
|
--delete-after \ |
|
|
${i} ${MAGEDIR} |
|
1217 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1218 |
then |
then |
1219 |
break |
break |
1225 |
# clean up backup files (foo~) |
# clean up backup files (foo~) |
1226 |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
1227 |
|
|
1228 |
# check if an newer mage version is available |
# check if a newer mage version is available |
1229 |
is_newer_mage_version_available |
is_newer_mage_version_available |
1230 |
} |
} |
1231 |
|
|
1232 |
|
syncmage_tarball() |
1233 |
|
{ |
1234 |
|
local latest_tarball |
1235 |
|
local temp="$(mktemp -d)" |
1236 |
|
local mirr mymirr |
1237 |
|
|
1238 |
|
# try to get the tarball marked as latest on the server |
1239 |
|
latest_tarball="mage-latest.tar.bz2" |
1240 |
|
|
1241 |
|
for mirr in ${MIRRORS} |
1242 |
|
do |
1243 |
|
# path without distribution |
1244 |
|
mymirr="${mirr%/*}" |
1245 |
|
|
1246 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1247 |
|
echo "fetching latest tarball from ${mymirr} ..." |
1248 |
|
|
1249 |
|
wget \ |
1250 |
|
--passive-ftp \ |
1251 |
|
--tries 3 \ |
1252 |
|
--continue \ |
1253 |
|
--progress bar \ |
1254 |
|
--directory-prefix=${temp} \ |
1255 |
|
${mymirr}/rsync/tarballs/${latest_tarball} |
1256 |
|
if [[ $? = 0 ]] |
1257 |
|
then |
1258 |
|
break |
1259 |
|
else |
1260 |
|
continue |
1261 |
|
fi |
1262 |
|
done |
1263 |
|
|
1264 |
|
if [[ -f ${temp}/${latest_tarball} ]] |
1265 |
|
then |
1266 |
|
if [[ -d ${MAGEDIR} ]] |
1267 |
|
then |
1268 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1269 |
|
echo "cleaning old mage-tree ${MAGEDIR}..." |
1270 |
|
rm -rf ${MAGEDIR} |
1271 |
|
fi |
1272 |
|
|
1273 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1274 |
|
echo "updating mage-tree from tarball ..." |
1275 |
|
# unpack in dirname of MAGEDIR, as the tarball has already the mage |
1276 |
|
tar xjmf ${temp}/${latest_tarball} -C ${MAGEDIR%/*} || die "Unpacking tarball" |
1277 |
|
|
1278 |
|
if [[ -d ${temp} ]] |
1279 |
|
then |
1280 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1281 |
|
echo "clenaing temp-files ..." |
1282 |
|
rm -rf ${temp} |
1283 |
|
fi |
1284 |
|
|
1285 |
|
# check if a newer mage version is available |
1286 |
|
is_newer_mage_version_available |
1287 |
|
else |
1288 |
|
die "Could not fetch the latest tarball ... aborting" |
1289 |
|
fi |
1290 |
|
} |
1291 |
|
|
1292 |
cleanpkg() |
cleanpkg() |
1293 |
{ |
{ |
1294 |
if [ -d "${PKGDIR}" ] |
if [ -d "${PKGDIR}" ] |
1326 |
if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] |
1327 |
then |
then |
1328 |
#cuts ARCH and PBUILD |
#cuts ARCH and PBUILD |
1329 |
#ARCH comes from /etc/mage.rc |
#ARCH comes from ${MAGERC} |
1330 |
MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") |
MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") |
1331 |
|
|
1332 |
#cuts version number |
#cuts version number |
1401 |
local PNAME="$2" |
local PNAME="$2" |
1402 |
local magefile |
local magefile |
1403 |
|
|
1404 |
for magefile in $(ls --format=single-column -v ${MAGEDIR}/${PCAT}/${PNAME}/*) |
# do not list the content of a directory, only the name (-d) |
1405 |
|
for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/*) |
1406 |
do |
do |
1407 |
|
[[ -z ${magefile} ]] && continue |
1408 |
# we exclude subdirs (for stuff like a md5sum dir) |
# we exclude subdirs (for stuff like a md5sum dir) |
1409 |
[ -d ${magefile} ] && continue |
[[ -d ${magefile} ]] && continue |
1410 |
if check_stable_package ${magefile} |
if check_stable_package ${magefile} |
1411 |
then |
then |
1412 |
HIGHEST_MAGEFILE=${magefile} |
HIGHEST_MAGEFILE=${magefile} |
1451 |
# 1 - error # |
# 1 - error # |
1452 |
# 2 - protected # |
# 2 - protected # |
1453 |
# 3 - protected but masked # |
# 3 - protected but masked # |
1454 |
|
# 4 - protected but ignored # |
1455 |
# # |
# # |
1456 |
################################################### |
################################################### |
1457 |
is_config_protected() |
is_config_protected() |
1460 |
local TEST |
local TEST |
1461 |
local PROTECTED |
local PROTECTED |
1462 |
local IFS |
local IFS |
1463 |
|
local i |
1464 |
|
local x |
1465 |
|
|
1466 |
EXPFILE="${MROOT}$1" |
EXPFILE="${MROOT}$1" |
1467 |
|
|
1468 |
# file does not exist; it can be written |
# file does not exist; it can be written |
1469 |
[ ! -e ${EXPFILE} ] && return 0 |
[[ ! -e ${EXPFILE} ]] && return 0 |
1470 |
|
|
1471 |
# to be safe; it may be '§' |
# to be safe; it may be '§' |
1472 |
IFS=' ' |
IFS=' ' |
1473 |
|
|
1474 |
# check ob in config protect |
# check if config protected |
1475 |
for i in ${CONFIG_PROTECT} |
for i in ${CONFIG_PROTECT} |
1476 |
do |
do |
1477 |
# ersetzen von $i nur wenn am anfang der variable |
# only replace $i in the beginning of the variable |
1478 |
TEST="${EXPFILE/#${MROOT}${i}/Protected}" |
TEST="${EXPFILE/#${MROOT}${i}/Protected}" |
1479 |
if [ "${TEST}" != "${EXPFILE}" ] |
if [[ ${TEST} != ${EXPFILE} ]] |
1480 |
then |
then |
1481 |
# setzen das es protected ist |
# file is config proteced |
1482 |
PROTECTED=TRUE |
PROTECTED=TRUE |
1483 |
|
|
1484 |
# check ob nicht doch maskiert |
# check if not masked |
1485 |
for x in ${CONFIG_PROTECT_MASK} |
for x in ${CONFIG_PROTECT_MASK} |
1486 |
do |
do |
1487 |
TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" |
TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" |
1488 |
if [ "${TEST}" != "${EXPFILE}" ] |
if [[ ${TEST} != ${EXPFILE} ]] |
1489 |
then |
then |
1490 |
PROTECTED=MASKED |
PROTECTED=MASKED |
1491 |
fi |
fi |
1492 |
done |
done |
1493 |
|
|
1494 |
|
# check if not ignored |
1495 |
|
for x in ${CONFIG_PROTECT_IGNORE} |
1496 |
|
do |
1497 |
|
TEST="${EXPFILE/#${MROOT}${x}/Protect_Ignored}" |
1498 |
|
if [[ ${TEST} != ${EXPFILE} ]] |
1499 |
|
then |
1500 |
|
PROTECTED=IGNORED |
1501 |
|
fi |
1502 |
|
done |
1503 |
fi |
fi |
1504 |
done |
done |
1505 |
|
|
1514 |
#echo "I'm protected, but masked - delete me" |
#echo "I'm protected, but masked - delete me" |
1515 |
return 3 |
return 3 |
1516 |
;; |
;; |
1517 |
|
IGNORED) |
1518 |
|
#echo "I'm protected, but ignored - keep me, del update" |
1519 |
|
return 4 |
1520 |
|
;; |
1521 |
*) |
*) |
1522 |
#echo "delete me" |
#echo "delete me" |
1523 |
return 0 |
return 0 |
1535 |
################################################### |
################################################### |
1536 |
count_protected_files() |
count_protected_files() |
1537 |
{ |
{ |
1538 |
${MLIBDIR}/writeprotected "$1" |
local file="$1" |
1539 |
|
local dirname="${file%/*}" |
1540 |
|
local filename="${file##*/}" |
1541 |
|
local count |
1542 |
|
local output |
1543 |
|
local i |
1544 |
|
|
1545 |
|
declare -i count=0 |
1546 |
|
|
1547 |
|
# check if there are already protected files |
1548 |
|
for oldpretected in $(find ${dirname} -iname "._cfg????_${filename}" | |
1549 |
|
sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" | |
1550 |
|
sort -t'%' -k3 -k2 | cut -f1 -d'%') |
1551 |
|
do |
1552 |
|
count=$(echo ${oldpretected} | cut -d_ -f2 | sed -e "s:cfg::") |
1553 |
|
done |
1554 |
|
(( count ++ )) |
1555 |
|
|
1556 |
|
# fill output up with zeros |
1557 |
|
for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done |
1558 |
|
output="${output}${count}" |
1559 |
|
|
1560 |
|
echo "${output}" |
1561 |
} |
} |
1562 |
|
|
1563 |
# call with |
# call with |
1574 |
local list |
local list |
1575 |
local pcatdir |
local pcatdir |
1576 |
local protected |
local protected |
1577 |
|
local i |
1578 |
|
|
1579 |
# very basic getops |
# very basic getops |
1580 |
for i in $* |
for i in $* |
1836 |
{ |
{ |
1837 |
local i |
local i |
1838 |
|
|
1839 |
if [ -n "$@" ] |
if [[ -n $* ]] |
1840 |
then |
then |
1841 |
for i in $@ |
for i in $* |
1842 |
do |
do |
1843 |
[[ ${MAGEDEBUG} = on ]] && \ |
[[ ${MAGEDEBUG} = on ]] && \ |
1844 |
echo "--- Including ${MAGEDIR}/include/${i}.minc" |
echo "--- Including ${MAGEDIR}/include/${i}.minc" |
1852 |
{ |
{ |
1853 |
local i |
local i |
1854 |
|
|
1855 |
if [ -n "$@" ] |
if [[ -n $* ]] |
1856 |
then |
then |
1857 |
for i in $@ |
for i in $* |
1858 |
do |
do |
1859 |
echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" |
echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" |
1860 |
source ${SMAGESCRIPTSDIR}/include/${i}.sminc |
source ${SMAGESCRIPTSDIR}/include/${i}.sminc |
1878 |
echo -en ${COLRED}"An update for your packetmanager is available. "${COLDEFAULT} |
echo -en ${COLRED}"An update for your packetmanager is available. "${COLDEFAULT} |
1879 |
echo -e ${COLBLUE}"[ ${newest_mage} ]"${COLDEFAULT} |
echo -e ${COLBLUE}"[ ${newest_mage} ]"${COLDEFAULT} |
1880 |
echo "It is recommened to install this newer version" |
echo "It is recommened to install this newer version" |
1881 |
echo "or your current system installation may brake." |
echo "or your current system installation may break." |
1882 |
echo |
echo |
1883 |
echo -en "Please update mage by running " |
echo -en "Please update mage by running " |
1884 |
echo -e ${COLGREEN}"'mage install mage'"${COLDEFAULT} |
echo -e ${COLGREEN}"'mage install mage'"${COLDEFAULT} |
2163 |
local SDEPEND |
local SDEPEND |
2164 |
local PROVIDE |
local PROVIDE |
2165 |
local PKGTYPE |
local PKGTYPE |
2166 |
|
local MAGE_TARGETS |
2167 |
|
local SPLIT_PACKAGE_BASE |
2168 |
local preinstall |
local preinstall |
2169 |
local postinstall |
local postinstall |
2170 |
local preremove |
local preremove |
2211 |
local count_current |
local count_current |
2212 |
local magefile |
local magefile |
2213 |
local src_install |
local src_install |
2214 |
|
local i |
2215 |
|
|
2216 |
# very basic getops |
# very basic getops |
2217 |
for i in $* |
for i in $* |
2285 |
echo B:${pbuild} |
echo B:${pbuild} |
2286 |
fi |
fi |
2287 |
|
|
2288 |
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
if [[ -n ${MAGE_TARGETS} ]] |
2289 |
|
then |
2290 |
|
# basic svn compat |
2291 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2292 |
|
then |
2293 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 |
2294 |
|
do |
2295 |
|
smage2file="${i}" |
2296 |
|
done |
2297 |
|
else |
2298 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 |
2299 |
|
fi |
2300 |
|
|
2301 |
|
elif [[ -n ${SPLIT_PACKAGE_BASE} ]] |
2302 |
|
then |
2303 |
|
# basic svn compat |
2304 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2305 |
|
then |
2306 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 |
2307 |
|
do |
2308 |
|
smage2file="${i}" |
2309 |
|
done |
2310 |
|
else |
2311 |
|
smage2file=${SMAGESCRIPTSDIR}/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 |
2312 |
|
fi |
2313 |
|
|
2314 |
|
else |
2315 |
|
# basic svn compat |
2316 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2317 |
|
then |
2318 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2319 |
|
do |
2320 |
|
smage2file="${i}" |
2321 |
|
done |
2322 |
|
else |
2323 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2324 |
|
fi |
2325 |
|
fi |
2326 |
|
|
2327 |
if [ -f "${smage2file}" ] |
if [ -f "${smage2file}" ] |
2328 |
then |
then |
2329 |
|
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |
2330 |
smage2 ${smage2file} || die "compile failed" |
smage2 ${smage2file} || die "compile failed" |
2331 |
else |
else |
2332 |
echo |
echo |
2340 |
if [[ ${PKGTYPE} != virtual ]] && \ |
if [[ ${PKGTYPE} != virtual ]] && \ |
2341 |
[[ ${PKGTYPE} != sources ]] |
[[ ${PKGTYPE} != sources ]] |
2342 |
then |
then |
2343 |
# show a verbose message on src-install |
echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... " |
|
if [[ ${src_install} = true ]] |
|
|
then |
|
|
echo -ne "${COLBLUE} *** ${COLDEFAULT}" |
|
|
echo -ne "merging files: " |
|
|
echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
|
|
echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}" |
|
|
fi |
|
2344 |
build_doinstall ${PKGNAME} |
build_doinstall ${PKGNAME} |
2345 |
fi |
fi |
2346 |
|
|
2597 |
echo -ne "${COLBLUE} <<< ${COLDEFAULT}" |
echo -ne "${COLBLUE} <<< ${COLDEFAULT}" |
2598 |
echo -n "removing: " |
echo -n "removing: " |
2599 |
echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" |
2600 |
echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}" |
echo -e "${COLRED}${pname}-${pver}-${pbuild}${COLDEFAULT}" |
2601 |
|
|
2602 |
magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage" |
magefile="${MROOT}${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage" |
2603 |
source ${magefile} |
source ${magefile} |
2604 |
|
|
2605 |
## preremove scripts |
## preremove scripts |
2697 |
local all_installed |
local all_installed |
2698 |
local ipver |
local ipver |
2699 |
local ipbuild |
local ipbuild |
2700 |
|
local latest_available |
2701 |
|
local depsfull |
2702 |
|
local sdepsfull |
2703 |
|
local deps |
2704 |
|
local sdeps |
2705 |
|
local dep |
2706 |
|
local sign |
2707 |
|
|
2708 |
# only names no versions |
# only names no versions |
2709 |
result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*')" |
result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*'| sed '/profiles/d' | sed '/includes/d')" |
2710 |
#result="$(find ${MAGEDIR} -type f -name '*'${string}'*'.mage | sort)" |
#result="$(find ${MAGEDIR} -type f -name '*'${string}'*'.mage | sort)" |
2711 |
|
|
2712 |
# nothing found |
# nothing found |
2721 |
# get highest version available |
# get highest version available |
2722 |
magefile=$(get_highest_magefile ${pcat} ${pname}) |
magefile=$(get_highest_magefile ${pcat} ${pname}) |
2723 |
|
|
2724 |
# now get all needed infos to print a nice output |
if [[ ! -z ${magefile} ]] |
2725 |
pver="$(magename2pver ${magefile})" |
then |
2726 |
pbuild="$(magename2pbuild ${magefile})" |
# now get all needed infos to print a nice output |
2727 |
state="$(get_value_from_magefile STATE ${magefile})" |
pver="$(magename2pver ${magefile})" |
2728 |
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
pbuild="$(magename2pbuild ${magefile})" |
2729 |
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
state="$(get_value_from_magefile STATE ${magefile})" |
2730 |
|
description="$(get_value_from_magefile DESCRIPTION ${magefile})" |
2731 |
|
homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" |
2732 |
|
|
2733 |
|
# all installed |
2734 |
|
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
2735 |
|
do |
2736 |
|
ipver="$(magename2pver ${i})" |
2737 |
|
ipbuild="$(magename2pbuild ${i})" |
2738 |
|
|
2739 |
|
if [[ -z ${all_installed} ]] |
2740 |
|
then |
2741 |
|
all_installed="${ipver}-${ipbuild}" |
2742 |
|
else |
2743 |
|
all_installed="${all_installed} ${ipver}-${ipbuild}" |
2744 |
|
fi |
2745 |
|
done |
2746 |
|
[[ -z ${all_installed} ]] && all_installed="none" |
2747 |
|
|
2748 |
|
case ${state} in |
2749 |
|
stable) state=${COLGREEN}"[s] ";; |
2750 |
|
testing) state=${COLYELLOW}"[t] ";; |
2751 |
|
unstable) state=${COLRED}"[u] ";; |
2752 |
|
old) state=${COLGRAY}"[o] ";; |
2753 |
|
esac |
2754 |
|
|
2755 |
# all installed |
latest_available="${pver}-${pbuild}" |
2756 |
for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) |
else |
2757 |
do |
# package is masked |
2758 |
ipver="$(magename2pver ${i})" |
state="${COLRED}[m] " |
2759 |
ipbuild="$(magename2pbuild ${i})" |
latest_available="${COLRED}masked for this distribution.${COLDEFAULT}" |
2760 |
|
fi |
2761 |
|
|
2762 |
if [[ -z ${all_installed} ]] |
depsfull="$(get_value_from_magefile DEPEND ${magefile})" |
2763 |
then |
sdepsfull="$(get_value_from_magefile SDEPEND ${magefile})" |
|
all_installed="${ipver}-${ipbuild}" |
|
|
else |
|
|
all_installed="${all_installed} ${ipver}-${ipbuild}" |
|
|
fi |
|
|
done |
|
|
[[ -z ${all_installed} ]] && all_installed="none" |
|
2764 |
|
|
2765 |
case ${state} in |
while read sign dep |
2766 |
stable) state=${COLGREEN}"[s] ";; |
do |
2767 |
testing) state=${COLYELLOW}"[t] ";; |
case ${dep} in |
2768 |
unstable) state=${COLRED}"[u] ";; |
"") continue;; |
2769 |
old) state=${COLGRAY}"[o] ";; |
esac |
2770 |
esac |
|
2771 |
|
deps="${deps} $(basename ${dep%-*})" |
2772 |
|
done << EOF |
2773 |
|
${depsfull} |
2774 |
|
EOF |
2775 |
|
|
2776 |
|
while read sign dep |
2777 |
|
do |
2778 |
|
case ${dep} in |
2779 |
|
"") continue;; |
2780 |
|
esac |
2781 |
|
|
2782 |
|
sdeps="${sdeps} $(basename ${dep%-*})" |
2783 |
|
done << EOF |
2784 |
|
${sdepsfull} |
2785 |
|
EOF |
2786 |
|
|
2787 |
echo -e "${state}${pcat}/${pname}"${COLDEFAULT} |
echo -e "${state}${pcat}/${pname}"${COLDEFAULT} |
2788 |
echo " Latest available: ${pver}-${pbuild}" |
echo -e " Latest available: ${latest_available}" |
2789 |
echo " Installed versions: ${all_installed}" |
echo " Installed versions: ${all_installed}" |
2790 |
echo " Description: ${description}" |
echo " Description: ${description}" |
2791 |
echo " Homepage: ${homepage}" |
echo " Homepage: ${homepage}" |
2792 |
|
echo " Depends: ${deps}" |
2793 |
|
echo " SDepends: ${sdeps}" |
2794 |
echo |
echo |
2795 |
|
|
2796 |
unset pcat |
unset pcat |
2804 |
unset all_installed |
unset all_installed |
2805 |
unset ipver |
unset ipver |
2806 |
unset ipbuild |
unset ipbuild |
2807 |
|
unset depsfull |
2808 |
|
unset sdepsfull |
2809 |
|
unset deps |
2810 |
|
unset sdeps |
2811 |
|
unset dep |
2812 |
|
unset sign |
2813 |
done |
done |
2814 |
} |
} |
2815 |
|
|
2852 |
[[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable |
[[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable |
2853 |
[[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing |
[[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing |
2854 |
|
|
2855 |
local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" |
# support both types for the moment |
2856 |
|
if [[ -f /etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION} ]] |
2857 |
|
then |
2858 |
|
local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" |
2859 |
|
else |
2860 |
|
local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}" |
2861 |
|
fi |
2862 |
|
|
2863 |
# return 0 if the list not exist; nothin is masked |
# return 0 if the list not exist; nothin is masked |
2864 |
[[ ! -f ${EXCLUDED} ]] && return 0 |
[[ ! -f ${EXCLUDED} ]] && return 0 |