aboutsummaryrefslogtreecommitdiff
path: root/assets/utils
blob: 711f2d47404b34aadde97d4214e7fd0905096903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#
####### made by h0rn3t #######
#
count_files(){
if [ "X$2" == "X" ]; then
    ext="*";
else
    ext="$2";
fi;
r="";
for d in $1; do
    if [ -d $d ]; then
        i=$( busybox find $d -type f -name "$ext" | busybox wc -l );
    else
        i=0;
    fi;
    if [ "X$r" == "X" ]; then
        r="$i";
    else
        r="$r:$i";
    fi;
done;
echo "$r";
}
arg=$1;
if [ "$arg" == "-count" ]; then
    count_files "$DIRS";
elif [ "$arg" == "-govprop" ]; then
    r="";
    gov=$2;
    if [ "X$gov" == "X" ]; then
        echo "";
        exit;
    fi;
    for f in $(busybox find /sys/devices/system/cpu/cpufreq/$gov/* -type f -prune -perm -644); do
        v=$(busybox cat $f);
        if [ "X$r" == "X" ]; then
            r="$f:$v";
        else
            r="$r;$f:$v";
        fi;
    done;
    echo "$r";
fi;