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.34 2007-11-05 19:34:36 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' |
339 |
local pkgname="$1" |
local pkgname="$1" |
340 |
local pathto |
local pathto |
341 |
local posix |
local posix |
342 |
|
local user |
343 |
|
local group |
344 |
local IFS |
local IFS |
345 |
|
|
346 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
354 |
# sets fieldseperator to "§" instead of " " |
# sets fieldseperator to "§" instead of " " |
355 |
IFS=§ |
IFS=§ |
356 |
|
|
357 |
while read pathto posix |
while read pathto posix user group |
358 |
do |
do |
359 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
360 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> PIPE: ${MROOT}${pathto}" |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> PIPE: ${MROOT}${pathto}" |
361 |
|
|
362 |
mkfifo -m "${posix}" "${MROOT}$pathto" |
mkfifo -m "${posix}" "${MROOT}${pathto}" |
363 |
|
# make it optional atm !! |
364 |
|
if [[ ! -z ${user} ]] && [[ ! -z ${group} ]] |
365 |
|
then |
366 |
|
chown "${user}:${group}" "${MROOT}${pathto}" |
367 |
|
fi |
368 |
done < ${BUILDDIR}/${pkgname}/.pipes |
done < ${BUILDDIR}/${pkgname}/.pipes |
369 |
|
|
370 |
# very important: unsetting the '§' fieldseperator |
# very important: unsetting the '§' fieldseperator |
383 |
local posix |
local posix |
384 |
local major |
local major |
385 |
local minor |
local minor |
386 |
|
local user |
387 |
|
local group |
388 |
local IFS |
local IFS |
389 |
|
|
390 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
398 |
# sets fieldseperator to "§" instead of " " |
# sets fieldseperator to "§" instead of " " |
399 |
IFS=§ |
IFS=§ |
400 |
|
|
401 |
while read pathto posix major minor |
while read pathto posix major minor user group |
402 |
do |
do |
403 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
404 |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
[[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}" |
405 |
|
|
406 |
mknod -m ${posix} "${MROOT}${pathto}" c ${major} ${minor} |
mknod -m ${posix} "${MROOT}${pathto}" c ${major} ${minor} |
407 |
|
|
408 |
|
# make it optional atm !! |
409 |
|
if [[ ! -z ${user} ]] && [[ ! -z ${group} ]] |
410 |
|
then |
411 |
|
chown "${user}:${group}" "${MROOT}${pathto}" |
412 |
|
fi |
413 |
done < ${BUILDDIR}/${pkgname}/.char |
done < ${BUILDDIR}/${pkgname}/.char |
414 |
|
|
415 |
# very important: unsetting the '§' fieldseperator |
# very important: unsetting the '§' fieldseperator |
416 |
IFS=$'\n' |
IFS=$'\n' |
417 |
} |
} |
418 |
|
|
419 |
|
################################################### |
420 |
|
# function install_fifos # |
421 |
|
# install_fifos $PKGNAME # |
422 |
|
################################################### |
423 |
|
install_fifos() |
424 |
|
{ |
425 |
|
local pkgname="$1" |
426 |
|
local pathto |
427 |
|
local posix |
428 |
|
local user |
429 |
|
local group |
430 |
|
local IFS |
431 |
|
|
432 |
|
# sanity checks; abort if not given |
433 |
|
[ -z "${pkgname}" ] && die "install_fifos() \$pkgname not given." |
434 |
|
|
435 |
|
# check needed global vars |
436 |
|
[ -z "${BUILDDIR}" ] && die "install_fifos() \$BUILDDIR not set." |
437 |
|
|
438 |
|
# make it optional atm !! |
439 |
|
#[ ! -f ${BUILDDIR}/${pkgname}/.fifo ] && die "install_fifos() .fifo not found" |
440 |
|
[ ! -f ${BUILDDIR}/${pkgname}/.fifo ] && return |
441 |
|
|
442 |
|
# sets fieldseperator to "§" instead of " " |
443 |
|
IFS=§ |
444 |
|
|
445 |
|
while read pathto posix user group |
446 |
|
do |
447 |
|
[ -z "${pathto}" ] && continue |
448 |
|
[[ ${VERBOSE} = on ]] && echo -e "\t>>> FIFO: ${MROOT}${pathto}" |
449 |
|
|
450 |
|
mkfifo -m "${posix}" "${MROOT}${pathto}" |
451 |
|
chown "${user}:${group}" "${MROOT}${pathto}" |
452 |
|
done < ${BUILDDIR}/${pkgname}/.fifo |
453 |
|
|
454 |
|
# very important: unsetting the '§' fieldseperator |
455 |
|
IFS=$'\n' |
456 |
|
} |
457 |
|
|
458 |
|
|
459 |
################################################### |
################################################### |
460 |
# function build_doinstall # |
# function build_doinstall # |
461 |
# build_doinstall $PKGNAME # |
# build_doinstall $PKGNAME # |
462 |
# NOTE: this is an wrapper do install packages # |
# NOTE: this is an wrapper to install packages # |
463 |
################################################### |
################################################### |
464 |
build_doinstall() |
build_doinstall() |
465 |
{ |
{ |
482 |
install_symlinks ${pkgname} || die "install symlinks ${pkgname}" |
install_symlinks ${pkgname} || die "install symlinks ${pkgname}" |
483 |
install_blockdevices ${pkgname} || die "install blockdevices ${pkgname}" |
install_blockdevices ${pkgname} || die "install blockdevices ${pkgname}" |
484 |
install_characterdevices ${pkgname} || die "install chardevices ${pkgname}" |
install_characterdevices ${pkgname} || die "install chardevices ${pkgname}" |
485 |
|
install_fifos ${pkgname} || die "install fifos ${pkgname}" |
486 |
} |
} |
487 |
|
|
488 |
|
|
544 |
|
|
545 |
# create fake file descriptors |
# create fake file descriptors |
546 |
# used by virtual and source packages |
# used by virtual and source packages |
547 |
for i in .dirs .symlinks .files .pipes .char |
for i in .dirs .symlinks .files .pipes .char .fifo |
548 |
do |
do |
549 |
touch ${dbrecorddir}/${i} |
touch ${dbrecorddir}/${i} |
550 |
done |
done |
562 |
|
|
563 |
# normal packages needs these files |
# normal packages needs these files |
564 |
local i |
local i |
565 |
for i in .char .dirs .files .pipes .symlinks |
for i in .char .dirs .files .pipes .symlinks .fifo |
566 |
do |
do |
567 |
install -m 0644 ${BUILDDIR}/${pkgname}/${i} \ |
install -m 0644 ${BUILDDIR}/${pkgname}/${i} \ |
568 |
${dbrecorddir}/${i} |
${dbrecorddir}/${i} |
840 |
done |
done |
841 |
|
|
842 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
843 |
[ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given." |
[ -z "${pcat}" ] && die "remove_files() \$pcat not given." |
844 |
[ -z "${pname}" ] && die "remove_symlinks() \$pname not given." |
[ -z "${pname}" ] && die "remove_files() \$pname not given." |
845 |
[ -z "${pver}" ] && die "remove_symlinks() \$pver not given." |
[ -z "${pver}" ] && die "remove_files() \$pver not given." |
846 |
[ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given." |
[ -z "${pbuild}" ] && die "remove_files() \$pbuild not given." |
847 |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
848 |
|
|
849 |
# check needed global vars |
# check needed global vars |
877 |
is_config_protected "${pathto}" |
is_config_protected "${pathto}" |
878 |
retval="$?" |
retval="$?" |
879 |
|
|
880 |
# 0 - not protected # |
# 0 - not protected # |
881 |
# 1 - error # |
# 1 - error # |
882 |
# 2 - protected # |
# 2 - protected # |
883 |
# 3 - protected but masked # |
# 3 - protected but masked # |
884 |
|
# 4 - protected but ignored # |
885 |
|
|
886 |
case ${retval} in |
case ${retval} in |
887 |
# file is not protected - delete it |
# file is not protected - delete it |
900 |
echo " === FILE: ${MROOT}${pathto}" |
echo " === FILE: ${MROOT}${pathto}" |
901 |
fi |
fi |
902 |
;; |
;; |
903 |
|
|
904 |
|
# file is protected but ignored, delete the update/do nothing |
905 |
|
4) |
906 |
|
if [[ ${VERBOSE} = on ]] |
907 |
|
then |
908 |
|
echo -en "${COLRED}" |
909 |
|
echo -n "! ignr " |
910 |
|
echo -en "${COLDEFAULT}" |
911 |
|
echo " === FILE: ${MROOT}${pathto}" |
912 |
|
fi |
913 |
|
# simply do nothing here |
914 |
|
;; |
915 |
esac |
esac |
916 |
;; |
;; |
917 |
1) |
1) |
934 |
{ |
{ |
935 |
local pathto |
local pathto |
936 |
local posix |
local posix |
937 |
|
local user |
938 |
|
local group |
939 |
local IFS |
local IFS |
940 |
local pcat |
local pcat |
941 |
local pname |
local pname |
959 |
done |
done |
960 |
|
|
961 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
962 |
[ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given." |
[ -z "${pcat}" ] && die "remove_blockdevices() \$pcat not given." |
963 |
[ -z "${pname}" ] && die "remove_symlinks() \$pname not given." |
[ -z "${pname}" ] && die "remove_blockdevices() \$pname not given." |
964 |
[ -z "${pver}" ] && die "remove_symlinks() \$pver not given." |
[ -z "${pver}" ] && die "remove_blockdevices() \$pver not given." |
965 |
[ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given." |
[ -z "${pbuild}" ] && die "remove_blockdevices() \$pbuild not given." |
966 |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
967 |
|
|
968 |
# check needed global vars |
# check needed global vars |
973 |
# sets fieldseperator to "§" instead of " " |
# sets fieldseperator to "§" instead of " " |
974 |
IFS=§ |
IFS=§ |
975 |
|
|
976 |
while read pathto posix |
while read pathto posix user group |
977 |
do |
do |
978 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
979 |
|
|
994 |
{ |
{ |
995 |
local pathto |
local pathto |
996 |
local posix |
local posix |
997 |
|
local user |
998 |
|
local group |
999 |
local IFS |
local IFS |
1000 |
local pcat |
local pcat |
1001 |
local pname |
local pname |
1019 |
done |
done |
1020 |
|
|
1021 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
1022 |
[ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given." |
[ -z "${pcat}" ] && die "remove_characterdevices() \$pcat not given." |
1023 |
[ -z "${pname}" ] && die "remove_symlinks() \$pname not given." |
[ -z "${pname}" ] && die "remove_characterdevices() \$pname not given." |
1024 |
[ -z "${pver}" ] && die "remove_symlinks() \$pver not given." |
[ -z "${pver}" ] && die "remove_characterdevices() \$pver not given." |
1025 |
[ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given." |
[ -z "${pbuild}" ] && die "remove_characterdevices() \$pbuild not given." |
1026 |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
1027 |
|
|
1028 |
# check needed global vars |
# check needed global vars |
1033 |
# sets fieldseperator to "§" instead of " " |
# sets fieldseperator to "§" instead of " " |
1034 |
IFS=§ |
IFS=§ |
1035 |
|
|
1036 |
while read pathto posix |
while read pathto posix user group |
1037 |
do |
do |
1038 |
[ -z "${pathto}" ] && continue |
[ -z "${pathto}" ] && continue |
1039 |
|
|
1047 |
|
|
1048 |
|
|
1049 |
################################################### |
################################################### |
1050 |
|
# function remove_fifos # |
1051 |
|
# remove_fifos $PKGNAME # |
1052 |
|
################################################### |
1053 |
|
remove_fifos() |
1054 |
|
{ |
1055 |
|
local pathto |
1056 |
|
local posix |
1057 |
|
local user |
1058 |
|
local group |
1059 |
|
local IFS |
1060 |
|
local pcat |
1061 |
|
local pname |
1062 |
|
local pver |
1063 |
|
local pbuild |
1064 |
|
local i |
1065 |
|
local pfull |
1066 |
|
|
1067 |
|
IFS=$'\n' |
1068 |
|
|
1069 |
|
# very basic getops |
1070 |
|
for i in $* |
1071 |
|
do |
1072 |
|
case $1 in |
1073 |
|
--pcat|-c) shift; pcat="$1" ;; |
1074 |
|
--pname|-n) shift; pname="$1" ;; |
1075 |
|
--pver|-v) shift; pver="$1" ;; |
1076 |
|
--pbuild|-b) shift; pbuild="$1" ;; |
1077 |
|
esac |
1078 |
|
shift |
1079 |
|
done |
1080 |
|
|
1081 |
|
# sanity checks; abort if not given |
1082 |
|
[ -z "${pcat}" ] && die "remove_fifos() \$pcat not given." |
1083 |
|
[ -z "${pname}" ] && die "remove_fifos() \$pname not given." |
1084 |
|
[ -z "${pver}" ] && die "remove_fifos() \$pver not given." |
1085 |
|
[ -z "${pbuild}" ] && die "remove_fifos() \$pbuild not given." |
1086 |
|
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
1087 |
|
|
1088 |
|
# check needed global vars |
1089 |
|
[ -z "${BUILDDIR}" ] && die "remove_fifos() \$BUILDDIR not set." |
1090 |
|
|
1091 |
|
# make it optional atm !! |
1092 |
|
#[ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && die "remove_fifos() .fifo not found" |
1093 |
|
[ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && return |
1094 |
|
|
1095 |
|
# sets fieldseperator to "§" instead of " " |
1096 |
|
IFS=§ |
1097 |
|
|
1098 |
|
while read pathto posix user group |
1099 |
|
do |
1100 |
|
[ -z "${pathto}" ] && continue |
1101 |
|
|
1102 |
|
[[ ${VERBOSE} = on ]] && echo -e "\t<<< FIFO: ${MROOT}${pathto}" |
1103 |
|
rm "${MROOT}${pathto}" |
1104 |
|
done < ${MROOT}${INSTALLDB}/${pfull}/.fifo |
1105 |
|
|
1106 |
|
# very important: unsetting the '§' fieldseperator |
1107 |
|
IFS=$'\n' |
1108 |
|
} |
1109 |
|
|
1110 |
|
|
1111 |
|
################################################### |
1112 |
# function remove_direcories # |
# function remove_direcories # |
1113 |
# remove_direcories $PKGNAME # |
# remove_direcories $PKGNAME # |
1114 |
################################################### |
################################################### |
1139 |
done |
done |
1140 |
|
|
1141 |
# sanity checks; abort if not given |
# sanity checks; abort if not given |
1142 |
[ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given." |
[ -z "${pcat}" ] && die "remove_directories() \$pcat not given." |
1143 |
[ -z "${pname}" ] && die "remove_symlinks() \$pname not given." |
[ -z "${pname}" ] && die "remove_directories() \$pname not given." |
1144 |
[ -z "${pver}" ] && die "remove_symlinks() \$pver not given." |
[ -z "${pver}" ] && die "remove_directories() \$pver not given." |
1145 |
[ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given." |
[ -z "${pbuild}" ] && die "remove_directories() \$pbuild not given." |
1146 |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
pfull="${pcat}/${pname}-${pver}-${pbuild}" |
1147 |
|
|
1148 |
# check needed global vars |
# check needed global vars |
1196 |
################################################### |
################################################### |
1197 |
# function build_douninstall # |
# function build_douninstall # |
1198 |
# build_douninstall $PKGNAME # |
# build_douninstall $PKGNAME # |
1199 |
# NOTE: this is an wrapper do remove packages # |
# NOTE: this is an wrapper to remove packages # |
1200 |
################################################### |
################################################### |
1201 |
build_douninstall() |
build_douninstall() |
1202 |
{ |
{ |
1230 |
# !! we use § as field seperator !! |
# !! we use § as field seperator !! |
1231 |
# doing so prevent us to get errors by filenames with spaces |
# doing so prevent us to get errors by filenames with spaces |
1232 |
|
|
1233 |
for i in symlinks files blockdevices characterdevices directories |
for i in symlinks files blockdevices characterdevices directories fifos |
1234 |
do |
do |
1235 |
remove_${i} \ |
remove_${i} \ |
1236 |
--pcat "${pcat}" \ |
--pcat "${pcat}" \ |
1300 |
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " |
1301 |
[[ ${VERBOSE} = off ]] && opt="--quiet" |
[[ ${VERBOSE} = off ]] && opt="--quiet" |
1302 |
wget \ |
wget \ |
1303 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
1304 |
--directory-prefix=${PKGDIR} \ |
--directory-prefix=${PKGDIR} \ |
1305 |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} |
1306 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
1343 |
# clean up backup files (foo~) |
# clean up backup files (foo~) |
1344 |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
find ${MAGEDIR} -name *~ -exec rm '{}' ';' |
1345 |
|
|
1346 |
# check if an newer mage version is available |
# check if a newer mage version is available |
1347 |
is_newer_mage_version_available |
is_newer_mage_version_available |
1348 |
} |
} |
1349 |
|
|
1350 |
|
syncmage_tarball() |
1351 |
|
{ |
1352 |
|
local latest_tarball |
1353 |
|
local latest_md5 |
1354 |
|
local temp="$(mktemp -d)" |
1355 |
|
local mirr mymirr |
1356 |
|
local opt |
1357 |
|
|
1358 |
|
# try to get the md5 marked as latest on the server |
1359 |
|
latest_md5="mage-latest.md5" |
1360 |
|
|
1361 |
|
# try to get the tarball marked as latest on the server |
1362 |
|
latest_tarball="mage-latest.tar.bz2" |
1363 |
|
|
1364 |
|
for mirr in ${MIRRORS} |
1365 |
|
do |
1366 |
|
# path without distribution |
1367 |
|
mymirr="${mirr%/*}" |
1368 |
|
|
1369 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1370 |
|
echo "fetching latest md5 from ${mymirr} ..." |
1371 |
|
[[ ${VERBOSE} = off ]] && opt="--quiet" |
1372 |
|
wget \ |
1373 |
|
${WGET_FETCH_OPTIONS} \ |
1374 |
|
--directory-prefix=${temp} \ |
1375 |
|
${opt} ${mymirr}/rsync/tarballs/${latest_md5} |
1376 |
|
|
1377 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1378 |
|
echo "fetching latest tarball from ${mymirr} ..." |
1379 |
|
wget \ |
1380 |
|
${WGET_FETCH_OPTIONS} \ |
1381 |
|
--directory-prefix=${temp} \ |
1382 |
|
${opt} ${mymirr}/rsync/tarballs/${latest_tarball} |
1383 |
|
if [[ $? = 0 ]] |
1384 |
|
then |
1385 |
|
break |
1386 |
|
else |
1387 |
|
continue |
1388 |
|
fi |
1389 |
|
done |
1390 |
|
|
1391 |
|
if [[ -f ${temp}/${latest_tarball} ]] |
1392 |
|
then |
1393 |
|
# check md5 |
1394 |
|
if [[ ! -f ${temp}/${latest_md5} ]] |
1395 |
|
then |
1396 |
|
die "md5 is missing ... aborting" |
1397 |
|
else |
1398 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1399 |
|
echo -n "checking md5sum... " |
1400 |
|
( cd ${temp}; md5sum --check ${latest_md5} ) || die "md5 for ${latest_tarball} failed" |
1401 |
|
fi |
1402 |
|
|
1403 |
|
if [[ -d ${MAGEDIR} ]] |
1404 |
|
then |
1405 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1406 |
|
echo "cleaning old mage-tree ${MAGEDIR}..." |
1407 |
|
rm -rf ${MAGEDIR} |
1408 |
|
fi |
1409 |
|
|
1410 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1411 |
|
echo "updating mage-tree from tarball ..." |
1412 |
|
# unpack in dirname of MAGEDIR, as the tarball has already the mage |
1413 |
|
tar xjmf ${temp}/${latest_tarball} -C ${MAGEDIR%/*} || die "Unpacking tarball" |
1414 |
|
|
1415 |
|
if [[ -d ${temp} ]] |
1416 |
|
then |
1417 |
|
echo -ne "${COLBLUE} --- ${COLDEFAULT}" |
1418 |
|
echo "cleaning temp-files ..." |
1419 |
|
rm -rf ${temp} |
1420 |
|
fi |
1421 |
|
|
1422 |
|
# check if a newer mage version is available |
1423 |
|
is_newer_mage_version_available |
1424 |
|
else |
1425 |
|
die "Could not fetch the latest tarball ... aborting" |
1426 |
|
fi |
1427 |
|
} |
1428 |
|
|
1429 |
cleanpkg() |
cleanpkg() |
1430 |
{ |
{ |
1431 |
if [ -d "${PKGDIR}" ] |
if [ -d "${PKGDIR}" ] |
1538 |
local PNAME="$2" |
local PNAME="$2" |
1539 |
local magefile |
local magefile |
1540 |
|
|
1541 |
for magefile in $(ls --format=single-column -v ${MAGEDIR}/${PCAT}/${PNAME}/*) |
# do not list the content of a directory, only the name (-d) |
1542 |
|
for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/*) |
1543 |
do |
do |
1544 |
|
[[ -z ${magefile} ]] && continue |
1545 |
# we exclude subdirs (for stuff like a md5sum dir) |
# we exclude subdirs (for stuff like a md5sum dir) |
1546 |
[ -d ${magefile} ] && continue |
[[ -d ${magefile} ]] && continue |
1547 |
if check_stable_package ${magefile} |
if check_stable_package ${magefile} |
1548 |
then |
then |
1549 |
HIGHEST_MAGEFILE=${magefile} |
HIGHEST_MAGEFILE=${magefile} |
1588 |
# 1 - error # |
# 1 - error # |
1589 |
# 2 - protected # |
# 2 - protected # |
1590 |
# 3 - protected but masked # |
# 3 - protected but masked # |
1591 |
|
# 4 - protected but ignored # |
1592 |
# # |
# # |
1593 |
################################################### |
################################################### |
1594 |
is_config_protected() |
is_config_protected() |
1597 |
local TEST |
local TEST |
1598 |
local PROTECTED |
local PROTECTED |
1599 |
local IFS |
local IFS |
1600 |
|
local i |
1601 |
|
local x |
1602 |
|
|
1603 |
EXPFILE="${MROOT}$1" |
EXPFILE="${MROOT}$1" |
1604 |
|
|
1608 |
# to be safe; it may be '§' |
# to be safe; it may be '§' |
1609 |
IFS=' ' |
IFS=' ' |
1610 |
|
|
1611 |
# check ob in config protect |
# check if config protected |
1612 |
for i in ${CONFIG_PROTECT} |
for i in ${CONFIG_PROTECT} |
1613 |
do |
do |
1614 |
# ersetzen von $i nur wenn am anfang der variable |
# only replace $i in the beginning of the variable |
1615 |
TEST="${EXPFILE/#${MROOT}${i}/Protected}" |
TEST="${EXPFILE/#${MROOT}${i}/Protected}" |
1616 |
if [[ ${TEST} != ${EXPFILE} ]] |
if [[ ${TEST} != ${EXPFILE} ]] |
1617 |
then |
then |
1618 |
# setzen das es protected ist |
# file is config proteced |
1619 |
PROTECTED=TRUE |
PROTECTED=TRUE |
1620 |
|
|
1621 |
# check ob nicht doch maskiert |
# check if not masked |
1622 |
for x in ${CONFIG_PROTECT_MASK} |
for x in ${CONFIG_PROTECT_MASK} |
1623 |
do |
do |
1624 |
TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" |
TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" |
1627 |
PROTECTED=MASKED |
PROTECTED=MASKED |
1628 |
fi |
fi |
1629 |
done |
done |
1630 |
|
|
1631 |
|
# check if not ignored |
1632 |
|
for x in ${CONFIG_PROTECT_IGNORE} |
1633 |
|
do |
1634 |
|
TEST="${EXPFILE/#${MROOT}${x}/Protect_Ignored}" |
1635 |
|
if [[ ${TEST} != ${EXPFILE} ]] |
1636 |
|
then |
1637 |
|
PROTECTED=IGNORED |
1638 |
|
fi |
1639 |
|
done |
1640 |
fi |
fi |
1641 |
done |
done |
1642 |
|
|
1651 |
#echo "I'm protected, but masked - delete me" |
#echo "I'm protected, but masked - delete me" |
1652 |
return 3 |
return 3 |
1653 |
;; |
;; |
1654 |
|
IGNORED) |
1655 |
|
#echo "I'm protected, but ignored - keep me, del update" |
1656 |
|
return 4 |
1657 |
|
;; |
1658 |
*) |
*) |
1659 |
#echo "delete me" |
#echo "delete me" |
1660 |
return 0 |
return 0 |
1866 |
|
|
1867 |
#deletes pakages from virtual database |
#deletes pakages from virtual database |
1868 |
#$1 virtualname; $2 pkgname |
#$1 virtualname; $2 pkgname |
1869 |
virtuals_del() { |
virtuals_del() |
1870 |
|
{ |
1871 |
|
|
1872 |
local virtualname="$1" |
local virtualname="$1" |
1873 |
local pkgname="$2" |
local pkgname="$2" |
2301 |
local SDEPEND |
local SDEPEND |
2302 |
local PROVIDE |
local PROVIDE |
2303 |
local PKGTYPE |
local PKGTYPE |
2304 |
|
local MAGE_TARGETS |
2305 |
|
local SPLIT_PACKAGE_BASE |
2306 |
local preinstall |
local preinstall |
2307 |
local postinstall |
local postinstall |
2308 |
local preremove |
local preremove |
2349 |
local count_current |
local count_current |
2350 |
local magefile |
local magefile |
2351 |
local src_install |
local src_install |
2352 |
|
local i |
2353 |
|
|
2354 |
# very basic getops |
# very basic getops |
2355 |
for i in $* |
for i in $* |
2423 |
echo B:${pbuild} |
echo B:${pbuild} |
2424 |
fi |
fi |
2425 |
|
|
2426 |
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
if [[ -n ${MAGE_TARGETS} ]] |
2427 |
|
then |
2428 |
|
# basic svn compat |
2429 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2430 |
|
then |
2431 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 |
2432 |
|
do |
2433 |
|
smage2file="${i}" |
2434 |
|
done |
2435 |
|
else |
2436 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 |
2437 |
|
fi |
2438 |
|
|
2439 |
|
elif [[ -n ${SPLIT_PACKAGE_BASE} ]] |
2440 |
|
then |
2441 |
|
# basic svn compat |
2442 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2443 |
|
then |
2444 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 |
2445 |
|
do |
2446 |
|
smage2file="${i}" |
2447 |
|
done |
2448 |
|
else |
2449 |
|
smage2file=${SMAGESCRIPTSDIR}/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 |
2450 |
|
fi |
2451 |
|
|
2452 |
|
else |
2453 |
|
# basic svn compat |
2454 |
|
if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] |
2455 |
|
then |
2456 |
|
for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2457 |
|
do |
2458 |
|
smage2file="${i}" |
2459 |
|
done |
2460 |
|
else |
2461 |
|
smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 |
2462 |
|
fi |
2463 |
|
fi |
2464 |
|
|
2465 |
if [ -f "${smage2file}" ] |
if [ -f "${smage2file}" ] |
2466 |
then |
then |
2467 |
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |
echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " |
2805 |
unset -f postremove |
unset -f postremove |
2806 |
} |
} |
2807 |
|
|
2808 |
show_etc_update_mesg() { |
show_etc_update_mesg() |
2809 |
|
{ |
2810 |
[ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0 |
[ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0 |
2811 |
|
|
2812 |
echo |
echo |
2991 |
[[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable |
[[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable |
2992 |
[[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing |
[[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing |
2993 |
|
|
2994 |
local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" |
# support both types for the moment |
2995 |
|
if [[ -f /etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION} ]] |
2996 |
|
then |
2997 |
|
local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" |
2998 |
|
else |
2999 |
|
local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}" |
3000 |
|
fi |
3001 |
|
|
3002 |
# return 0 if the list not exist; nothin is masked |
# return 0 if the list not exist; nothin is masked |
3003 |
[[ ! -f ${EXCLUDED} ]] && return 0 |
[[ ! -f ${EXCLUDED} ]] && return 0 |