File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
platform/mellanox/hw-management Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,38 @@ index 0000000..d18916d
36
36
+ [Service]
37
37
+ Type=oneshot
38
38
+ EnvironmentFile=/host/machine.conf
39
- + ExecStart=/bin/bash -c "/usr/share/sonic/device/$onie_platform/ hw-management start"
40
- + ExecStop=/bin/bash -c "/usr/share/sonic/device/$onie_platform/ hw-management stop"
39
+ + ExecStart=/bin/bash -c "/usr/bin/ hw-management-service.sh $onie_platform start"
40
+ + ExecStop=/bin/bash -c "/usr/bin/ hw-management-service.sh $onie_platform stop"
41
41
+
42
42
+ [Install]
43
43
+ WantedBy=multi-user.target
44
+ diff --git a/usr/usr/bin/hw-management-service.sh b/usr/usr/bin/hw-management-service.sh
45
+ new file mode 100755
46
+ index 0000000..e3774e5
47
+ --- /dev/null
48
+ +++ b/usr/usr/bin/hw-management-service.sh
49
+ @@ -0,0 +1,21 @@
50
+ + #!/bin/bash
51
+ +
52
+ + if [ $# -ne 2 ]
53
+ + then
54
+ + echo "Error: Invalid parameters"
55
+ + exit 1
56
+ + fi
57
+ +
58
+ + if [ -f /etc/sonic/config_db.json ]
59
+ + then
60
+ + mac_exist=$(grep -c "\"mac\"" /etc/sonic/config_db.json)
61
+ + mac_is_none=$(grep "\"mac\"" /etc/sonic/config_db.json | grep -c "\"None\"")
62
+ + if [ "$mac_exist" == "0" ] || [ "$mac_is_none" == "1" ]
63
+ + then
64
+ + echo "No MAC address, need hw-management service in updategraph"
65
+ + exec /usr/share/sonic/device/$1/hw-management $2
66
+ + exit 0
67
+ + fi
68
+ + fi
69
+ +
70
+ + echo "MAC address already exists in config_db.json, do nothing"
44
71
diff --git a/debian/rules b/debian/rules
45
72
index fc38817..fba4150 100755
46
73
--- a/debian/rules
You can’t perform that action at this time.
0 commit comments