File: qcommand

package info (click to toggle)
qcontrol 0.5.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 348 kB
  • sloc: ansic: 2,020; sh: 228; makefile: 82
file content (32 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (7)
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
#!/bin/sh

# Wrapper script for qcontrol to execute single commands
# If called with -t, it only tests if the device is supported

# Test if device is supported
if [ -e /proc/device-tree/model ]; then
	device=$(cat /proc/device-tree/model)
else
	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
		 head -n1 | sed "s/^[^:]*: //")
fi
case $device in
    "QNAP TS-109/TS-209" | "QNAP TS-119/TS-219" | "QNAP TS219 family" | "QNAP TS-409" | "QNAP TS-41x" | "QNAP TS419 family")
	# Success or continue 
	[ "$1" = "-t" ] && exit 0 || true ;;
    *)
	# Failure or silently exit
	[ "$1" = "-t" ] && exit 1 || exit 0 ;;
esac

case $device in
    "QNAP TS-409" | "QNAP TS-41x" | "QNAP TS419 family")
	if [ "$1" = powerled ]; then
		exit 0
	fi ;;
esac

# Returns 1 even on success (TODO: is that still true?)
qcontrol --direct "$@" || true

exit 0