--- mage/branches/alx-0_6_0/profiles/alx-060/forced-uninstall 2011/05/18 22:55:40 2180 +++ mage/branches/alx-0_6_0/profiles/alx-060/forced-uninstall 2011/07/04 21:21:17 2572 @@ -1,6 +1,21 @@ #!/bin/bash # $Id$ +# 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 + +# get a suitable environment +source /etc/profile + MAGERC="/etc/mage.rc" MAGEPROFILE="alx-060" NEW_MAGE_DISTRIBUTION="unstable" @@ -12,8 +27,9 @@ CONFIGRC="/etc/alxconfig-ng/config.rc" NEW_ALX_NETWORKING="dhcp" NEW_ALX_DHCP_PROG="/sbin/udhcpc" -NEW_ALX_DHCP_START="-T 10" +NEW_ALX_DHCP_START="-T 10 -t 5 -n -i" NEW_ALX_DHCP_STOP="" +NEW_MIN_DISK_SPACE="85000" read_value() { @@ -60,7 +76,7 @@ # fix config.rc CONFIG="${CONFIGRC}" -updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP +updateconfig ALX_NETWORKING ALX_DHCP_PROG ALX_DHCP_START ALX_DHCP_STOP MIN_DISK_SPACE # fix profile if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] @@ -97,6 +113,18 @@ touch /.dist-upgrade fi +# check for -f option +if [[ -n $(magequery -h | grep -- -f) ]] +then + # uninstall all /usr/X11R6 packages first + for i in $(magequery -f /usr/X11R6 | sed 's:.*/\(.*\)-.*-r.*:\1:') + do + mage uninstall ${i} + done +fi +# if /usr/X11R6 is a directoy, simply delete it with the content +[ -d /usr/X11R6 ] && rm -rf /usr/X11R6 + # install new toolchain if not exist TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)" if [[ -z $(magequery -n ${TOOLCHAIN}) ]] @@ -151,6 +179,8 @@ do # excludes case ${i} in + alxconfig-ng) continue ;; + alxinstall-ng) continue ;; kernel-alx) continue ;; kernel26-alx) continue ;; kernel-sources-alx) continue ;; @@ -206,9 +236,9 @@ rm -f /.orphaned fi -if [[ -f /.dist-upgrade ]] -then - rm -f /.dist-upgrade - # force a reboot at this point here - reboot -f -fi +#if [[ -f /.dist-upgrade ]] +#then +# rm -f /.dist-upgrade +# # force a reboot at this point here +# ( reboot -f & ); exit 0 +#fi