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 2728 by niro, Thu Aug 11 12:08:18 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    
# Line 177  BASESYSTEM="$(< /etc/mage-profile/basesy Line 165  BASESYSTEM="$(< /etc/mage-profile/basesy
165  if [[ -z $(magequery -n ${BASESYSTEM}) ]]  if [[ -z $(magequery -n ${BASESYSTEM}) ]]
166  then  then
167   # first keep some important files   # first keep some important files
168    
169     # fix missing /dev/root device
170     if [[ ! -e /dev/root ]]
171     then
172     rootdev=$(basename $(mount | grep ' / ' | cut -d' ' -f1))
173     [[ ! -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root
174     fi
175    
176   # export bootstrap to not start any services   # export bootstrap to not start any services
177   export MAGE_BOOTSTRAP=true   export MAGE_BOOTSTRAP=true
178   mage install ${BASESYSTEM}   mage install ${BASESYSTEM}
179   unset MAGE_BOOTSTRAP   unset MAGE_BOOTSTRAP
180    
181   # fix locale  # # fix locale
182   echo "LANG=\"de_DE\"" > /etc/conf.d/locale  # echo "LANG=\"de_DE\"" > /etc/conf.d/locale
183    
184   # enable run of orphaned files check   # enable run of orphaned files check
185   touch /.orphaned   touch /.orphaned
# Line 202  then Line 197  then
197   touch /.orphaned   touch /.orphaned
198  fi  fi
199    
 # etc-update  
 #etc-update  
   
200  # clean mage cache  # clean mage cache
201  mage clean  mage clean
202    
# Line 225  do Line 217  do
217   mage uninstall ${i}   mage uninstall ${i}
218  done  done
219    
220    if [[ -f /.orphaned ]]
221    then
222     echo "Searching for orphaned files and directories ..."
223     bash /etc/mage-profile/prune-orphaned-files
224     rm -f /.orphaned
225    fi
226    
227  if [[ -f /.dist-upgrade ]]  if [[ -f /.dist-upgrade ]]
228  then  then
229   # array of wireless opts   # array of wireless opts
# Line 267  then Line 266  then
266   install -d /etc/modprobe.d || die   install -d /etc/modprobe.d || die
267   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
268   # create an updated initrd   # create an updated initrd
269   local DISKMODS="sd_mod"   DISKMODS="sd_mod"
270   local OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
271   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"
272   local SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
273   local DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
274   local FBMODS="uvesafb"   FBMODS="uvesafb"
275   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
276   local kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')   kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')
277   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}
278   # update grub bootloader   # update grub bootloader
279   updategrub2   updategrub2
280  fi  fi
281    
282  if [[ -f /.orphaned ]]  if [[ -f /.dist-upgrade ]]
283  then  then
284   echo "Searching for orphaned files and directories ..."   echo "preparing a reboot in 60 seconds ..."
285   bash /etc/mage-profile/prune-orphaned-files   # reboot via cronjob
286   rm -f /.orphaned   [[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs
287     # setup a proper cronjob
288     tmp=$(mktemp)
289     echo "* * * * * crontab -r && reboot -f" > ${tmp}
290     crontab ${tmp}
291     [[ -f ${tmp} ]] && rm -f ${tmp}
292     # start cron daemon in background
293     crond -b -S
294  fi  fi
295    
296  #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.2728