]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[24-script-to-install-yang-models] Added script to install yang models 24-script-to-install-yang-models
authorFrancis Dupont <fdupont@isc.org>
Wed, 22 Aug 2018 12:24:44 +0000 (14:24 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 22 Aug 2018 12:24:44 +0000 (14:24 +0200)
configure.ac
doc/guide/netconf.xml
src/lib/yang/models/yang-install.sh.in [new file with mode: 0644]
tools/sysrepo_config

index 080a637c575df15ddf2fdc26b6342d12d03f1a4f..deb564c38a28249f27ff9549d9d45afdb2ef5eba 100644 (file)
@@ -883,6 +883,7 @@ if test "$SYSREPO_CONFIG" != "" ; then
     SYSREPO_CPPFLAGS="$SYSREPO_INCLUDEDIR `$SYSREPO_CONFIG --cflags-only-other libsysrepo`"
     SYSREPO_LIBS="`$SYSREPO_CONFIG --libs libsysrepo`"
     SYSREPO_VERSION=`$SYSREPO_CONFIG --modversion libsysrepo`
+    SYSREPO_REPO=`$SYSREPO_CONFIG --variable=SR_REPOSITORY_LOC libsysrepo`
 
     # Now get the environment for C++ bindings for Sysrepo.
     SYSREPOCPP_INCLUDEDIR=`$SYSREPO_CONFIG --cflags-only-I libSysrepo-cpp`
@@ -906,6 +907,7 @@ if test "$SYSREPO_CONFIG" != "" ; then
 
     AC_SUBST(SYSREPO_CPPFLAGS)
     AC_SUBST(SYSREPO_LIBS)
+    AC_SUBST(SYSREPO_REPO)
 
     # Check that a simple program using Sysrepo functions can compile and link.
     CPPFLAGS_SAVED="$CPPFLAGS"
@@ -1588,6 +1590,7 @@ AC_CONFIG_FILES([Makefile
                  src/lib/util/threads/Makefile
                  src/lib/util/threads/tests/Makefile
                  src/lib/util/unittests/Makefile
+                 src/lib/yang/models/yang-install.sh
                  src/share/Makefile
                  src/share/database/Makefile
                  src/share/database/scripts/Makefile
@@ -1635,6 +1638,7 @@ AC_CONFIG_COMMANDS([permissions], [
            chmod +x src/lib/log/tests/severity_test.sh
            chmod +x src/lib/util/python/gen_wiredata.py
            chmod +x src/lib/util/tests/process_spawn_app.sh
+           chmod +x src/lib/yang/models/yang-install.sh
            chmod +x tools/path_replacer.sh
 ])
 
@@ -1795,6 +1799,7 @@ Sysrepo:
   SYSREPO_VERSION:     ${SYSREPO_VERSION}
   SYSREPO_CPPFLAGS:    ${SYSREPO_CPPFLAGS}
   SYSREPO_LIBS:        ${SYSREPO_LIBS}
+  SYSREPO_REPO:        ${SYSREPO_REPO}
 END
 else
 cat >> config.report << END
index 110de77a643b4b49c90d2d7be4994b7834041c9f..c2ddf4e21b6678083ee874c41c13dbed11b18315 100644 (file)
@@ -89,7 +89,9 @@ located at https://github.com/sysrepo/sysrepo.
   $ sysrepoctl -l
 </screen>
 
-After installation the result should be similar to this:
+After installation the result should be similar to this, assuming that
+the sysrepo repository path is
+<filename>/home/thomson/devel/sysrepo-0.7.4/build/repository</filename>:
 <screen>
 Sysrepo schema directory: /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/
 Sysrepo data directory:   /home/thomson/devel/sysrepo-0.7.4/build/repository/data/
@@ -120,18 +122,13 @@ src/lib/libyang/models. To install Kea models, do the following:
 
 <screen>
 cd src/lib/yang/models
-sudo sysrepoctl -i -g kea-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
-sudo sysrepoctl -i -g ietf-dhcpv6-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
+sudo ./yang-install.sh kea-dhcpv4-server.yang
+sudo ./yang-install.sh ietf-dhcpv6-server.yang
 </screen>
 
-Note the first -s parameter specifies the location of your YANG schema
-directory. You can check it with sysrepoctl -l. This is a parameter that is
-configured during sysrepo compilation.
-
-
 The installation should look similar to the following:
 <screen>
-$ sudo sysrepoctl -i -g ietf-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
+$ sudo ./yang-install.sh kea-dhcpv4-server.yang
 Installing a new module from file 'ietf-dhcpv4-server.yang'...
 Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-server@2018-07-14.yang'...
 Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-options'...
diff --git a/src/lib/yang/models/yang-install.sh.in b/src/lib/yang/models/yang-install.sh.in
new file mode 100644 (file)
index 0000000..168226f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# install a yang model
+
+if test $# -ne 1; then
+  echo "Usage: $0 <model>.yang"
+  exit 1
+fi
+
+exec sysrepoctl -i -g $1 -s @SYSREPO_REPO@/yang -s .
index 6da9404e63a3848b05fc8a262e47f6c0d203aee5..463a596a0a295669fd3b8f6aef392b9a17cacc6a 100755 (executable)
@@ -39,6 +39,8 @@ then
        echo "    get lib path"
        echo "--modversion"
        echo "    get version"
+       echo "--variable=SR_REPOSITORY_LOC"
+       echo "    get repo path"
        echo "libraries:"
        echo "    libsysrepo"
        exit 0
@@ -78,5 +80,9 @@ then
        echo "${MAJOR}.${MINOR}.${PATCH}"
        exit 0
 fi
+if [ $1 == "--variable=SR_REPOSITORY_LOC" ]
+then
+       echo "${SYSREPO_PATH}/build/repository"
+fi
 echo "wrong parameter"
 echo "run: \`$0 --help\` for more help"