#!/bin/bash source /etc/rc.d/init.d/functions LOG="/root/transition.log" BUSYBOX_FILES="$( ${LOG} for i in $(find / -xdev | sort -r) do # excludes case ${i} in /boot/boot*) continue ;; /boot/grub*) continue ;; /boot/vmlinuz) continue ;; /boot/System.map) continue ;; /boot/config) continue ;; /boot/initrd) continue ;; /dev*) continue ;; /etc/conf.d/mkinitrd) continue ;; /etc/ld.so.conf) continue ;; /etc/ld.so.cache) continue ;; /etc/modprobe.d/uvesafb.conf) continue;; /etc/localtime) continue ;; /etc/shadow*) continue ;; /etc/gshadow*) continue ;; /etc/passwd*) continue ;; /etc/fstab) continue ;; /etc/group*) continue ;; /etc/host*) continue ;; /etc/mage*) continue ;; /etc/mtab) continue ;; /etc/modprobe.conf) continue ;; /etc/modprobe.d/net.*) continue ;; /etc/resolv.conf) continue ;; /etc/profile.env) continue ;; /etc/rc.d/rcboot.d*) continue ;; /etc/rc.d/rcsysinit.d*) continue ;; /etc/rc.d/rcshutdown.d*) continue ;; /etc/conf.d/net.*) continue ;; /etc/dropbear*) continue ;; /etc/alxconfig-ng*) continue ;; /usr/mage*) continue ;; /usr/bin/X) continue ;; /root*) continue ;; /home*) continue ;; /proc*) continue ;; /tmp*) continue ;; /sys*) continue ;; /var/db*) continue ;; /var/cache*) continue ;; /var/lib/init.d*) continue ;; /var/run*) continue ;; /var/tmp/magebuild*) continue ;; # update specific /.orphaned) continue ;; /.dist-upgrade) continue ;; # never try to remove the root /) continue ;; esac check_busybox ${i} && continue if [[ -z $(magequery -e ${i}) ]] then echo -e "${COLRED}NAK${COLDEFAULT} -> ${i}" #echo "not found -> ${i}" >> ${LOG} if [[ -L ${i} ]] then rm ${i} echo "==> deleted -> ${i}" >> ${LOG} elif [[ -d ${i} ]] then # only if not empty rmdir ${i} echo "==> deleted -> ${i}" >> ${LOG} else rm ${i} echo "==> deleted -> ${i}" >> ${LOG} fi else echo -e "${COLGREEN}OK${COLDEFAULT} -> ${i}" fi done # remove old cruft for i in /var/tmp/magebuild/virtual /var/run/samba do if [[ -d ${i} ]] then rm -rf ${i} echo "==> deleted -> ${i}" >> ${LOG} fi done for i in /var/run/dhcpcd-*.pid do if [[ -e ${i} ]] then rm -r ${i} echo "==> deleted -> ${i}" >> ${LOG} fi done # check old files in boot for i in /boot/grub/grub.conf /boot/grub/grub.conf.example /boot/grub/menu.lst do if [[ -e ${i} ]] then rm -r ${i} echo "==> deleted -> ${i}" >> ${LOG} fi done # check old files in home for i in .fluxbox .alxprogs .xtdesktop .xtdeskrc .ideskrc .idesktop .xinitrc do if [[ -f /home/station/${i} ]] then rm /home/station/${i} echo "==> deleted -> /home/station/${i}" >> ${LOG} fi if [[ -d /home/station/${i} ]] then rm -r /home/station/${i} echo "==> deleted -> /home/station/${i}" >> ${LOG} fi done # recreate fontconfig cache if [ -x /usr/bin/fc-cache ] then HOME=/root /usr/bin/fc-cache -sr fi