#!/bin/sh set -e # avoid problems with sudo path SYSREPOCFG=`which sysrepocfg` KS_KEY_NAME=genkey # check that there is no listen/Call Home configuration yet SERVER_CONFIG=`$SYSREPOCFG -X -x "/ietf-netconf-server:netconf-server/listen/endpoint[1]/name | /ietf-netconf-server:netconf-server/call-home/netconf-client[1]/name"` if [ -z "$SERVER_CONFIG" ]; then # import default config CONFIG=" default-ssh 0.0.0.0 1 10 5 default-key $KS_KEY_NAME interactive " TMPFILE=`mktemp -u` printf -- "$CONFIG" > $TMPFILE # apply it to startup and running $SYSREPOCFG --edit=$TMPFILE -d startup -f xml -m ietf-netconf-server -v2 $SYSREPOCFG -C startup -m ietf-netconf-server -v2 # remove the tmp file rm $TMPFILE fi