Magellan Linux

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

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

revision 31 by niro, Thu Jan 6 02:53:55 2005 UTC revision 57 by niro, Tue Feb 15 00:37:07 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # Magellan Linux Installer Functions (mage.functions.sh)  # Magellan Linux Installer Functions (mage.functions.sh)
3  # version: 0.3.6-r8  # version: 0.3.6-r12
4    
5  mage_setup() {  mage_setup() {
6   install -d $INSTALLDB   install -d $INSTALLDB
# Line 110  install_directories() { Line 110  install_directories() {
110    
111   while read pathto posix user group   while read pathto posix user group
112   do   do
113   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
114   then   then
115   if [ "$VERBOSE" == "on" ]   if [ "$VERBOSE" == "on" ]
116   then   then
# Line 148  install_files(){ Line 148  install_files(){
148    
149   while read pathto posix user group mtime md5sum   while read pathto posix user group mtime md5sum
150   do   do
151   if [ ! -z $pathto ]   if [ ! -z "${pathto}" ]
152   then   then
153   if [ "$VERBOSE" == "on" ]   if [ "${VERBOSE}" == "on" ]
154   then   then
155   echo -e "\t>>> FILE: $pathto"   echo -e "\t>>> FILE: ${pathto}"
156   fi   fi
157   ### kleiner notfall fix ###   ### kleiner notfall fix ###
158   if [ ! -d `dirname $pathto` ]   if [ ! -d "$(dirname "${pathto}")" ]
159   then   then
160   install -d `dirname $pathto`   install -d "$(dirname "${pathto}")"
161   fi   fi
162    
163   #when file exists, check if protected   #when file exists, check if protected
164   if [ -e ${pathto} ]   if [ -e "${pathto}" ]
165   then   then
166   is_config_protected "${pathto}"   is_config_protected "${pathto}"
167   RETVAL=$?   RETVAL=$?
# Line 186  install_files(){ Line 186  install_files(){
186   #moves the cursor up   #moves the cursor up
187   echo -en \\033[A   echo -en \\033[A
188   echo -e "${COLRED}! prot ${COLDEFAULT} === FILE: $pathto"   echo -e "${COLRED}! prot ${COLDEFAULT} === FILE: $pathto"
189   FILENAME=$(basename "${pathto}")   FILENAME="$(basename "${pathto}")"
190   FILE="$pathto"   FILE="$pathto"
191   COUNTER=$(count_protected_files ${FILE})   COUNTER=$(count_protected_files "${FILE}")
192   DESTINATION="$(dirname "$pathto")/._cfg${COUNTER}_${FILENAME}"   DESTINATION="$(dirname "$pathto")/._cfg${COUNTER}_${FILENAME}"
193   install -m ${posix} -o ${user} -g ${group} \   install -m ${posix} -o ${user} -g ${group} \
194   ${BUILDDIR}/${PKGNAME}/binfiles/"$FILE" \   ${BUILDDIR}/${PKGNAME}/binfiles/"$FILE" \
# Line 237  install_symlinks() { Line 237  install_symlinks() {
237    
238   while read pathto posix link mtime   while read pathto posix link mtime
239   do   do
240   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
241   then   then
242   if [ "$VERBOSE" == "on" ]   if [ "$VERBOSE" == "on" ]
243   then   then
# Line 270  install_blockdevices() { Line 270  install_blockdevices() {
270    
271   while read pathto posix   while read pathto posix
272   do   do
273   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
274   then   then
275   if [ "$VERBOSE" == "on" ]   if [ "$VERBOSE" == "on" ]
276   then   then
# Line 303  install_characterdevices() { Line 303  install_characterdevices() {
303    
304   while read pathto posix   while read pathto posix
305   do   do
306   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
307   then   then
308   if [ "$VERBOSE" == "on" ]   if [ "$VERBOSE" == "on" ]
309   then   then
# Line 442  compare_mtime(){ Line 442  compare_mtime(){
442   if [ -L ${pathto} ]   if [ -L ${pathto} ]
443   then   then
444   #readlink -f resolves full path of linked file   #readlink -f resolves full path of linked file
445   x=$(stat -c %Y $(readlink -f ${pathto}))   x=$(stat -c %Y "$(readlink -f "${pathto}")")
446   else   else
447   x=$(stat -c %Y ${pathto})   x=$(stat -c %Y "${pathto}")
448   fi   fi
449    
450   if [ "${M_MTIME}" -eq "${x}" ]   if [ "${M_MTIME}" -eq "${x}" ]
# Line 475  remove_symlinks() { Line 475  remove_symlinks() {
475    
476   while read pathto posix link mtime   while read pathto posix link mtime
477   do   do
478   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
479   then   then
480   if [ -L $pathto ]   if [ -L "$pathto" ]
481   then   then
482   compare_mtime ${PKGNAME} ${pathto}   compare_mtime ${PKGNAME} "${pathto}"
483   RETVAL=$?   RETVAL=$?
484   # 0=delete me #   # 0=delete me #
485   # 1=keep me   #   # 1=keep me   #
486   case ${RETVAL} in   case ${RETVAL} in
487   0)   0)
488   echo -e "\t<<< LINK: $pathto"   echo -e "\t<<< LINK: $pathto"
489   rm $pathto   rm "$pathto"
490   ;;   ;;
491   1)   1)
492   echo -e "${COLRED}! mtime${COLDEFAULT} === LINK: $pathto"   echo -e "${COLRED}! mtime${COLDEFAULT} === LINK: $pathto"
# Line 524  remove_files() { Line 524  remove_files() {
524    
525   while read pathto posix user group mtime md5sum   while read pathto posix user group mtime md5sum
526   do   do
527   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
528   then   then
529   if [ -e $pathto ]   if [ -e "$pathto" ]
530   then   then
531   compare_mtime ${PKGNAME} ${pathto}   compare_mtime ${PKGNAME} "${pathto}"
532   RETVAL=$?   RETVAL=$?
533   # 0=delete me #   # 0=delete me #
534   # 1=keep me   #   # 1=keep me   #
535   case ${RETVAL} in   case ${RETVAL} in
536   0)   0)
537   echo -e "\t<<< FILE: $pathto"   echo -e "\t<<< FILE: $pathto"
538   rm $pathto   rm "$pathto"
539   ;;   ;;
540   1)   1)
541   echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: $pathto"   echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: $pathto"
# Line 570  remove_blockdevices() { Line 570  remove_blockdevices() {
570    
571   while read pathto posix   while read pathto posix
572   do   do
573   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
574   then   then
575   echo -e "\t<<< PIPE: $pathto"   echo -e "\t<<< PIPE: $pathto"
576   rm $pathto   rm "$pathto"
577   fi   fi
578   done < ${INSTALLDB}/${PKGNAME}/.pipes   done < ${INSTALLDB}/${PKGNAME}/.pipes
579    
# Line 600  remove_characterdevices() { Line 600  remove_characterdevices() {
600    
601   while read pathto posix   while read pathto posix
602   do   do
603   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
604   then   then
605   echo -e "\t<<< CHAR: $pathto"   echo -e "\t<<< CHAR: $pathto"
606   rm $pathto   rm "$pathto"
607   fi   fi
608   done < ${INSTALLDB}/${PKGNAME}/.char   done < ${INSTALLDB}/${PKGNAME}/.char
609    
# Line 637  remove_directories() { Line 637  remove_directories() {
637    
638   while read pathto posix   while read pathto posix
639   do   do
640   if [ ! -z $pathto ]   if [ ! -z "$pathto" ]
641   then   then
642   if [ -e $pathto ]   if [ -e "$pathto" ]
643   then   then
644   echo -e "\t<<< DIR:  $pathto"   echo -e "\t<<< DIR:  $pathto"
645   rmdir $pathto &> /dev/null   rmdir "$pathto" &> /dev/null
646   if [ "$?" -ne "0" ]   if [ "$?" -ne "0" ]
647   then   then
648   #moves the cursor up   #moves the cursor up
# Line 1009  get_highest_magefile(){ Line 1009  get_highest_magefile(){
1009   echo "Be warned that these packages are not stable and may cause serious problems."   echo "Be warned that these packages are not stable and may cause serious problems."
1010   echo "You should know what you are doing, so don't complain about any damage."   echo "You should know what you are doing, so don't complain about any damage."
1011   echo   echo
1012   exit 1   return 1
1013   fi   fi
1014    
1015   MAGEFILE=${HIGHEST_MAGEFILE}   MAGEFILE=${HIGHEST_MAGEFILE}
# Line 1044  is_config_protected() { Line 1044  is_config_protected() {
1044   do   do
1045   #ersetzen von $i nur wenn am anfang der variable   #ersetzen von $i nur wenn am anfang der variable
1046   TEST="${EXPFILE/#${i}/Protected}"   TEST="${EXPFILE/#${i}/Protected}"
1047   if [ ${TEST} != ${EXPFILE} ]   if [ "${TEST}" != "${EXPFILE}" ]
1048   then   then
1049   #setzen das es protected ist   #setzen das es protected ist
1050   PROTECTED=TRUE   PROTECTED=TRUE
# Line 1053  is_config_protected() { Line 1053  is_config_protected() {
1053   for x in ${CONFIG_PROTECT_MASK}   for x in ${CONFIG_PROTECT_MASK}
1054   do   do
1055   TEST="${EXPFILE/#${x}/Protect_Masked}"   TEST="${EXPFILE/#${x}/Protect_Masked}"
1056   if [ ${TEST} != ${EXPFILE} ]   if [ "${TEST}" != "${EXPFILE}" ]
1057   then   then
1058   PROTECTED=MASKED   PROTECTED=MASKED
1059   fi   fi
# Line 1088  is_config_protected() { Line 1088  is_config_protected() {
1088  #       exp: 0012                                 #  #       exp: 0012                                 #
1089  ###################################################  ###################################################
1090  count_protected_files() {  count_protected_files() {
1091   ${MLIBDIR}/writeprotected $1   ${MLIBDIR}/writeprotected "$1"
1092  }  }
1093    
1094    

Legend:
Removed from v.31  
changed lines
  Added in v.57