Contents of /mage/branches/alx-0_6_0/profiles/alx-060/prune-orphaned-files
Parent Directory | Revision Log
Revision 2081 -
(show annotations)
(download)
Wed May 11 22:17:14 2011 UTC (13 years, 1 month ago) by niro
File size: 1935 byte(s)
Wed May 11 22:17:14 2011 UTC (13 years, 1 month ago) by niro
File size: 1935 byte(s)
-added new forced-uninstall and prune-orphaned-files check
1 | #!/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 | /etc/ld.so.conf) continue ;; |
33 | /etc/ld.so.cache) continue ;; |
34 | /etc/localtime) continue ;; |
35 | /etc/shadow*) continue ;; |
36 | /etc/gshadow*) continue ;; |
37 | /etc/passwd*) continue ;; |
38 | /etc/group*) continue ;; |
39 | /etc/modprobe.conf) continue ;; |
40 | /etc/resolv.conf) continue ;; |
41 | /etc/profile.env) continue ;; |
42 | /etc/rc.d/rcboot.d*) continue ;; |
43 | /etc/rc.d/rcsysinit.d*) continue ;; |
44 | /etc/rc.d/rcshutdown.d*) continue ;; |
45 | /etc/conf.d/net.*) continue ;; |
46 | /etc/dropbear*) continue ;; |
47 | /etc/alxconfig-ng*) continue ;; |
48 | /usr/mage*) continue ;; |
49 | /root*) continue ;; |
50 | /home*) continue ;; |
51 | /tmp*) continue ;; |
52 | /var/db*) continue ;; |
53 | /var/cache*) continue ;; |
54 | /var/run*) continue ;; |
55 | /var/tmp/magebuild*) continue ;; |
56 | esac |
57 | check_busybox ${i} && continue |
58 | |
59 | if [[ -z $(magequery -f ${i}) ]] |
60 | then |
61 | echo -e "${COLRED}NAK${COLDEFAULT} -> ${i}" |
62 | #echo "not found -> ${i}" >> ${LOG} |
63 | if [[ -L ${i} ]] |
64 | then |
65 | rm ${i} |
66 | echo "==> deleted -> ${i}" >> ${LOG} |
67 | |
68 | elif [[ -d ${i} ]] |
69 | then |
70 | # only if not empty |
71 | rmdir ${i} |
72 | echo "==> deleted -> ${i}" >> ${LOG} |
73 | else |
74 | rm ${i} |
75 | echo "==> deleted -> ${i}" >> ${LOG} |
76 | fi |
77 | else |
78 | echo -e "${COLGREEN}OK${COLDEFAULT} -> ${i}" |
79 | fi |
80 | done |
81 | # remove old cruft |
82 | for i in /var/tmp/magebuild/virtual /var/run/samba |
83 | do |
84 | if [[ -d ${i} ]] |
85 | then |
86 | rm -rf ${i} |
87 | echo "==> deleted -> ${i}" >> ${LOG} |
88 | fi |
89 | done |
90 | for i in /var/run/dhcpcd-*.pid |
91 | do |
92 | if [[ -e ${i} ]] |
93 | then |
94 | rm -r ${i} |
95 | echo "==> deleted -> ${i}" >> ${LOG} |
96 | fi |
97 | done |
98 | # recreate fontconfig cache |
99 | if [ -x /usr/bin/fc-cache ] |
100 | then |
101 | HOME=/root /usr/bin/fc-cache -sr |
102 | fi |