Created
February 10, 2012 22:43
-
-
Save cmavr8/1793663 to your computer and use it in GitHub Desktop.
Dirty script to automate making and installing code to NETCONF server - using YUMA tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to automate making and installing C++ code to NETCONF server config, based on a YANG module file (module_name.yang). Created by Chris Mavrakis <sec@cmavrakis.com>, 21-Nov-2011. | |
# The code is messy and does not do ANY checks... so be careful. Inspect it yourself before using it, I will have no responsibility if something bad happens. Info about YANG, YUMA etc can be found here: http://www.netconfcentral.org | |
### Please edit the following two options: | |
### 1. What is the name of your Module? This should be your filename's first part (before the ".yang") | |
MODULENAME=MYMODULE | |
### 2. What is the directory in which you have the .yang file and would like to create the source code tree? | |
WORKDIR=/home/USER/$MODULENAME | |
# Script begins | |
cd $WORKDIR | |
echo "*** Deleting..." | |
rm -r $MODULENAME | |
echo "*** Copying yang to system dir..." | |
sudo cp $MODULENAME.yang /usr/share/yuma/modules/$MODULENAME.yang | |
sudo cp $MODULENAME.yang /usr/share/yuma/modules/netconfcentral/$MODULENAME.yang | |
echo "*** Running make SIL script..." | |
make_sil_dir $MODULENAME | |
# Change vim to another editor if you like: | |
vim $WORKDIR/$MODULENAME/src/$MODULENAME.c | |
#vim $WORKDIR/$MODULENAME/src/Makefile | |
echo "*** You ended the editor. Making..." | |
# Uncomment to restore a set of changes: | |
#cp $WORKDIR/$MODULENAME.c $WORKDIR/$MODULENAME/src/$MODULENAME.c | |
#echo "*** Copying .c file..." | |
cd $WORKDIR/$MODULENAME | |
make |grep error | |
echo "*** Trying to install (su)..." | |
sudo make install | |
echo "*** All done!" | |
killall -9 netconfd | |
rm /tmp/ncxserver.sock | |
netconfd --module $MODULENAME --module cit-ifconfig --superuser=chris & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment