Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mageupgrade.sh

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

revision 166 by niro, Fri Jul 29 14:18:41 2005 UTC revision 187 by niro, Tue Aug 16 23:24:11 2005 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  # mage upgrade  # mage upgrade
4  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mageupgrade.sh,v 1.9 2005-07-29 14:18:41 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mageupgrade.sh,v 1.10 2005-08-16 23:24:11 niro Exp $
5    
6  # some default vars  # some default vars
7  : ${MLIBDIR=/usr/lib/mage}  : ${MLIBDIR=/usr/lib/mage}
8  : ${DEBUG=false}  : ${DEBUG=false}
9  : ${AUTOANSWER=false}  : ${AUTOANSWER=false}
10  : ${SRCINSTALL=false}  : ${SRCINSTALL=false}
11    : ${AUTOCLEAN=false}
12    : ${NO_CALC=false}
13    
14  source /etc/mage.rc  source /etc/mage.rc
15  source ${MLIBDIR}/mage3.functions.sh  source ${MLIBDIR}/mage3.functions.sh
16  source /etc/init.d/functions  source /etc/init.d/functions
17    
   
18  unset UPGRADE_LIST  unset UPGRADE_LIST
19  unset PLEASE_VALIDATE  unset PLEASE_VALIDATE
20    
21    usage()
22    {
23     echo
24     echo "Usage: $(basename $0) [command] ..."
25     echo
26     echo "   --help          shows this help"
27     echo "   --no-calc       do not show deps, running straight forward"
28     echo "   --autoclean     clean all downloaded files automatically"
29     echo "   --autoanswer    answer all questions automatically"
30     echo "   --src-install   install from sources rather from binary packages"
31     echo "   --debug         show debug messages"
32     echo
33     exit 1
34    }
35    
36    # get options
37    for opt in $@
38    do
39     case ${opt} in
40     --no-calc)
41     NO_CALC=true
42     ;;
43     --autoclean)
44     AUTOCLEAN=true
45     ;;
46     --autoanswer)
47     AUTOANSWER=true
48     ;;
49     --src-install)
50     SRCINSTALL=true
51     ;;
52     --debug)
53     DEBUG=true
54     ;;
55     --help)
56     usage
57     ;;
58     *)
59     usage
60     ;;
61     esac
62    done
63    
64  echo "Fetching list of all installed packages ..."  echo "Fetching list of all installed packages ..."
65    
66  # get list  # get list
# Line 76  done Line 120  done
120    
121  unset package directory  unset package directory
122    
123  # show the list  if [[ ${NO_CALC} = false ]] && [[ ${AUTOANSWER} = false ]]
124  echo  then
125  echo "Packages selected for upgrade:"   # show the list
126  OLDIFS="${IFS}"   echo
127  IFS=:   echo "Packages selected for upgrade:"
128  for package in ${SHOW_LIST}   OLDIFS="${IFS}"
129  do   IFS=:
130   # nice output :)   for package in ${SHOW_LIST}
131   echo -en \\033[10G   do
132   echo -en ${COLGREEN}"$(echo ${package} | cut -d',' -f1)"${COLDEFAULT}   # nice output :)
133   echo -en \\033[40G   echo -en \\033[10G
134   echo -e ${COLBLUE}"$(echo ${package} | cut -d',' -f2)"${COLDEFAULT}   echo -en ${COLGREEN}"$(echo ${package} | cut -d',' -f1)"${COLDEFAULT}
135  done   echo -en \\033[40G
136  IFS="${OLDIFS}"   echo -e ${COLBLUE}"$(echo ${package} | cut -d',' -f2)"${COLDEFAULT}
137     done
138     IFS="${OLDIFS}"
139    
140     echo
141     echo "I'm now ready to upgrade your system."
142     echo "Press any key to continue or [CTRL-C] to abort ..."
143     echo
144     read
145    fi
146    
 echo  
 echo "I'm now ready to upgrade your system."  
 echo "Press any key to continue or [CTRL-C] to abort ..."  
 echo  
 read  
147    
148  # now run the update  # now run the update
149  for package in ${UPGRADE_LIST}  for package in ${UPGRADE_LIST}
# Line 122  do Line 169  do
169   MAGE_UNINSTALL_TIMEOUT=0 /sbin/mage uninstall ${package} || exit 1   MAGE_UNINSTALL_TIMEOUT=0 /sbin/mage uninstall ${package} || exit 1
170   fi   fi
171    
172     if [[ ${AUTOCLEAN} = true ]]
173     then
174     /sbin/mage clean || exit 1
175     if [[ ${SRCINSTALL} = true ]] && \
176     [ -d ${SOURCEDIR}/${package} ]
177     then
178     rm -f ${SOURCEDIR}/${package} || exit 1
179     fi
180     fi
181    
182   if [[ ${DEBUG} = true ]]   if [[ ${DEBUG} = true ]]
183   then   then
184   echo "Uninstallation of ${package} completed."   echo "Uninstallation of ${package} completed."
# Line 135  done Line 192  done
192    
193  echo "The system upgrade is now complete."  echo "The system upgrade is now complete."
194    
195  if [ -n "${PLEASE_VALIDATE}" ]  if [ -n "${PLEASE_VALIDATE}" ] && [[ ${AUTOANSWER} = false ]]
196  then  then
197   echo -n "Would you like to see the list of ignored packages ? [ y/n ] "   echo -n "Would you like to see the list of ignored packages ? [ y/n ] "
198   read answer   read answer

Legend:
Removed from v.166  
changed lines
  Added in v.187