You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.0 KiB
110 lines
2.0 KiB
6 years ago
|
#
|
||
|
# /etc/init.d/functions - global functions that are used by scripts
|
||
|
#
|
||
|
# -----------------------------------------------------------------------------
|
||
7 years ago
|
|
||
|
. /etc/init.d/globals
|
||
|
|
||
|
run_initscripts() {
|
||
|
if [ "x$1" == xstop ]; then
|
||
|
action="stop"
|
||
|
doing="stopping"
|
||
|
files="/etc/init.d/K[0-9][0-9]* /var/etc/init.d/K[0-9][0-9]*"
|
||
|
else
|
||
|
action="start"
|
||
|
doing="starting"
|
||
|
files="/etc/init.d/S[0-9][0-9]* /var/etc/init.d/S[0-9][0-9]*"
|
||
|
fi
|
||
|
|
||
|
names=$(for file in $files ; do echo ${file##*/} ; done | sort -u)
|
||
|
|
||
|
for name in $names; do
|
||
|
[ "${name:1}" = "[0-9][0-9]*" ] && continue
|
||
|
for file in /etc/init.d/$name /var/etc/init.d/$name; do
|
||
|
if [ -x "$file" ]; then
|
||
|
LOGINFO "$doing $file ..."
|
||
|
"$file" $action
|
||
|
break;
|
||
|
fi
|
||
|
done
|
||
|
done
|
||
|
}
|
||
|
|
||
|
create_node()
|
||
|
{
|
||
|
device=$1
|
||
|
|
||
|
rm -f /dev/${device}
|
||
|
major=`awk "\\$2==\"$device\" {print \\$1}" /proc/devices`
|
||
|
|
||
|
if [ ${major} ]; then
|
||
|
LOGINFO "Creating device node $1"
|
||
|
mknod /dev/${device} c $major 0
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
create_node_dir()
|
||
|
{
|
||
|
device=$1
|
||
|
|
||
|
rm -rf /dev/${device}
|
||
|
mkdir -p /dev/${device}
|
||
|
|
||
|
major=`awk "\\$2==\"$device\" {print \\$1}" /proc/devices`
|
||
|
|
||
|
if [ ${major} ]; then
|
||
|
LOGINFO "Creating device node dir $1"
|
||
|
mknod /dev/${device}/0 c $major 0
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
load_module()
|
||
|
{
|
||
|
kernel=$(uname -r)
|
||
|
module=/lib/modules/${kernel}/$1
|
||
|
shift
|
||
|
params=$@
|
||
|
|
||
|
if [ -e $module ]; then
|
||
|
LOGINFO "Loading ${module##*/} "
|
||
|
insmod $module $params
|
||
|
fi
|
||
|
}
|
||
6 years ago
|
|
||
4 years ago
|
get_boxmodel()
|
||
|
{
|
||
|
if [ -e /proc/stb/info/vumodel ]; then
|
||
|
model=$(cat /proc/stb/info/vumodel)
|
||
|
elif [ -e /proc/stb/info/model ]; then
|
||
|
model=$(cat /proc/stb/info/model)
|
||
|
elif [ -e /etc/model ]; then
|
||
|
model=$(cat /etc/model)
|
||
|
else
|
||
|
model="unknown"
|
||
|
fi
|
||
|
printf ${model}
|
||
|
}
|
||
|
|
||
4 years ago
|
display_msg()
|
||
|
{
|
||
|
msg="$*"
|
||
4 years ago
|
case "$(get_boxmodel)" in
|
||
|
nevis|apollo|shiner|kronos|kronos_v2)
|
||
|
dt -t "${msg}"
|
||
|
;;
|
||
|
hd51|bre2ze4k|h7|hd60|hd61|multiboxse)
|
||
|
if [ -e /dev/dbox/oled0 ]; then
|
||
|
echo "${msg}" > /dev/dbox/oled0
|
||
|
fi
|
||
|
;;
|
||
|
solo4k|duo4k|duo4kse|ultimo4k|zero4k|uno4k|uno4kse)
|
||
|
oled -tc "${msg}"
|
||
|
;;
|
||
|
esac
|
||
4 years ago
|
}
|
||
|
|
||
6 years ago
|
get_setting()
|
||
|
{
|
||
|
test -e $NEUTRINO_CONF && grep "^${1}=" $NEUTRINO_CONF | cut -d'=' -f2
|
||
|
}
|