Squeeze のインストール(17)インストーラの修正

Debian

温度によるファン制御スクリプトを作るよう インストーラを修正する。
yasunari@qube:/mnt/disk1/share/hackkit/current$ diff -u hackkit_101229.sh hackkit_squeeze_110109.sh
--- hackkit_101229.sh   2010-12-29 10:10:13.428539000 +0900
+++ hackkit_squeeze_110109.sh   2011-01-09 11:54:00.466927365 +0900
@@ -13,7 +13,7 @@
 HOSTNAME=hackkit

 WORK=/mnt/disk1/share/hackkit
-HACKKIT=$WORK/hackkit_101225.tar.gz
+HACKKIT=$WORK/hackkit_squeeze_110103.tar.gz
 MOUNTPOINT=/mnt/debinst

 cd $WORK
@@ -249,62 +249,65 @@


 #---------------------------------------------------------
-# Fan コントロールスクリプトの作成(LS-GL,HS-DHGLのみ)
+# Fan コントロールスクリプトの作成
 create_fancontrol() {
-       if [ $MACHINE != LSGL -a $MACHINE != HSDHGL ]
-       then
-               return
-       fi
        echo creating fancontrol ...

        cd $MOUNTPOINT
        cat > usr/local/sbin/fancontrol <<EOF
 #!/bin/sh
-# LS-GL, HS-DHGL, KURO-BOX/Pro Fancontrol
-# (C) Copyright Yasunari YAMASHITA 2007. All Rights Reserved.
+# 3G LinkStation Fancontrol script.
+# (C) Copyright Yasunari YAMASHITA 2007-2011. All Rights Reserved.
+
+get_curtemp()
+{
+        #       # smartctl -A -d marvell /dev/sda
+        #       194 Temperature_Celsius     0x0022   116   079   000    Old_age   Always       -       31
+
+        CURTEMP=`smartctl -A -d marvell /dev/sda -s on | sed -n -e 's/^194 .* \([0-9]*\)$/\1/p'`
+}
+set_fan_speed()
+{
+        echo \$FANSPEED > /proc/buffalo/gpio/fan/control
+        echo fan_set_speed \$FANSPEED
+}

 PATH=\$PATH:/usr/sbin

 # stop -> LOW |- slow -> MID |- fast -> HIGH |- full
-HIGH=40
-MID=30
-LOW=20
+HIGH=45
+MID=40
+LOW=30

 if [ -f /etc/fancontrol.conf ]
 then
         . /etc/fancontrol.conf
 fi

-#       ude:/usr/local/sbin# /usr/local/sbin/miconapl -a temp_get
-#       #[miconapl.temp_get]
-#       temp=45
-
-CURTEMP=\`/usr/local/sbin/miconapl -a temp_get | sed -n -e 's/temp=//p'\`
-
+get_curtemp
 echo \$CURTEMP

 if [ \$CURTEMP -gt \$HIGH ] # full
 then
-        /usr/local/sbin/miconapl -a fan_set_speed full
-        echo fan_set_speed full
+        FANSPEED=full
+        set_fan_speed
 elif [ \$CURTEMP -gt \$MID ] # fast
 then
-        /usr/local/sbin/miconapl -a fan_set_speed fast
-        echo fan_set_speed fast
+        FANSPEED=fast
+        set_fan_speed
 elif [ \$CURTEMP -gt \$LOW ] # slow
 then
-        /usr/local/sbin/miconapl -a fan_set_speed slow
-        echo fan_set_speed slow
+        FANSPEED=slow
+        set_fan_speed
 else                       # stop
-        /usr/local/sbin/miconapl -a fan_set_speed stop
-        echo fan_set_speed stop
+        FANSPEED=stop
 fi
 EOF

        cat > etc/fancontrol.conf <<EOF
 #
-# LS-GL, HS-DHGL, KURO-BOX/Pro Fancontrol configuration file
-# (C) Copyright Yasunari YAMASHITA 2007. All Rights Reserved.
+# 3G LinkStation Fancontrol script configuration file
+# (C) Copyright Yasunari YAMASHITA 2007-2011. All Rights Reserved.

 # stop -> LOW |- slow -> MID |- fast -> HIGH |- full

yasunari@qube:/mnt/disk1/share/hackkit/current$
さて、、、全機種で再確認、、、



lenny で smartctl
ハックの記録
LinkStation/玄箱 をハックしよう

Squeeze のインストール(18)LS-VL で再々確認

Copyright (C) 2003-2011 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市