fix: _brightness.sh - find brighness files with '*video*' path (multiple files)
[cmdllinux.git] / buildroot / _pkg / _#remove6.sh
blob8c6c5f9ab01a056f96ddfa5cdcc066bc977b6a8b
1 #set +e
4 #rem="eudev"
5 #rem="zlib eudev"
6 [ -z "$1" ] && exit 1
7 rem="$@"
8 OIFS="$IFS"
9 IFS=$'\n'
10 rem2="$*"
11 IFS="$OIFS"
13 #check if package exists
14 cd .local
15 echo -n > ../.rem_cache.tmp1
16 echo -n > ../.rem_cache.tmp2
17 echo -n > ../.rem_cache.tmp1.sort
18 echo -n > ../.rem_cache.tmp2.sort
19 #echo "Getting dependencies..."
21 while true; do
22 if test -s ../.rem_cache.tmp1.sort; then
23 cp ../.rem_cache.tmp1.sort ../.rem_cache.tmp1
24 for i in `cut -d / -f 1 ../.rem_cache.tmp1.sort | sort -u`; do
25 ls -d */.depends/$i >> ../.rem_cache.tmp1 2> /dev/null
26 done
27 sort -u ../.rem_cache.tmp1 > ../.rem_cache.tmp1.sort
28 else
29 for i in $rem; do
30 ls -d */.depends/$i >> ../.rem_cache.tmp1 2> /dev/null
31 done
32 if ! test -s ../.rem_cache.tmp1; then
33 no_deps_to_remove=1
34 break
36 sort -u ../.rem_cache.tmp1 > ../.rem_cache.tmp1.sort
38 if cmp ../.rem_cache.tmp1.sort ../.rem_cache.tmp2.sort > /dev/null 2>&1; then
39 break
40 else
41 cp ../.rem_cache.tmp1.sort ../.rem_cache.tmp2.sort
43 done
44 ###remove collected
45 ###remove selected
46 cd ..
47 #exit 0
50 OPKG=
51 DEPP=
52 while read line; do
53 PKG=${line%%/*}
54 DEP=${line##*/}
55 if [[ "$OPKG" != "$PKG" ]]; then
56 if [[ -z "$OPKG" ]]; then
57 DEPP="$DEP"
58 else
59 echo "$OPKG/.depends/$DEPP"
60 DEPP="$DEP"
62 OPKG="$PKG"
63 else
64 [[ -z "$DEPP" ]] && DEPP="$DEP" || DEPP="$DEPP $DEP"
66 done < .rem_cache.tmp1.sort > .rem_cache.tmp1.sort4
67 [[ ! -z "$PKG" ]] && echo "$PKG/.depends/$DEPP" >> .rem_cache.tmp1.sort4
70 cut -d / -f 1 .rem_cache.tmp1.sort | sort -u > .rem_cache.tmp1.sort1
71 #cut -d / -f 3 .rem_cache.tmp1.sort | sort -u > .rem_cache.tmp1.sort2
72 #cat .rem_cache.tmp1.sort1 .rem_cache.tmp1.sort2 | sort -u > .rem_cache.tmp1.sort3
74 ###
75 echo "$rem2" | sort -u > .rem_cache.tmp1.sort5
76 ###
78 DIFF2=`comm -23 --nocheck-order .rem_cache.tmp1.sort5 .rem_cache.tmp1.sort1`
79 for i in $DIFF2; do
80 echo "$i/.depends/" >> .rem_cache.tmp1.sort4
81 done
84 num=0
85 declare -g -a list
86 while read line; do
87 list[$num]="$line"
88 let num++
89 done < .rem_cache.tmp1.sort4
91 processed="@"
92 orig_maxindex=$(( ${#list[@]} - 1 ))
93 num=0
94 while (( ${#list[@]} != 0 )); do
96 if [[ -z "${list[$num]}" ]]; then
97 [[ "$num" -lt "$orig_maxindex" ]] && num=$(( "$num" + 1 )) || num=0
98 continue
100 name="${list[$num]%%/*}"
101 depends="${list[$num]##*/}"
102 deperror=
103 for i in $depends; do
104 [[ "$name" == "$i" ]] && echo "$i----$i----$i"
105 if [[ "${processed}" == "${processed/@$i@/}" ]]; then
106 deperror=1
107 break
109 done
110 if [[ -z "$deperror" ]]; then
111 processed="${processed}${name}@"
112 unset list[$num]
114 [[ "$num" -lt "$orig_maxindex" ]] && num=$(( $num + 1 )) || num=0
115 done
117 len=$(( ${#processed} - 1 ))
118 processed="${processed::$len}"
119 reverse=`echo "${processed}" | tr '@' '\n' | tac`
121 echo "$reverse"
122 #exit 0