Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mage4.functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1085 by niro, Mon Jun 28 18:15:44 2010 UTC revision 1271 by niro, Wed Apr 27 08:42:24 2011 UTC
# Line 339  install_blockdevices() Line 339  install_blockdevices()
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
# Line 352  install_blockdevices() Line 354  install_blockdevices()
354   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
355   IFS=§   IFS=§
356    
357   while read pathto posix   while read pathto posix major minor 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"   mknod -m "${posix}" "${MROOT}${pathto}"
363     # make it optional atm !!
364     if [[ ! -z ${user} ]] && [[ ! -z ${group} ]]
365     then
366     chown "${user}:${group}" "${MROOT}${pathto}" b "${major}" "${minor}"
367     fi
368   done < ${BUILDDIR}/${pkgname}/.pipes   done < ${BUILDDIR}/${pkgname}/.pipes
369    
370   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
# Line 376  install_characterdevices() Line 383  install_characterdevices()
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
# Line 389  install_characterdevices() Line 398  install_characterdevices()
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}" b "${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  {  {
# Line 428  build_doinstall() Line 482  build_doinstall()
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    
# Line 489  install_database_entry() Line 544  install_database_entry()
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
# Line 507  install_database_entry() Line 562  install_database_entry()
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} \   # make .fifo optional atm
568   ${dbrecorddir}/${i}   if [[ -f ${BUILDDIR}/${pkgname}/${i} ]]
569     then
570     install -m 0644 ${BUILDDIR}/${pkgname}/${i} ${dbrecorddir}/${i}
571     fi
572   done   done
573   ;;   ;;
574   esac   esac
# Line 785  remove_files() Line 843  remove_files()
843   done   done
844    
845   # sanity checks; abort if not given   # sanity checks; abort if not given
846   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_files() \$pcat not given."
847   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_files() \$pname not given."
848   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_files() \$pver not given."
849   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_files() \$pbuild not given."
850   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
851    
852   # check needed global vars   # check needed global vars
# Line 879  remove_blockdevices() Line 937  remove_blockdevices()
937  {  {
938   local pathto   local pathto
939   local posix   local posix
940     local user
941     local group
942   local IFS   local IFS
943   local pcat   local pcat
944   local pname   local pname
# Line 902  remove_blockdevices() Line 962  remove_blockdevices()
962   done   done
963    
964   # sanity checks; abort if not given   # sanity checks; abort if not given
965   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_blockdevices() \$pcat not given."
966   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_blockdevices() \$pname not given."
967   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_blockdevices() \$pver not given."
968   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_blockdevices() \$pbuild not given."
969   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
970    
971   # check needed global vars   # check needed global vars
# Line 916  remove_blockdevices() Line 976  remove_blockdevices()
976   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
977   IFS=§   IFS=§
978    
979   while read pathto posix   while read pathto posix user group
980   do   do
981   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
982    
# Line 937  remove_characterdevices() Line 997  remove_characterdevices()
997  {  {
998   local pathto   local pathto
999   local posix   local posix
1000     local user
1001     local group
1002   local IFS   local IFS
1003   local pcat   local pcat
1004   local pname   local pname
# Line 960  remove_characterdevices() Line 1022  remove_characterdevices()
1022   done   done
1023    
1024   # sanity checks; abort if not given   # sanity checks; abort if not given
1025   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_characterdevices() \$pcat not given."
1026   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_characterdevices() \$pname not given."
1027   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_characterdevices() \$pver not given."
1028   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_characterdevices() \$pbuild not given."
1029   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
1030    
1031   # check needed global vars   # check needed global vars
# Line 974  remove_characterdevices() Line 1036  remove_characterdevices()
1036   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
1037   IFS=§   IFS=§
1038    
1039   while read pathto posix   while read pathto posix user group
1040   do   do
1041   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
1042    
# Line 988  remove_characterdevices() Line 1050  remove_characterdevices()
1050    
1051    
1052  ###################################################  ###################################################
1053    # function remove_fifos                           #
1054    # remove_fifos $PKGNAME                     #
1055    ###################################################
1056    remove_fifos()
1057    {
1058     local pathto
1059     local posix
1060     local user
1061     local group
1062     local IFS
1063     local pcat
1064     local pname
1065     local pver
1066     local pbuild
1067     local i
1068     local pfull
1069    
1070     IFS=$'\n'
1071    
1072     # very basic getops
1073     for i in $*
1074     do
1075     case $1 in
1076     --pcat|-c) shift; pcat="$1" ;;
1077     --pname|-n) shift; pname="$1" ;;
1078     --pver|-v) shift; pver="$1" ;;
1079     --pbuild|-b) shift; pbuild="$1" ;;
1080     esac
1081     shift
1082     done
1083    
1084     # sanity checks; abort if not given
1085     [ -z "${pcat}" ] && die "remove_fifos() \$pcat not given."
1086     [ -z "${pname}" ] && die "remove_fifos() \$pname not given."
1087     [ -z "${pver}" ] && die "remove_fifos() \$pver not given."
1088     [ -z "${pbuild}" ] && die "remove_fifos() \$pbuild not given."
1089     pfull="${pcat}/${pname}-${pver}-${pbuild}"
1090    
1091     # check needed global vars
1092     [ -z "${BUILDDIR}" ] && die "remove_fifos() \$BUILDDIR not set."
1093    
1094     # make it optional atm !!
1095     #[ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && die "remove_fifos() .fifo not found"
1096     [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && return
1097    
1098     # sets fieldseperator to "§" instead of " "
1099     IFS=§
1100    
1101     while read pathto posix user group
1102     do
1103     [ -z "${pathto}" ] && continue
1104    
1105     [[ ${VERBOSE} = on ]] && echo -e "\t<<< FIFO: ${MROOT}${pathto}"
1106     rm "${MROOT}${pathto}"
1107     done < ${MROOT}${INSTALLDB}/${pfull}/.fifo
1108    
1109     # very important: unsetting the '§' fieldseperator
1110     IFS=$'\n'
1111    }
1112    
1113    
1114    ###################################################
1115  # function remove_direcories                      #  # function remove_direcories                      #
1116  # remove_direcories $PKGNAME                #  # remove_direcories $PKGNAME                #
1117  ###################################################  ###################################################
# Line 1018  remove_directories() Line 1142  remove_directories()
1142   done   done
1143    
1144   # sanity checks; abort if not given   # sanity checks; abort if not given
1145   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_directories() \$pcat not given."
1146   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_directories() \$pname not given."
1147   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_directories() \$pver not given."
1148   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_directories() \$pbuild not given."
1149   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
1150    
1151   # check needed global vars   # check needed global vars
# Line 1075  remove_directories() Line 1199  remove_directories()
1199  ###################################################  ###################################################
1200  # function build_douninstall                      #  # function build_douninstall                      #
1201  # build_douninstall $PKGNAME                #  # build_douninstall $PKGNAME                #
1202  # NOTE: this is an wrapper do remove packages     #  # NOTE: this is an wrapper to remove packages     #
1203  ###################################################  ###################################################
1204  build_douninstall()  build_douninstall()
1205  {  {
# Line 1109  build_douninstall() Line 1233  build_douninstall()
1233   # !! we use § as field seperator !!   # !! we use § as field seperator !!
1234   # doing so prevent us to get errors by filenames with spaces   # doing so prevent us to get errors by filenames with spaces
1235    
1236   for i in symlinks files blockdevices characterdevices directories   for i in symlinks files blockdevices characterdevices directories fifos
1237   do   do
1238   remove_${i} \   remove_${i} \
1239   --pcat "${pcat}" \   --pcat "${pcat}" \
# Line 1232  syncmage_tarball() Line 1356  syncmage_tarball()
1356   local latest_md5   local latest_md5
1357   local temp="$(mktemp -d)"   local temp="$(mktemp -d)"
1358   local mirr mymirr   local mirr mymirr
1359     local opt
1360    
1361   # try to get the md5 marked as latest on the server   # try to get the md5 marked as latest on the server
1362   latest_md5="mage-latest.md5"   latest_md5="mage-latest.md5"
# Line 1246  syncmage_tarball() Line 1371  syncmage_tarball()
1371    
1372   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1373   echo "fetching latest md5 from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
1374     [[ ${VERBOSE} = off ]] && opt="--quiet"
1375   wget \   wget \
1376   ${WGET_FETCH_OPTIONS} \   ${WGET_FETCH_OPTIONS} \
1377   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1378   ${mymirr}/rsync/tarballs/${latest_md5}   ${opt} ${mymirr}/rsync/tarballs/${latest_md5}
1379    
1380   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1381   echo "fetching latest tarball from ${mymirr} ..."   echo "fetching latest tarball from ${mymirr} ..."
1382   wget \   wget \
1383   ${WGET_FETCH_OPTIONS} \   ${WGET_FETCH_OPTIONS} \
1384   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1385   ${mymirr}/rsync/tarballs/${latest_tarball}   ${opt} ${mymirr}/rsync/tarballs/${latest_tarball}
1386   if [[ $? = 0 ]]   if [[ $? = 0 ]]
1387   then   then
1388   break   break
# Line 1272  syncmage_tarball() Line 1398  syncmage_tarball()
1398   then   then
1399   die "md5 is missing ... aborting"   die "md5 is missing ... aborting"
1400   else   else
1401   ( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1402     echo -n "checking md5sum... "
1403     ( cd ${temp}; md5sum --check ${latest_md5} ) || die "md5 for ${latest_tarball} failed"
1404   fi   fi
1405    
1406   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
# Line 1741  virtuals_add() Line 1869  virtuals_add()
1869    
1870  #deletes pakages from virtual database  #deletes pakages from virtual database
1871  #$1 virtualname; $2 pkgname  #$1 virtualname; $2 pkgname
1872  virtuals_del() {  virtuals_del()
1873    {
1874    
1875   local virtualname="$1"   local virtualname="$1"
1876   local pkgname="$2"   local pkgname="$2"
# Line 2679  mage_uninstall() Line 2808  mage_uninstall()
2808   unset -f postremove   unset -f postremove
2809  }  }
2810    
2811  show_etc_update_mesg() {  show_etc_update_mesg()
2812    {
2813   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0
2814    
2815   echo   echo

Legend:
Removed from v.1085  
changed lines
  Added in v.1271