Magellan Linux

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

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

revision 237 by niro, Sat Sep 10 13:35:55 2005 UTC revision 248 by niro, Tue Sep 27 14:38:01 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  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.2 2005-09-10 13:35:55 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.4 2005-09-27 14:38:01 niro Exp $
4    
5  mage_setup()  mage_setup()
6  {  {
# Line 744  remove_files() Line 744  remove_files()
744   do   do
745   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
746    
747   if [ -e "${MROOT}${pathto}" ]   if [ ! -e "${MROOT}${pathto}" ]
748   then   then
749   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
750   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"
# Line 932  remove_directories() Line 932  remove_directories()
932    
933   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"
934    
  # uninstall of dirs ## added small hack to fix dirs  
  # must be reverse -> smage2 doesn't sort them  
  # -> using tac  
   
935   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
936   IFS=§   IFS=§
937    
938   while read pathto posix   # reversed order is mandatory !
939     tac ${MROOT}${INSTALLDB}/${pfull}/.dirs | while read pathto posix
940   do   do
941   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
942    
# Line 954  remove_directories() Line 951  remove_directories()
951   if [ -f "${MROOT}${pathto}/.keep" ]   if [ -f "${MROOT}${pathto}/.keep" ]
952   then   then
953   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
954   echo -e "${COLRED}  .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
955   continue   continue
956   fi   fi
957    
# Line 971  remove_directories() Line 968  remove_directories()
968   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
969   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
970   fi   fi
971   done < ${MROOT}${INSTALLDB}/${pfull}/.dirs   done
972    
973   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
974   IFS=$'\n'   IFS=$'\n'
# Line 1963  get_value_from_magefile() Line 1960  get_value_from_magefile()
1960   local PKGTYPE   local PKGTYPE
1961   local preinstall   local preinstall
1962   local postinstall   local postinstall
1963     local preremove
1964     local postremove
1965    
1966   # sanity checks   # sanity checks
1967   [ -f ${magefile} ] && source ${magefile} || \   [ -f ${magefile} ] && source ${magefile} || \
# Line 1972  get_value_from_magefile() Line 1971  get_value_from_magefile()
1971   source ${magefile}   source ${magefile}
1972   eval value=\$$(echo ${var})   eval value=\$$(echo ${var})
1973   echo "${value}"   echo "${value}"
1974    
1975     unset preinstall
1976     unset postinstall
1977     unset preremove
1978     unset postremove
1979  }  }
1980    
1981  mage_install()  mage_install()
# Line 1988  mage_install() Line 1992  mage_install()
1992   local PKGTYPE   local PKGTYPE
1993   local preinstall   local preinstall
1994   local postinstall   local postinstall
1995     local preremove
1996     local postremove
1997    
1998   local pcat   local pcat
1999   local pname   local pname
# Line 2149  mage_install() Line 2155  mage_install()
2155  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2156  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2157   echo "successfully installed."   echo "successfully installed."
2158    
2159     unset preinstall
2160     unset postinstall
2161     unset preremove
2162     unset postremove
2163  }  }
2164    
2165  md5sum_packages()  md5sum_packages()
# Line 2253  uninstall_packages() Line 2264  uninstall_packages()
2264   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2265   echo "following candidate(s) will be removed:"   echo "following candidate(s) will be removed:"
2266   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2267   echo -ne "\033[1m${can_pcat}/${can_pname}:${COLDEFAULT}"   echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}"
2268   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"
2269   echo   echo
2270   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ]
2271   echo "( Press [CTRL+C] to abort )"   then
2272   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2273   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."   echo "( Press [CTRL+C] to abort )"
2274   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2275   do   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."
2276   echo -ne "${COLRED} ${i}${COLDEFAULT}"   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))
2277   sleep 1   do
2278   done   echo -ne "${COLRED} ${i}${COLDEFAULT}"
2279   echo   sleep 1
2280   echo   done
2281     echo
2282     echo
2283     fi
2284    
2285   for pkg in ${list}   for pkg in ${list}
2286   do   do
# Line 2304  mage_uninstall() Line 2318  mage_uninstall()
2318   local PKGTYPE   local PKGTYPE
2319   local preinstall   local preinstall
2320   local postinstall   local postinstall
2321     local preremove
2322     local postremove
2323    
2324   local pcat   local pcat
2325   local pname   local pname
# Line 2341  mage_uninstall() Line 2357  mage_uninstall()
2357   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2358   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"
2359    
2360   magefile="${MAGEDIR}/${pcat}/${pname}/${pname}-${pver}-${pbuild}.mage"   magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage"
2361   source ${magefile}   source ${magefile}
2362    
2363   ## preremove scripts   ## preremove scripts
# Line 2401  mage_uninstall() Line 2417  mage_uninstall()
2417  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2418  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2419   echo "successfully removed."   echo "successfully removed."
2420    
2421     unset preinstall
2422     unset postinstall
2423     unset preremove
2424     unset postremove
2425  }  }
2426    
2427  show_etc_update_mesg() {  show_etc_update_mesg() {

Legend:
Removed from v.237  
changed lines
  Added in v.248