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 2730 by niro, Thu Aug 11 14:28:46 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 32  NEW_ALX_DHCP_STOP="" Line 20  NEW_ALX_DHCP_STOP=""
20  NEW_MIN_DISK_SPACE="85000"  NEW_MIN_DISK_SPACE="85000"
21  NEW_ALX_PLUGINS="/etc/alxconfig-ng/plugins"  NEW_ALX_PLUGINS="/etc/alxconfig-ng/plugins"
22    
23    # fake mage upgrade to prevent annoying error messages
24    if [[ ! -x /usr/sbin/mageupgrade ]]
25    then
26     mageupgrade() { true; }; export -f mageupgrade
27    fi
28    
29  read_value()  read_value()
30  {  {
31   local file=$1   local file=$1
# Line 85  updategrub2() Line 79  updategrub2()
79   install -m0644 /lib/grub/*/video.lst /boot/grub/video.lst   install -m0644 /lib/grub/*/video.lst /boot/grub/video.lst
80   fi   fi
81    
82     # check for special hardware
83     if [[ -x $(which hwinfo) ]]
84     then
85     # zotac devices
86     if [[ ! -z $(hwinfo --bios --storage | grep -i zotac) ]]
87     then
88     grubopts="rootdelay=8"
89     echo "Special device 'ZOTAC' detected!"
90     fi
91     fi
92    
93     # fix grubconfig for special devices
94     if [[ -n ${grubopts} ]]
95     then
96     sed -i "s:^\(export GRUB_CMDLINE_LINUX=\).*:\1\"${grubopts}\":" /etc/conf.d/grub
97     fi
98    
99   # update grub.cfg   # update grub.cfg
100   grub-mkconfig -o /boot/grub/grub.cfg   grub-mkconfig -o /boot/grub/grub.cfg
101    
# Line 111  then Line 122  then
122   ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile   ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile
123  fi  fi
124    
125    # fix missing /dev/root device
126    if [[ ! -e /dev/root ]]
127    then
128     echo "fixing missing /dev/root symlink ..."
129     rootdev=$(basename $(mount | grep ' / ' | cut -d' ' -f1))
130     [[ ! -e /dev/${rootdev} ]] && ln -snf ${rootdev} /dev/root
131    fi
132    
133  # update mage3 -> mage4  # update mage3 -> mage4
134  if [[ -z $(magequery -n mage) ]]  if [[ -z $(magequery -n mage) ]]
135  then  then
# Line 177  BASESYSTEM="$(< /etc/mage-profile/basesy Line 196  BASESYSTEM="$(< /etc/mage-profile/basesy
196  if [[ -z $(magequery -n ${BASESYSTEM}) ]]  if [[ -z $(magequery -n ${BASESYSTEM}) ]]
197  then  then
198   # first keep some important files   # first keep some important files
199    
200   # export bootstrap to not start any services   # export bootstrap to not start any services
201   export MAGE_BOOTSTRAP=true   export MAGE_BOOTSTRAP=true
202   mage install ${BASESYSTEM}   mage install ${BASESYSTEM}
203   unset MAGE_BOOTSTRAP   unset MAGE_BOOTSTRAP
204    
205   # fix locale  # # fix locale
206   echo "LANG=\"de_DE\"" > /etc/conf.d/locale  # echo "LANG=\"de_DE\"" > /etc/conf.d/locale
207    
208   # enable run of orphaned files check   # enable run of orphaned files check
209   touch /.orphaned   touch /.orphaned
# Line 202  then Line 221  then
221   touch /.orphaned   touch /.orphaned
222  fi  fi
223    
 # etc-update  
 #etc-update  
   
224  # clean mage cache  # clean mage cache
225  mage clean  mage clean
226    
# Line 225  do Line 241  do
241   mage uninstall ${i}   mage uninstall ${i}
242  done  done
243    
244    if [[ -f /.orphaned ]]
245    then
246     echo "Searching for orphaned files and directories ..."
247     bash /etc/mage-profile/prune-orphaned-files
248     rm -f /.orphaned
249    fi
250    
251  if [[ -f /.dist-upgrade ]]  if [[ -f /.dist-upgrade ]]
252  then  then
253   # array of wireless opts   # array of wireless opts
# Line 267  then Line 290  then
290   install -d /etc/modprobe.d || die   install -d /etc/modprobe.d || die
291   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
292   # create an updated initrd   # create an updated initrd
293   local DISKMODS="sd_mod"   DISKMODS="sd_mod"
294   local OLDPATAMODS="amd74xx piix sis5513 via82cxxx"   OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
295   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"
296   local SATAMODS="sata_via sata_sis sata_nv"   SATAMODS="sata_via sata_sis sata_nv"
297   local DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"   DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
298   local FBMODS="uvesafb"   FBMODS="uvesafb"
299   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
300   local kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')   kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')
301   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}   mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}
302   # update grub bootloader   # update grub bootloader
303   updategrub2   updategrub2
304  fi  fi
305    
306  if [[ -f /.orphaned ]]  if [[ -f /.dist-upgrade ]]
307  then  then
308   echo "Searching for orphaned files and directories ..."   echo "preparing a reboot in 60 seconds ..."
309   bash /etc/mage-profile/prune-orphaned-files   # reboot via cronjob
310   rm -f /.orphaned   [[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs
311     # setup a proper cronjob
312     tmp=$(mktemp)
313     echo "* * * * * crontab -r && reboot -f" > ${tmp}
314     crontab ${tmp}
315     [[ -f ${tmp} ]] && rm -f ${tmp}
316     # start cron daemon in background
317     crond -b -S
318  fi  fi
319    
320  #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.2730