demo-i2c-udev-conf: update for reworked agl-service-hvac
[AGL/meta-agl-demo.git] / recipes-core / udev / demo-i2c-udev-conf / hvac-conf-in-rewrite.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: Apache-2.0
3 # (C) 2018 Jan-Simon Möller, dl9pf@gmx.de, jsmoeller@linuxfoundation.org
4 # (C) 2022 Scott Murray <scott.murray@konsulko.com>
5
6 #set -x
7 set -e
8
9 TARGET="/etc/xdg/AGL/agl-service-hvac-leds.conf"
10
11 if [ $1 ] ; then
12     # The device is always 0009 -> 9 . Only change is the i2c IF .
13     LED=`echo $1 | sed -e "s#0009#9#g"`
14     if [ $? -eq 0 ] ; then
15         echo "$LED"
16         sed -e "s#@DEVICE@#$LED#" ${TARGET}.in > ${TARGET}
17     else
18         echo "Invalid argument"
19         exit 1
20     fi
21 else
22     echo "Need argument"
23     exit 1
24 fi