Magellan Linux

Diff of /mage/branches/alx-0_6_0/profiles/alx-060/forced-uninstall

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

revision 2081 by niro, Wed May 11 22:17:14 2011 UTC revision 2180 by niro, Wed May 18 22:55:40 2011 UTC
# Line 9  NEW_MIRRORS="http://magellan-linux.de/ma Line 9  NEW_MIRRORS="http://magellan-linux.de/ma
9  NEW_PACKAGES_SERVER_PATH='packages/${ARCH}'  NEW_PACKAGES_SERVER_PATH='packages/${ARCH}'
10  NEW_MAGE_UNINSTALL_TIMEOUT=0  NEW_MAGE_UNINSTALL_TIMEOUT=0
11    
12  # fix mage.rc  CONFIGRC="/etc/alxconfig-ng/config.rc"
13  for i in RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT  NEW_ALX_NETWORKING="dhcp"
14  do  NEW_ALX_DHCP_PROG="/sbin/udhcpc"
15   value="$(eval echo \${NEW_${i}})"  NEW_ALX_DHCP_START="-T 10"
16   if [[ ! -z $(grep "^${i}=" ${MAGERC}) ]]  NEW_ALX_DHCP_STOP=""
17    
18    read_value()
19    {
20     local file=$1
21     local var=$2
22     local value
23    
24     [[ ! -e ${file} ]] && return 1
25    
26     value=$(source ${file}; echo $(eval echo \${${var}}))
27     echo "${value}"
28     return 0
29    }
30    
31    updateconfig()
32    {
33     local variables="$@"
34     local value
35     local i
36    
37     if [[ -z ${CONFIG} ]]
38   then   then
39   echo "fixing $i -> ${value}"   echo "You must define \$CONFIG varibale first!"
40   sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${MAGERC}   return 1
  else  
  echo "adding $i=${value}"  
  echo "${i}=\"${value}\"" >> ${MAGERC}  
41   fi   fi
42  done  
43     for i in ${variables}
44     do
45     value="$(eval echo \${NEW_${i}})"
46     if [[ ! -z $(grep "^${i}=" ${CONFIG}) ]]
47     then
48     echo "fixing ${i} -> ${value}"
49     sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${CONFIG}
50     else
51     echo "adding ${i}=${value}"
52     echo "${i}=\"${value}\"" >> ${CONFIG}
53     fi
54     done
55    }
56    
57    # fix mage.rc
58    CONFIG="${MAGERC}"
59    updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT
60    
61    # fix config.rc
62    CONFIG="${CONFIGRC}"
63    updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP
64    
65  # fix profile  # fix profile
66  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]
# Line 53  then Line 92  then
92    
93   # enable run of orphaned files check   # enable run of orphaned files check
94   touch /.orphaned   touch /.orphaned
95    
96     # tell that we're running an dist-upgrade
97     touch /.dist-upgrade
98  fi  fi
99    
100  # install new toolchain if not exist  # install new toolchain if not exist
# Line 66  then Line 108  then
108    
109   # enable run of orphaned files check   # enable run of orphaned files check
110   touch /.orphaned   touch /.orphaned
111    
112     # tell that we're running an dist-upgrade
113     touch /.dist-upgrade
114  fi  fi
115    
116  # install new basesystem  # install new basesystem
# Line 81  then Line 126  then
126    
127   # enable run of orphaned files check   # enable run of orphaned files check
128   touch /.orphaned   touch /.orphaned
129    
130     # tell that we're running an dist-upgrade
131     touch /.dist-upgrade
132  fi  fi
133    
134  # install remserial, if the plugin was enabled  # install remserial, if the plugin was enabled
# Line 92  then Line 140  then
140   touch /.orphaned   touch /.orphaned
141  fi  fi
142    
143    # etc-update
144    #etc-update
145    
146  # clean mage cache  # clean mage cache
147  mage clean  mage clean
148    
 # # uninstall all other deprecated -alx packages  
 # DEPRECATED="bzip2  
 # gzip  
 # perl  
 # glib1  
 # openssl  
 # popt  
 # libungif  
 # samba  
 # dhcpcd  
 # openssh  
 # wget  
 # cups  
 # ddcxinfo-knoppix  
 # debianutils  
 # grep  
 # inetutils  
 # kbd  
 # less  
 # net-tools  
 # pciutils  
 # procps  
 # psmisc  
 # sed  
 # shadow  
 # sysvinit  
 # tar  
 # which  
 # gtk1+  
 # ttmkfdir  
 # xdialog"  
 #  
 # echo "Searching for deprecated packages ..."  
 # for i in ${DEPRECATED}  
 # do  
 # if [[ ! -z $(magequery -n ${i}-alx) ]]  
 # then  
 # echo "Removing deprecated mage-target '${i}-alx'"  
 # mage uninstall ${i}-alx  
 # fi  
 # done  
   
149  echo "Searching for deprecated packages ..."  echo "Searching for deprecated packages ..."
150  for i in $(magequery -i | grep -- -alx | sed 's:.*/\(.*\)-.*-.*:\1:')  for i in $(magequery -i | grep -- -alx | sed 's:.*/\(.*\)-.*-.*:\1:')
151  do  do
# Line 152  do Line 161  do
161   mage uninstall ${i}   mage uninstall ${i}
162  done  done
163    
164    if [[ -f /.dist-upgrade ]]
165    then
166     # array of wireless opts
167     WIRELESS_OPTS=( WIRELESS_BITRATE WIRELESS_CHANNEL WIRELESS_ESSID WIRELESS_FREQUENCY WIRELESS_MODE WIRELESS_NICK WIRELESS_AUTH_MODE WIRELESS_KEY_LENGTH WIRELESS_KEY WIRELESS_KEY_ASCII WIRELESS_WPA_DRIVER )
168    
169     # fixing current dhcp network settings
170     #for i in $(grep -irl NETWORKING=.*dhcp.* /etc/conf.d/net.*)
171     for i in $(grep -irl DHCP_PROG=.*dhcpcd.* /etc/conf.d/net.*)
172     do
173     case ${i} in
174     */net.sample) continue ;;
175     */net.routes) continue ;;
176     esac
177    
178     echo "fixing current dhcp network settings in '${i}'"
179     mv ${i}{,.orig}
180     onboot="$(read_value ${i}.orig ONBOOT)"
181     echo "ONBOOT=\"${onboot}\"" > ${i}
182     echo 'NETWORKING="dhcp"' >> ${i}
183     # check wireless extensions
184     for opt in ${WIRELESS_OPTS[*]}
185     do
186     value="$(read_value ${i}.orig ${opt})"
187     if [[ ! -z ${value} ]]
188     then
189     echo "${opt}=\"${value}\"" >> ${i}
190     fi
191     done
192     rm -f ${i}.orig
193     done
194     # search modules files
195     for i in $(find /etc/modules.d -name net.\*)
196     do
197     install -d /etc/modprobe.d
198     mv ${i} /etc/modprobe.d/${i%.conf}.conf
199     done
200    fi
201    
202  if [[ -f /.orphaned ]]  if [[ -f /.orphaned ]]
203  then  then
204   echo "Searching for orphaned files and directories ..."   echo "Searching for orphaned files and directories ..."
# Line 159  then Line 206  then
206   rm -f /.orphaned   rm -f /.orphaned
207  fi  fi
208    
209  # force a reboot at this point here  if [[ -f /.dist-upgrade ]]
210  reboot -f  then
211     rm -f /.dist-upgrade
212     # force a reboot at this point here
213     reboot -f
214    fi

Legend:
Removed from v.2081  
changed lines
  Added in v.2180