Initial commit of the O1 simulator framework.
[sim/o1-interface.git] / ntsimulator / scripts / model-uninstall.sh.in
1 #!/bin/bash
2
3 sleep 5
4
5 set -eu -o pipefail
6
7 shopt -s failglob
8
9 : ${SYSREPOCTL:=sysrepoctl}
10 : ${SYSREPOCFG:=sysrepocfg}
11 : ${SYSREPOCTL_ROOT_PERMS:=-o root:root -p 600}
12 : ${YANG_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang}
13 : ${STARTUP_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang/startup}
14
15 is_yang_module_installed() {
16     module=$1
17
18     $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
19 }
20
21 uninstall_yang_module() {
22     module=$1
23
24     if ! is_yang_module_installed $module; then
25         echo "- Module $module not installed, skipping..."
26     else
27         $SYSREPOCTL -u -m $$module
28     fi
29 }
30
31 echo "- Uninstalling code-model and microwave-model..."
32 uninstall_yang_module microwave-model,core-model