Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60 - (show annotations) (download) (as text)
Tue Feb 15 22:59:14 2005 UTC (19 years, 2 months ago) by niro
File MIME type: application/x-sh
File size: 2730 byte(s)
rev bump to 0.3.6-r13

1 #!/bin/bash
2
3 # mage upgrade
4 # version: 0.3.6-r13
5
6 # some default vars
7 : ${MLIBDIR=/usr/lib/mage}
8 : ${DEBUG=false}
9 : ${AUTOANSWER=false}
10
11 source /etc/mage.rc
12 source ${MLIBDIR}/mage3.functions.sh
13
14 unset UPGRADE_LIST
15 unset PLEASE_VALIDATE
16
17 # get list
18 for directory in ${INSTALLDB}/*
19 do
20 # supress virtuals and fake packages or files
21 x=$(basename ${directory})
22 if [ ${x} = fake ] ||
23 [ ${x} = virtual ] ||
24 [ ${x} = virtuals ] ||
25 [ ${x} = virtuals.old ] ||
26 [ ! -d ${directory} ]
27 then
28 continue
29 fi
30
31 for package in ${directory}/*
32 do
33 x=$(basename ${package})
34 PNAME=${x%-*-*}
35 PVER=$(echo ${x#${PNAME}-}| cut -d- -f1)
36 PBUILD=$(echo ${x#${PNAME}-}| cut -d- -f2)
37 PCAT=$(basename $(dirname ${package}))
38
39 # check if there is any higher version in mage db
40
41 #needed packages may have ben renamed ??
42 if [ -d ${MAGEDIR}/${PCAT}/${PNAME} ]
43 then
44 CATEGORIE=${PCAT} MAGENAME=${PNAME} get_highest_magefile &> /dev/null
45
46 #compare them
47 if [[ $(basename ${HIGHEST_MAGEFILE} .mage) > ${PNAME}-${PVER}-${PBUILD} ]]
48 then
49 UPGRADE_LIST="${UPGRADE_LIST} ${PNAME}"
50 else
51 # put them only on PLEASE_VALIDATE if they are not the same package
52 if [[ $(basename ${HIGHEST_MAGEFILE} .mage) != ${PNAME}-${PVER}-${PBUILD} ]]
53 then
54 echo "Not added: ${PNAME}-${PVER}-${PBUILD} is newer than $(basename ${HIGHEST_MAGEFILE} .mage)."
55 PLEASE_VALIDATE="${PLEASE_VALIDATE} ${PNAME}-${PVER}-${PBUILD}"
56 fi
57 fi
58 fi
59
60 #unset some vars for shure
61 unset x
62 unset PNAME
63 unset PVER
64 unset PBUILD
65 unset PCAT
66 unset CATEGORIE
67 unset MAGENAME
68 unset HIGHEST_MAGEFILE
69 done
70 done
71
72 unset package directory
73
74 echo
75 echo "I'm now ready to upgrade your system."
76 echo "Press any key to continue or [CTRL-C] to abort ..."
77 echo
78 read
79
80 #now run the update
81 for package in ${UPGRADE_LIST}
82 do
83 /sbin/mage install ${package} || exit 1
84 if [[ ${DEBUG} = true ]]
85 then
86 echo "Installation of ${package} completed."
87 echo "Press any key to continue ..."
88 read
89 fi
90
91 if [[ ${AUTOANSWER} = true ]]
92 then
93 yes | MAGE_UNINSTALL_TIMEOUT=0 /sbin/mage uninstall ${package} || exit 1
94 else
95 MAGE_UNINSTALL_TIMEOUT=0 /sbin/mage uninstall ${package} || exit 1
96 fi
97
98 if [[ ${DEBUG} = true ]]
99 then
100 echo "Uninstallation of ${package} completed."
101 echo "Press any key to continue ..."
102 read
103 fi
104
105 #resource /etc/profile
106 source /etc/profile
107 done
108
109 echo "The system upgrade is now complete."
110 echo -n "Would you like to see the list of ignored packages ? [ y/n ] "
111 read answer
112 if [[ ${answer} = y ]]
113 then
114 echo
115 for i in ${PLEASE_VALIDATE}
116 do
117 echo "avoided: ${i}"
118 done
119 fi
120
121 echo
122 echo "Please remember to run etc-update to update your config files."
123 echo "You should also source /etc/profile or re-login to your shell."
124 echo