#!/bin/bash # $Id$ MAGERC="/etc/mage.rc" MAGEPROFILE="alx-060" NEW_MAGE_DISTRIBUTION="unstable" NEW_RSYNC="rsync://magellan-linux.de/mage-alx-0.6.0" NEW_MIRRORS="http://magellan-linux.de/magellan/alx-0.6.0/${NEW_MAGE_DISTRIBUTION}" NEW_PACKAGES_SERVER_PATH='packages/${ARCH}' NEW_MAGE_UNINSTALL_TIMEOUT=0 # fix mage.rc for i in RSYNC MIRRORS MAGE_DISTRIBUTION PACKAGES_SERVER_PATH MAGE_UNINSTALL_TIMEOUT do value="$(eval echo \${NEW_${i}})" if [[ ! -z $(grep "^${i}=" ${MAGERC}) ]] then echo "fixing $i -> ${value}" sed -i "s|^\(${i}=\).*|\1\"${value}\"|" ${MAGERC} else echo "adding $i=${value}" echo "${i}=\"${value}\"" >> ${MAGERC} fi done # fix profile if [[ $(readlink /etc/mage-profile) != */${MAGEPROFILE} ]] then echo "fixing profile link -> /usr/mage/profiles/${MAGEPROFILE}" ln -snf /usr/mage/profiles/${MAGEPROFILE} /etc/mage-profile fi # update mage3 -> mage4 if [[ -z $(magequery -n mage) ]] then # update mage tree mage update # mage3 has problems with md5 rm -rf /usr/mage/app-mage/mage/md5 if [[ ${NEW_MAGE_DISTRIBUTION} = unstable ]] then USE_UNSTABLE=true MAGE_DISTRIBUTION=unstable mage install mage elif [[ ${NEW_MAGE_DISTRIBUTION} = testing ]] then USE_TESTING=true MAGE_DISTRIBUTION=testing mage install mage else mage install mage fi # drop all virtuals :> /var/db/mage/virtuals # enable run of orphaned files check touch /.orphaned fi # install new toolchain if not exist TOOLCHAIN="$(< /etc/mage-profile/toolchain.defaults)" if [[ -z $(magequery -n ${TOOLCHAIN}) ]] then # export bootstrap to not start any services export MAGE_BOOTSTRAP=true mage install ${TOOLCHAIN} unset MAGE_BOOTSTRAP # enable run of orphaned files check touch /.orphaned fi # install new basesystem BASESYSTEM="$(< /etc/mage-profile/basesystem.defaults)" if [[ -z $(magequery -n ${BASESYSTEM}) ]] then # first keep some important files # export bootstrap to not start any services export MAGE_BOOTSTRAP=true mage install ${BASESYSTEM} unset MAGE_BOOTSTRAP # enable run of orphaned files check touch /.orphaned fi # install remserial, if the plugin was enabled if [[ ! -z $(magequery -n remserial-alx) ]] then mage install remserial # enable run of orphaned files check touch /.orphaned fi # clean mage cache mage clean # # uninstall all other deprecated -alx packages # DEPRECATED="bzip2 # gzip # perl # glib1 # openssl # popt # libungif # samba # dhcpcd # openssh # wget # cups # ddcxinfo-knoppix # debianutils # grep # inetutils # kbd # less # net-tools # pciutils # procps # psmisc # sed # shadow # sysvinit # tar # which # gtk1+ # ttmkfdir # xdialog" # # echo "Searching for deprecated packages ..." # for i in ${DEPRECATED} # do # if [[ ! -z $(magequery -n ${i}-alx) ]] # then # echo "Removing deprecated mage-target '${i}-alx'" # mage uninstall ${i}-alx # fi # done echo "Searching for deprecated packages ..." for i in $(magequery -i | grep -- -alx | sed 's:.*/\(.*\)-.*-.*:\1:') do # excludes case ${i} in kernel-alx) continue ;; kernel26-alx) continue ;; kernel-sources-alx) continue ;; kernel26-sources-alx) continue ;; esac echo "Removing deprecated mage-target '${i}'" mage uninstall ${i} done if [[ -f /.orphaned ]] then echo "Searching for orphaned files and directories ..." bash /etc/mage-profile/prune-orphaned-files rm -f /.orphaned fi # force a reboot at this point here reboot -f