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 2572 by niro, Mon Jul 4 21:21:17 2011 UTC revision 2724 by niro, Wed Aug 10 16:10:50 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 30  NEW_ALX_DHCP_PROG="/sbin/udhcpc" Line 18  NEW_ALX_DHCP_PROG="/sbin/udhcpc"
18  NEW_ALX_DHCP_START="-T 10 -t 5 -n -i"  NEW_ALX_DHCP_START="-T 10 -t 5 -n -i"
19  NEW_ALX_DHCP_STOP=""  NEW_ALX_DHCP_STOP=""
20  NEW_MIN_DISK_SPACE="85000"  NEW_MIN_DISK_SPACE="85000"
21    NEW_ALX_PLUGINS="/etc/alxconfig-ng/plugins"
22    
23  read_value()  read_value()
24  {  {
# Line 70  updateconfig() Line 59  updateconfig()
59   done   done
60  }  }
61    
62    updategrub2()
63    {
64     # create a device.map
65     if [[ ! -f /boot/grub/device.map ]]
66     then
67     grub-mkdevicemap
68     fi
69    
70     # needed by grub-mkconfig on the first run
71     if [[ ! -f /boot/grub/video.lst ]]
72     then
73     install -m0644 /lib/grub/*/video.lst /boot/grub/video.lst
74     fi
75    
76     # update grub.cfg
77     grub-mkconfig -o /boot/grub/grub.cfg
78    
79     # install bootloader to disk
80     local bootdisk
81     bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
82    
83     # Generate core.img, but don't let it be installed in boot sector
84     grub-install --no-floppy "${bootdisk}"
85    }
86    
87  # fix mage.rc  # fix mage.rc
88  CONFIG="${MAGERC}"  CONFIG="${MAGERC}"
89  updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT  updateconfig RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT
90    
91  # fix config.rc  # fix config.rc
92  CONFIG="${CONFIGRC}"  CONFIG="${CONFIGRC}"
93  updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE  updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE ALX_PLUGINS
94    
95  # fix profile  # fix profile
96  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]  if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]]
# Line 113  then Line 127  then
127   touch /.dist-upgrade   touch /.dist-upgrade
128  fi  fi
129    
130  # check for -f option  # only run this if X11R6 is a directory and not a symlink
131  if [[ -n $(magequery -h | grep -- -f) ]]  if [[ -d /usr/X11R6 ]] && [[ ! -L /usr/X11R6 ]]
132  then  then
133   # uninstall all /usr/X11R6 packages first   # check for -f option
134   for i in $(magequery -f /usr/X11R6 | sed 's:.*/\(.*\)-.*-r.*:\1:')   if [[ -n $(magequery -h | grep -- -f) ]]
135   do   then
136   mage uninstall ${i}   # uninstall all /usr/X11R6 packages first
137   done   for i in $(magequery -f /usr/X11R6 | sed 's:.*/\(.*\)-.*-r.*:\1:')
138     do
139     mage uninstall ${i}
140     done
141     fi
142    
143     # if there are any files after uninstall, simply delete them
144     [ -d /usr/X11R6 ] && rm -rf /usr/X11R6
145  fi  fi
 # if /usr/X11R6 is a directoy, simply delete it with the content  
 [ -d /usr/X11R6 ] && rm -rf /usr/X11R6  
146    
147  # install new toolchain if not exist  # install new toolchain if not exist
148  TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)"  TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)"
# Line 152  then Line 171  then
171   mage install ${BASESYSTEM}   mage install ${BASESYSTEM}
172   unset MAGE_BOOTSTRAP   unset MAGE_BOOTSTRAP
173    
174    # # fix locale
175    # echo "LANG=\"de_DE\"" > /etc/conf.d/locale
176    
177   # enable run of orphaned files check   # enable run of orphaned files check
178   touch /.orphaned   touch /.orphaned
179    
# Line 168  then Line 190  then
190   touch /.orphaned   touch /.orphaned
191  fi  fi
192    
 # etc-update  
 #etc-update  
   
193  # clean mage cache  # clean mage cache
194  mage clean  mage clean
195    
# Line 191  do Line 210  do
210   mage uninstall ${i}   mage uninstall ${i}
211  done  done
212    
213    if [[ -f /.orphaned ]]
214    then
215     echo "Searching for orphaned files and directories ..."
216     bash /etc/mage-profile/prune-orphaned-files
217     rm -f /.orphaned
218    fi
219    
220  if [[ -f /.dist-upgrade ]]  if [[ -f /.dist-upgrade ]]
221  then  then
222   # array of wireless opts   # array of wireless opts
# Line 227  then Line 253  then
253   install -d /etc/modprobe.d   install -d /etc/modprobe.d
254   mv ${i} /etc/modprobe.d/${i%.conf}.conf   mv ${i} /etc/modprobe.d/${i%.conf}.conf
255   done   done
256    
257     mount /boot &> /dev/null
258     # install an appropriate uvesafb.conf
259     install -d /etc/modprobe.d || die
260     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > /etc/modprobe.d/uvesafb.conf || die
261     # create an updated initrd
262     DISKMODS="sd_mod"
263     OLDPATAMODS="amd74xx piix sis5513 via82cxxx"
264     PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via"
265     SATAMODS="sata_via sata_sis sata_nv"
266     DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via"
267     FBMODS="uvesafb"
268     echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS}\"" > /etc/conf.d/mkinitrd
269     kernelver=$(readlink /boot/vmlinuz | sed 's:kernel-::')
270     mkinitrd -f /boot/initrd-${kernelver}.img ${kernelver}
271     # update grub bootloader
272     updategrub2
273  fi  fi
274    
275  if [[ -f /.orphaned ]]  if [[ -f /.dist-upgrade ]]
276  then  then
277   echo "Searching for orphaned files and directories ..."   echo "preparing a reboot in 60 seconds ..."
278   bash /etc/mage-profile/prune-orphaned-files   # reboot via cronjob
279   rm -f /.orphaned   [[ ! -d /var/spool/cron/crontabs ]] && install -d /var/spool/cron/crontabs
280     # setup a proper cronjob
281     tmp=$(mktemp)
282     echo "* * * * * crontab -r && reboot -f" > ${tmp}
283     crontab ${tmp}
284     [[ -f ${tmp} ]] && rm -f ${tmp}
285     # start cron daemon in background
286     crond -b -S
287  fi  fi
288    
289  #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.2572  
changed lines
  Added in v.2724