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 2716 by niro, Mon Aug 8 08:23:09 2011 UTC revision 2815 by niro, Tue Aug 30 14:29:21 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Id$  # $Id$
3    
 # setup exit trap for reboot  
 trap_exit()  
 {  
  if [[ -f /.dist-upgrade ]]  
  then  
  rm -f /.dist-upgrade  
  # force a reboot at this point here  
  ( sleep 3 && reboot -f & ); exit 0  
  fi  
 }  
 trap "trap_exit" EXIT  
   
4  # get a suitable environment  # get a suitable environment
5  source /etc/profile  source /etc/profile
6    
7  MAGERC="/etc/mage.rc"  MAGERC="/etc/mage.rc"
8  MAGEPROFILE="alx-060"  MAGEPROFILE="alx-060"
9  NEW_MAGE_DISTRIBUTION="unstable"  NEW_MAGE_DISTRIBUTION="unstable"
10  NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0"  #NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0"
11  NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}"  #NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}"
12    NEW_RSYNC="rsync://128.20.41.110/mage-alx-060"
13    NEW_MIRRORS="http://128.20.41.110/magellan/alx-060"
14  NEW_PACKAGES_SERVER_PATH='packages/${ARCH}'  NEW_PACKAGES_SERVER_PATH='packages/${ARCH}'
15  NEW_MAGE_UNINSTALL_TIMEOUT=0  NEW_MAGE_UNINSTALL_TIMEOUT=0
16    
# Line 30  NEW_ALX_DHCP_PROG="/sbin/udhcpc" Line 20  NEW_ALX_DHCP_PROG="/sbin/udhcpc"
20  NEW_ALX_DHCP_START="-T 10 -t 5 -n -i"  NEW_ALX_DHCP_START="-T 10 -t 5 -n -i"
21  NEW_ALX_DHCP_STOP=""  NEW_ALX_DHCP_STOP=""
22  NEW_MIN_DISK_SPACE="85000"  NEW_MIN_DISK_SPACE="85000"
23  NEW_ALX_PLUGINS="/etc/alxconfig-ng/plugins"  NEW_ALX_PLUGINS="/usr/lib/alxconfig-ng/plugins"
24    NEW_ALX_FUNCTIONS="/usr/lib/alxconfig-ng/functions"
25    
26    # fake mage upgrade to prevent annoying error messages
27    if [[ ! -x /usr/sbin/mageupgrade ]]
28    then
29     mageupgrade() { true; }; export -f mageupgrade
30    fi
31    
32  read_value()  read_value()
33  {  {
# Line 102  updateconfig RSYNC MIRRORS MAGE_DISTRIBU Line 99  updateconfig RSYNC MIRRORS MAGE_DISTRIBU
99    
100  # fix config.rc  # fix config.rc
101  CONFIG="${CONFIGRC}"  CONFIG="${CONFIGRC}"
102  updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE ALX_PLUGINS  updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE ALX_PLUGINS ALX_FUNCTIONS
103    
104  # fix profile  # fix profile
105  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]
# Line 111  then Line 108  then
108   ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile   ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile
109  fi  fi
110    
111    # fix missing /dev/root device
112    if [[ ! -e /dev/root ]]
113    then
114     echo "fixing missing /dev/root symlink ..."
115     rootdev=$(basename $(mount | grep ' / ' | cut -d' ' -f1))
116     [[ -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root
117    fi
118    
119  # update mage3 -> mage4  # update mage3 -> mage4
120  if [[ -z $(magequery -n mage) ]]  if [[ -z $(magequery -n mage) ]]
121  then  then
# Line 177  BASESYSTEM="$(< /etc/mage-profile/basesy Line 182  BASESYSTEM="$(< /etc/mage-profile/basesy
182  if [[ -z $(magequery -n ${BASESYSTEM}) ]]  if [[ -z $(magequery -n ${BASESYSTEM}) ]]
183  then  then
184   # first keep some important files   # first keep some important files
185    
186   # export bootstrap to not start any services   # export bootstrap to not start any services
187   export MAGE_BOOTSTRAP=true   export MAGE_BOOTSTRAP=true
188   mage install ${BASESYSTEM}   mage install ${BASESYSTEM}
189   unset MAGE_BOOTSTRAP   unset MAGE_BOOTSTRAP
190    
191   # fix locale  # # fix locale
192   echo "LANG=\"de_DE\"" > /etc/conf.d/locale  # echo "LANG=\"de_DE\"" > /etc/conf.d/locale
193    
194   # enable run of orphaned files check   # enable run of orphaned files check
195   touch /.orphaned   touch /.orphaned
# Line 202  then Line 207  then
207   touch /.orphaned   touch /.orphaned
208  fi  fi
209    
 # etc-update  
 #etc-update  
   
210  # clean mage cache  # clean mage cache
211  mage clean  mage clean
212    
# Line 225  do Line 227  do
227   mage uninstall ${i}   mage uninstall ${i}
228  done  done
229    
230    if [[ -f /.orphaned ]]
231    then
232     echo "Searching for orphaned files and directories ..."
233     bash /etc/mage-profile/prune-orphaned-files
234     rm -f /.orphaned
235    fi
236    
237  if [[ -f /.dist-upgrade ]]  if [[ -f /.dist-upgrade ]]
238  then  then
239   # array of wireless opts   # array of wireless opts
# Line 267  then Line 276  then
276   install -d /etc/modprobe.d || die   install -d /etc/modprobe.d || die
277   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die   echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die
278   # create an updated initrd   # create an updated initrd
279   local DISKMODS="sd_mod"   DISKMODS="sd_mod"
280   local OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
281   local PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"   PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
282   local SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
283   local DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
284   local FBMODS="uvesafb"   FBMODS="uvesafb"
285   echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd   echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd
286   local kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')   kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')
287     # run depmod before
288     depmod -aF /boot/System.map-${kernelver}
289   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}
290   # update grub bootloader   # update grub bootloader
291   updategrub2   updategrub2
292  fi  fi
293    
294  if [[ -f /.orphaned ]]  if [[ -f /.dist-upgrade ]]
295  then  then
296   echo "Searching for orphaned files and directories ..."   echo "preparing a reboot in 60 seconds ..."
297   bash /etc/mage-profile/prune-orphaned-files   # reboot via cronjob
298   rm -f /.orphaned   [[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs
299     # setup a proper cronjob
300     tmp=$(mktemp)
301     :> ${tmp}
302     # fake mageupgrade to fix annoying error messages
303     if [[ ! -x /sbin/mageupgrade ]]
304     then
305     ln -snf /bin/true /sbin/mageupgrade
306     echo "* * * * * rm /sbin/mageupgrade" >> ${tmp}
307     fi
308     echo "* * * * * crontab -r && reboot -f" >> ${tmp}
309     crontab ${tmp}
310     [[ -f ${tmp} ]] && rm -f ${tmp}
311     # start cron daemon in background
312     crond -b -S
313    
314     rm -f /.dist-upgrade
315  fi  fi
316    
317  #if [[ -f /.dist-upgrade ]]  exit 0
 #then  
 # rm -f /.dist-upgrade  
 # # force a reboot at this point here  
 # ( reboot -f & ); exit 0  
 #fi  

Legend:
Removed from v.2716  
changed lines
  Added in v.2815