Annotation of /mage/branches/alx-0_6_0/profiles/alx-060/forced-uninstall
Parent Directory | Revision Log
Revision 2081 -
(hide annotations)
(download)
Wed May 11 22:17:14 2011 UTC (13 years ago) by niro
File size: 3423 byte(s)
Wed May 11 22:17:14 2011 UTC (13 years ago) by niro
File size: 3423 byte(s)
-added new forced-uninstall and prune-orphaned-files check
1 | niro | 2081 | #!/bin/bash |
2 | # $Id$ | ||
3 | |||
4 | MAGERC="/etc/mage.rc" | ||
5 | MAGEPROFILE="alx-060" | ||
6 | NEW_MAGE_DISTRIBUTION="unstable" | ||
7 | NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" | ||
8 | NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" | ||
9 | NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' | ||
10 | NEW_MAGE_UNINSTALL_TIMEOUT=0 | ||
11 | |||
12 | # fix mage.rc | ||
13 | for i in RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT | ||
14 | do | ||
15 | value="$(eval echo \${NEW_${i}})" | ||
16 | if [[ ! -z $(grep "^${i}=" ${MAGERC}) ]] | ||
17 | then | ||
18 | echo "fixing $i -> ${value}" | ||
19 | sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${MAGERC} | ||
20 | else | ||
21 | echo "adding $i=${value}" | ||
22 | echo "${i}=\"${value}\"" >> ${MAGERC} | ||
23 | fi | ||
24 | done | ||
25 | |||
26 | # fix profile | ||
27 | if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] | ||
28 | then | ||
29 | echo "fixing profile link -> /usr/mage/profiles/${MAGEPROFILE}" | ||
30 | ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile | ||
31 | fi | ||
32 | |||
33 | # update mage3 -> mage4 | ||
34 | if [[ -z $(magequery -n mage) ]] | ||
35 | then | ||
36 | # update mage tree | ||
37 | mage update | ||
38 | |||
39 | # mage3 has problems with md5 | ||
40 | rm -rf /usr/mage/app-mage/mage/md5 | ||
41 | if [[ ${NEW_MAGE_DISTRIBUTION} = unstable ]] | ||
42 | then | ||
43 | USE_UNSTABLE=true MAGE_DISTRIBUTION=unstable mage install mage | ||
44 | elif [[ ${NEW_MAGE_DISTRIBUTION} = testing ]] | ||
45 | then | ||
46 | USE_TESTING=true MAGE_DISTRIBUTION=testing mage install mage | ||
47 | else | ||
48 | mage install mage | ||
49 | fi | ||
50 | |||
51 | # drop all virtuals | ||
52 | :> /var/db/mage/virtuals | ||
53 | |||
54 | # enable run of orphaned files check | ||
55 | touch /.orphaned | ||
56 | fi | ||
57 | |||
58 | # install new toolchain if not exist | ||
59 | TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)" | ||
60 | if [[ -z $(magequery -n ${TOOLCHAIN}) ]] | ||
61 | then | ||
62 | # export bootstrap to not start any services | ||
63 | export MAGE_BOOTSTRAP=true | ||
64 | mage install ${TOOLCHAIN} | ||
65 | unset MAGE_BOOTSTRAP | ||
66 | |||
67 | # enable run of orphaned files check | ||
68 | touch /.orphaned | ||
69 | fi | ||
70 | |||
71 | # install new basesystem | ||
72 | BASESYSTEM="$(< /etc/mage-profile/basesystem.defaults)" | ||
73 | if [[ -z $(magequery -n ${BASESYSTEM}) ]] | ||
74 | then | ||
75 | # first keep some important files | ||
76 | |||
77 | # export bootstrap to not start any services | ||
78 | export MAGE_BOOTSTRAP=true | ||
79 | mage install ${BASESYSTEM} | ||
80 | unset MAGE_BOOTSTRAP | ||
81 | |||
82 | # enable run of orphaned files check | ||
83 | touch /.orphaned | ||
84 | fi | ||
85 | |||
86 | # install remserial, if the plugin was enabled | ||
87 | if [[ ! -z $(magequery -n remserial-alx) ]] | ||
88 | then | ||
89 | mage install remserial | ||
90 | |||
91 | # enable run of orphaned files check | ||
92 | touch /.orphaned | ||
93 | fi | ||
94 | |||
95 | # clean mage cache | ||
96 | mage clean | ||
97 | |||
98 | # # uninstall all other deprecated -alx packages | ||
99 | # DEPRECATED="bzip2 | ||
100 | # gzip | ||
101 | # perl | ||
102 | # glib1 | ||
103 | # openssl | ||
104 | # popt | ||
105 | # libungif | ||
106 | # samba | ||
107 | # dhcpcd | ||
108 | # openssh | ||
109 | # wget | ||
110 | # cups | ||
111 | # ddcxinfo-knoppix | ||
112 | # debianutils | ||
113 | # grep | ||
114 | # inetutils | ||
115 | # kbd | ||
116 | # less | ||
117 | # net-tools | ||
118 | # pciutils | ||
119 | # procps | ||
120 | # psmisc | ||
121 | # sed | ||
122 | # shadow | ||
123 | # sysvinit | ||
124 | # tar | ||
125 | # which | ||
126 | # gtk1+ | ||
127 | # ttmkfdir | ||
128 | # xdialog" | ||
129 | # | ||
130 | # echo "Searching for deprecated packages ..." | ||
131 | # for i in ${DEPRECATED} | ||
132 | # do | ||
133 | # if [[ ! -z $(magequery -n ${i}-alx) ]] | ||
134 | # then | ||
135 | # echo "Removing deprecated mage-target '${i}-alx'" | ||
136 | # mage uninstall ${i}-alx | ||
137 | # fi | ||
138 | # done | ||
139 | |||
140 | echo "Searching for deprecated packages ..." | ||
141 | for i in $(magequery -i | grep -- -alx | sed 's:.*/\(.*\)-.*-.*:\1:') | ||
142 | do | ||
143 | # excludes | ||
144 | case ${i} in | ||
145 | kernel-alx) continue ;; | ||
146 | kernel26-alx) continue ;; | ||
147 | kernel-sources-alx) continue ;; | ||
148 | kernel26-sources-alx) continue ;; | ||
149 | esac | ||
150 | |||
151 | echo "Removing deprecated mage-target '${i}'" | ||
152 | mage uninstall ${i} | ||
153 | done | ||
154 | |||
155 | if [[ -f /.orphaned ]] | ||
156 | then | ||
157 | echo "Searching for orphaned files and directories ..." | ||
158 | bash /etc/mage-profile/prune-orphaned-files | ||
159 | rm -f /.orphaned | ||
160 | fi | ||
161 | |||
162 | # force a reboot at this point here | ||
163 | reboot -f |