Annotation of /mage/branches/alx-0_6_0/profiles/alx-060/prune-orphaned-files
Parent Directory | Revision Log
Revision 2717 -
(hide annotations)
(download)
Mon Aug 8 08:24:35 2011 UTC (12 years, 9 months ago) by niro
File size: 2784 byte(s)
Mon Aug 8 08:24:35 2011 UTC (12 years, 9 months ago) by niro
File size: 2784 byte(s)
-keep modified/created mkinitrd.conf and uvesafb.conf -prune old cruft in home directories
1 | niro | 2081 | #!/bin/bash |
2 | |||
3 | source /etc/rc.d/init.d/functions | ||
4 | |||
5 | LOG="/root/transition.log" | ||
6 | BUSYBOX_FILES="$(</usr/share/busybox/busybox.links)" | ||
7 | |||
8 | check_busybox() | ||
9 | { | ||
10 | local file | ||
11 | local i | ||
12 | file="$1" | ||
13 | |||
14 | for i in ${BUSYBOX_FILES} | ||
15 | do | ||
16 | if [[ ${i} = ${file} ]] | ||
17 | then | ||
18 | return 0 | ||
19 | fi | ||
20 | done | ||
21 | |||
22 | return 1 | ||
23 | } | ||
24 | |||
25 | # clear log | ||
26 | :> ${LOG} | ||
27 | |||
28 | for i in $(find / -xdev | sort -r) | ||
29 | do | ||
30 | # excludes | ||
31 | case ${i} in | ||
32 | niro | 2116 | /boot/boot*) continue ;; |
33 | /boot/grub*) continue ;; | ||
34 | /boot/vmlinuz) continue ;; | ||
35 | /boot/System.map) continue ;; | ||
36 | /boot/config) continue ;; | ||
37 | /boot/initrd) continue ;; | ||
38 | niro | 2717 | /etc/conf.d/mkinitrd) continue ;; |
39 | niro | 2081 | /etc/ld.so.conf) continue ;; |
40 | /etc/ld.so.cache) continue ;; | ||
41 | niro | 2717 | /etc/modprobe.d/uvesafb.conf) continue;; |
42 | niro | 2081 | /etc/localtime) continue ;; |
43 | /etc/shadow*) continue ;; | ||
44 | /etc/gshadow*) continue ;; | ||
45 | /etc/passwd*) continue ;; | ||
46 | niro | 2116 | /etc/fstab) continue ;; |
47 | niro | 2081 | /etc/group*) continue ;; |
48 | niro | 2116 | /etc/host*) continue ;; |
49 | /etc/mage*) continue ;; | ||
50 | /etc/mtab) continue ;; | ||
51 | niro | 2081 | /etc/modprobe.conf) continue ;; |
52 | niro | 2116 | /etc/modprobe.d/net.*) continue ;; |
53 | niro | 2081 | /etc/resolv.conf) continue ;; |
54 | /etc/profile.env) continue ;; | ||
55 | /etc/rc.d/rcboot.d*) continue ;; | ||
56 | /etc/rc.d/rcsysinit.d*) continue ;; | ||
57 | /etc/rc.d/rcshutdown.d*) continue ;; | ||
58 | /etc/conf.d/net.*) continue ;; | ||
59 | /etc/dropbear*) continue ;; | ||
60 | /etc/alxconfig-ng*) continue ;; | ||
61 | /usr/mage*) continue ;; | ||
62 | /root*) continue ;; | ||
63 | /home*) continue ;; | ||
64 | /tmp*) continue ;; | ||
65 | /var/db*) continue ;; | ||
66 | /var/cache*) continue ;; | ||
67 | niro | 2134 | /var/lib/init.d*) continue ;; |
68 | niro | 2081 | /var/run*) continue ;; |
69 | /var/tmp/magebuild*) continue ;; | ||
70 | niro | 2111 | # update specific |
71 | /.orphaned) continue ;; | ||
72 | /.dist-upgrade) continue ;; | ||
73 | niro | 2081 | esac |
74 | check_busybox ${i} && continue | ||
75 | |||
76 | if [[ -z $(magequery -f ${i}) ]] | ||
77 | then | ||
78 | niro | 2135 | echo -e "${COLRED}NAK${COLDEFAULT} -> ${i}" |
79 | niro | 2081 | #echo "not found -> ${i}" >> ${LOG} |
80 | if [[ -L ${i} ]] | ||
81 | then | ||
82 | rm ${i} | ||
83 | echo "==> deleted -> ${i}" >> ${LOG} | ||
84 | |||
85 | elif [[ -d ${i} ]] | ||
86 | then | ||
87 | # only if not empty | ||
88 | rmdir ${i} | ||
89 | echo "==> deleted -> ${i}" >> ${LOG} | ||
90 | else | ||
91 | rm ${i} | ||
92 | echo "==> deleted -> ${i}" >> ${LOG} | ||
93 | fi | ||
94 | else | ||
95 | echo -e "${COLGREEN}OK${COLDEFAULT} -> ${i}" | ||
96 | fi | ||
97 | done | ||
98 | # remove old cruft | ||
99 | for i in /var/tmp/magebuild/virtual /var/run/samba | ||
100 | do | ||
101 | if [[ -d ${i} ]] | ||
102 | then | ||
103 | rm -rf ${i} | ||
104 | echo "==> deleted -> ${i}" >> ${LOG} | ||
105 | fi | ||
106 | done | ||
107 | for i in /var/run/dhcpcd-*.pid | ||
108 | do | ||
109 | if [[ -e ${i} ]] | ||
110 | then | ||
111 | rm -r ${i} | ||
112 | echo "==> deleted -> ${i}" >> ${LOG} | ||
113 | fi | ||
114 | done | ||
115 | niro | 2717 | # check old files in home |
116 | for i in .fluxbox .alxprogs .xtdesktop .xtdeskrc .ideskrc .idesktop .xinitrc | ||
117 | do | ||
118 | if [[ -f /home/station/${i} ]] | ||
119 | then | ||
120 | rm /home/station/${i} | ||
121 | echo "==> deleted -> /home/station/${i}" >> ${LOG} | ||
122 | fi | ||
123 | if [[ -d /home/station/${i} ]] | ||
124 | then | ||
125 | rm -r /home/station/${i} | ||
126 | echo "==> deleted -> /home/station/${i}" >> ${LOG} | ||
127 | fi | ||
128 | done | ||
129 | niro | 2081 | # recreate fontconfig cache |
130 | if [ -x /usr/bin/fc-cache ] | ||
131 | then | ||
132 | HOME=/root /usr/bin/fc-cache -sr | ||
133 | fi |