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