mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 13:40:48 +00:00
Merge pull request #182 from setrofim/master
shutil: fix read_tree_values and hotplug_online_all for sh
This commit is contained in:
commit
d1e83b53a3
@ -200,8 +200,7 @@ cgroups_freezer_set_state() {
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
hotplug_online_all() {
|
hotplug_online_all() {
|
||||||
PATHS=(/sys/devices/system/cpu/cpu[0-9]*)
|
for path in /sys/devices/system/cpu/cpu[0-9]*; do
|
||||||
for path in "${PATHS[@]}"; do
|
|
||||||
if [ $(cat $path/online) -eq 0 ]; then
|
if [ $(cat $path/online) -eq 0 ]; then
|
||||||
echo 1 > $path/online
|
echo 1 > $path/online
|
||||||
fi
|
fi
|
||||||
@ -213,17 +212,21 @@ hotplug_online_all() {
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
read_tree_values() {
|
read_tree_values() {
|
||||||
PATH=$1
|
BASEPATH=$1
|
||||||
MAXDEPTH=$2
|
MAXDEPTH=$2
|
||||||
|
|
||||||
if [ ! -e $PATH ]; then
|
if [ ! -e $BASEPATH ]; then
|
||||||
echo "ERROR: $PATH does not exist"
|
echo "ERROR: $BASEPATH does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATHS=($($BUSYBOX find $PATH -follow -maxdepth $MAXDEPTH))
|
PATHS=$($BUSYBOX find $BASEPATH -follow -maxdepth $MAXDEPTH)
|
||||||
if [ ${#PATHS[@]} -gt 1 ]; then
|
i=0
|
||||||
$BUSYBOX grep -s '' ${PATHS[@]}
|
for path in $PATHS; do
|
||||||
|
i=$(expr $i + 1)
|
||||||
|
done
|
||||||
|
if [ $i -gt 1 ]; then
|
||||||
|
$BUSYBOX grep -s '' $PATHS
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user