blob: 3c84ce4188356ee581366b5155ff40f8c4dbc472 [file] [log] [blame]
Hank Lioubf5dffe2019-05-24 10:27:08 +08001#!/bin/bash
2
3NVME_GPIO_NUM=( 148 149 150 151 152 153 154 155 )
4NVME=( 1 1 1 1 1 1 1 1 )
5FAN_TABLE_PATH="/usr/share/swampd/config.json"
6FAN_TABLE=( "/usr/share/swampd/config-8ssd.json" "/usr/share/swampd/config-2ssd.json" )
7TYPE=-1
8
9# get nvme presence
10for i in {0..7}
11do
12 gpioNum=${NVME_GPIO_NUM[$i]}
13 NVME[$i]=$(cat /sys/class/gpio/gpio$gpioNum/value)
14done
15
16# distinguish between 8-ssd and 2-ssd sku
17for i in {2..7}
18do
19 if [ ${NVME[$i]} -eq 0 ]; then
20 TYPE=0
21 fi
22done
23if [ $TYPE -eq -1 ]; then
24 for i in {0..1}
25 do
26 if [ ${NVME[$i]} -eq 0 ]; then
27 TYPE=1
28 fi
29 done
30fi
31
32if [ $TYPE -eq 1 ]; then
33 cp ${FAN_TABLE[1]} $FAN_TABLE_PATH
34else
35 cp ${FAN_TABLE[0]} $FAN_TABLE_PATH
36fi
37
38# start pid control
39/usr/bin/swampd