* Martin Michlmayr <[email protected]> [2015-06-15 17:41]:
> qcontrol looks at /proc/cpuinfo, but this no longer works in Debian
> stretch due to the conversion to devic tree.

tags 788885 + patch
thanks

Here's an (untested) patch.

This assumes that /proc/device-tree/model always contains the correct
device information when the file exists.  I'm not sure if this is true
on DT-enabled kernels that have non-DT platform support.  However, this
point is moot anyway since the Kirkwood kernel in stretch is DT-only.
It's only an issue in jessie (where the Kirkwood kernel has support
for both DT and non-DT devices) but this patch doesn't have to be
backported.  It would matter for qcontrol backports to jessie, though!

Martin

diff --git a/debian/initramfs/init-bottom b/debian/initramfs/init-bottom
index c517341..722fae3 100755
--- a/debian/initramfs/init-bottom
+++ b/debian/initramfs/init-bottom
@@ -18,11 +18,17 @@ esac
 # Begin real processing below this line
 
 # Only needed on TS-219P II and TS-419P II, safe to call on any TS-x19 though.
-device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-        head -n1 | sed "s/^[^:]*: //")
+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-119/TS-219") break ;;
+    "QNAP TS219 family")  break ;;
     "QNAP TS-41x")        break ;;
+    "QNAP TS419 family")  break ;;
     *)                    exit 0 ;;
 esac
 
diff --git a/debian/qcontrol.postinst b/debian/qcontrol.postinst
index eb3969d..f12c42a 100755
--- a/debian/qcontrol.postinst
+++ b/debian/qcontrol.postinst
@@ -2,16 +2,20 @@
 set -e
 
 if [ ! -e /etc/qcontrol.conf ]; then
-       device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-                head -n1 | sed "s/^[^:]*: //")
+       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")
                ln -s qcontrol/ts209.lua /etc/qcontrol.conf ;;
-           "QNAP TS-119/TS-219")
+           "QNAP TS-119/TS-219" | "QNAP TS219 family")
                ln -s qcontrol/ts219.lua /etc/qcontrol.conf ;;
            "QNAP TS-409")
                ln -s qcontrol/ts409.lua /etc/qcontrol.conf ;;
-           "QNAP TS-41x")
+           "QNAP TS-41x" | "QNAP TS419 family")
                ln -s qcontrol/ts41x.lua /etc/qcontrol.conf ;;
        esac
 fi
diff --git a/debian/udeb/debian-installer-startup.d/S99qcontrol 
b/debian/udeb/debian-installer-startup.d/S99qcontrol
index 2afb2a8..06fa7d1 100644
--- a/debian/udeb/debian-installer-startup.d/S99qcontrol
+++ b/debian/udeb/debian-installer-startup.d/S99qcontrol
@@ -2,17 +2,21 @@
 
 if qcommand -t; then
        watchdog="no"
-       device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-                head -n1 | sed "s/^[^:]*: //")
+       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")
                mv /etc/qcontrol/ts209.lua /etc/qcontrol.conf ;;
-           "QNAP TS-119/TS-219")
+           "QNAP TS-119/TS-219" | "QNAP TS219 family")
                watchdog="yes"
                mv /etc/qcontrol/ts219.lua /etc/qcontrol.conf ;;
            "QNAP TS-409")
                mv /etc/qcontrol/ts409.lua /etc/qcontrol.conf ;;
-           "QNAP TS-41x")
+           "QNAP TS-41x" | "QNAP TS419 family")
                watchdog="yes"
                mv /etc/qcontrol/ts41x.lua /etc/qcontrol.conf ;;
        esac
diff --git a/debian/udeb/qcommand b/debian/udeb/qcommand
index 08b2944..04d767c 100644
--- a/debian/udeb/qcommand
+++ b/debian/udeb/qcommand
@@ -4,10 +4,14 @@
 # If called with -t, it only tests if the device is supported
 
 # Test if device is supported
-device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
-        head -n1 | sed "s/^[^:]*: //")
+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 TS-409" | "QNAP 
TS-41x")
+    "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 ;;
     *)
@@ -22,7 +26,7 @@ test_event_dev() {
 }
 
 case $device in
-    "QNAP TS-409" | "QNAP TS-41x")
+    "QNAP TS-409" | "QNAP TS-41x" | "QNAP TS419 family")
        if [ "$1" = powerled ]; then
                exit 0
        fi ;;

-- 
Martin Michlmayr
http://www.cyrius.com/


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to