sysrepo: modified uci-default script
authorMislav Novakovic <mislav.novakovic@sartura.hr>
Tue, 23 May 2017 10:46:12 +0000 (12:46 +0200)
committerMislav Novakovic <mislav.novakovic@sartura.hr>
Wed, 24 May 2017 14:04:55 +0000 (16:04 +0200)
Signed-off-by: Mislav Novakovic <mislav.novakovic@sartura.hr>
net/sysrepo/files/libsysrepo.default

index 4e00cc79f2dc077a3f632ac1228444eefc905bbd..ae2af81f841a8458bc1505a0358e2d4caa37ec1d 100644 (file)
@@ -3,11 +3,30 @@
 # Warning, problems can occur if the device restarts in the middle of this uci-default script
 
 if [ -x /bin/sysrepoctl ]; then
-       sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-acm@2012-02-22.yang -p 644
-       sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-notifications.yang -p 600
-       sysrepoctl --install --yang=/etc/sysrepo/yang/nc-notifications.yang -p 666
-       sysrepoctl --install --yang=/etc/sysrepo/yang/notifications.yang -p 666
-       sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang -p 600
+       match=$(sysrepoctl -l | grep "ietf-netconf-acm\ ")
+       if [ ! "$match" ]; then
+               sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-acm@2012-02-22.yang -p 644
+       fi
+
+       match=$(sysrepoctl -l | grep "ietf-netconf-notifications\ ")
+       if [ ! "$match" ]; then
+               sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-notifications.yang -p 600
+       fi
+
+       match=$(sysrepoctl -l | grep "nc-notifications\ ")
+       if [ ! "$match" ]; then
+               sysrepoctl --install --yang=/etc/sysrepo/yang/nc-notifications.yang -p 666
+       fi
+
+       match=$(sysrepoctl -l | grep "notifications\ ")
+       if [ ! "$match" ]; then
+               sysrepoctl --install --yang=/etc/sysrepo/yang/notifications.yang -p 666
+       fi
+
+       match=$(sysrepoctl -l | grep "ietf-netconf\ ")
+       if [ ! "$match" ]; then
+               sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf@2011-06-01.yang -p 600
+       fi
 fi
 
 exit 0