Merge pull request #436 from rbgarga/fix-cligen-dir

Fix cligen dir
This commit is contained in:
Olof Hagsand 2023-07-06 17:00:17 +02:00 committed by GitHub
commit ad61570a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 189 additions and 184 deletions

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2014-09-12.12; # UTC scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@ -69,6 +69,11 @@ posix_mkdir=
# Desired mode of installed file. # Desired mode of installed file.
mode=0755 mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd= chgrpcmd=
chmodcmd=$chmodprog chmodcmd=$chmodprog
chowncmd= chowncmd=
@ -99,18 +104,28 @@ Options:
--version display version info and exit. --version display version info and exit.
-c (ignored) -c (ignored)
-C install only if different (preserve the last data modification time) -C install only if different (preserve data modification time)
-d create directories instead of installing files. -d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP. -g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE. -m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER. -o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files. -s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY. -t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory. -T report an error if DSTFILE is a directory.
Environment variables override the default commands: Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
" "
while test $# -ne 0; do while test $# -ne 0; do
@ -137,8 +152,13 @@ while test $# -ne 0; do
-o) chowncmd="$chownprog $2" -o) chowncmd="$chownprog $2"
shift;; shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;; -s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t) -t)
is_target_a_directory=always is_target_a_directory=always
dst_arg=$2 dst_arg=$2
@ -255,6 +275,10 @@ do
dstdir=$dst dstdir=$dst
test -d "$dstdir" test -d "$dstdir"
dstdir_status=$? dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
@ -271,15 +295,18 @@ do
fi fi
dst=$dst_arg dst=$dst_arg
# If destination is a directory, append the input filename; won't work # If destination is a directory, append the input filename.
# if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test "$is_target_a_directory" = never; then if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2 echo "$0: $dst_arg: Is a directory" >&2
exit 1 exit 1
fi fi
dstdir=$dst dstdir=$dst
dst=$dstdir/`basename "$src"` dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0 dstdir_status=0
else else
dstdir=`dirname "$dst"` dstdir=`dirname "$dst"`
@ -288,27 +315,16 @@ do
fi fi
fi fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false obsolete_mkdir_used=false
if test $dstdir_status != 0; then if test $dstdir_status != 0; then
case $posix_mkdir in case $posix_mkdir in
'') '')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode. # With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask. # Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
@ -318,50 +334,49 @@ do
fi fi
posix_mkdir=false posix_mkdir=false
case $umask in # The $RANDOM variable is not portable (e.g., dash). Use it
*[123567][0-7][0-7]) # here however when possible just to lower collision chance.
# POSIX mkdir -p sets u+wx bits regardless of umask, which tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# $RANDOM is not portable (e.g. dash); use it when possible to
# lower collision chance
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# As "mkdir -p" follows symlinks and we work in /tmp possibly; so trap '
# create the $tmpdir first (and fail if unsuccessful) to make sure ret=$?
# that nobody tries to guess the $tmpdir name. rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
if (umask $mkdir_umask && exit $ret
$mkdirprog $mkdir_mode "$tmpdir" && ' 0
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then # Because "mkdir -p" follows existing symlinks and we likely work
if test -z "$dir_arg" || { # directly in world-writeable /tmp, make sure that the '$tmpdir'
# Check for POSIX incompatibilities with -m. # directory is successfully created first before we actually test
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # 'mkdir -p'.
# other-writable bit of parent directory when it shouldn't. if (umask $mkdir_umask &&
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. $mkdirprog $mkdir_mode "$tmpdir" &&
test_tmpdir="$tmpdir/a" exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
ls_ld_tmpdir=`ls -ld "$test_tmpdir"` then
case $ls_ld_tmpdir in if test -z "$dir_arg" || {
d????-?r-*) different_mode=700;; # Check for POSIX incompatibilities with -m.
d????-?--*) different_mode=755;; # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
*) false;; # other-writable bit of parent directory when it shouldn't.
esac && # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && { test_tmpdir="$tmpdir/a"
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" case $ls_ld_tmpdir in
} d????-?r-*) different_mode=700;;
} d????-?--*) different_mode=755;;
then posix_mkdir=: *) false;;
fi esac &&
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
else ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
# Remove any dirs left behind by ancient mkdir implementations. test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null }
fi }
trap '' 0;; then posix_mkdir=:
esac;; fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac esac
if if
@ -372,7 +387,7 @@ do
then : then :
else else
# The umask is ridiculous, or mkdir does not conform to POSIX, # mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the # or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go. # directory the slow way, step by step, checking for races as we go.
@ -401,7 +416,7 @@ do
prefixes= prefixes=
else else
if $posix_mkdir; then if $posix_mkdir; then
(umask=$mkdir_umask && (umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently. # Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1 test -d "$prefix" || exit 1
@ -434,14 +449,25 @@ do
else else
# Make a couple of temp file names in the proper directory. # Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_ dsttmp=${dstdirslash}_inst.$$_
rmtmp=$dstdir/_rm.$$_ rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit. # Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name. # Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && (umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits. # and set any options; do chmod last to preserve setuid bits.
# #
@ -467,6 +493,13 @@ do
then then
rm -f "$dsttmp" rm -f "$dsttmp"
else else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination. # Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
@ -481,9 +514,9 @@ do
# file should still install successfully. # file should still install successfully.
{ {
test ! -f "$dst" || test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null || $doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} || } ||
{ echo "$0: cannot unlink or rename $dst" >&2 { echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1 (exit 1); exit 1
@ -500,9 +533,9 @@ do
done done
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:

29
configure vendored
View file

@ -648,6 +648,7 @@ ac_includes_default="\
ac_header_c_list= ac_header_c_list=
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
CLIGEN_DIR
WC_BIN WC_BIN
TAIL_BIN TAIL_BIN
GREP GREP
@ -685,7 +686,6 @@ INSTALL_DATA
INSTALL_SCRIPT INSTALL_SCRIPT
INSTALL_PROGRAM INSTALL_PROGRAM
INCLUDES INCLUDES
CLIGEN_PREFIX
CLIXON_VERSION_MINOR CLIXON_VERSION_MINOR
CLIXON_VERSION_MAJOR CLIXON_VERSION_MAJOR
CLIXON_VERSION_STRING CLIXON_VERSION_STRING
@ -2825,13 +2825,6 @@ else
: ${CFLAGS="-O2 -Wall"} : ${CFLAGS="-O2 -Wall"}
fi fi
# Check CLIgen
if test "$prefix" = "NONE"; then
CLIGEN_PREFIX="$ac_default_prefix"
else
CLIGEN_PREFIX="$prefix"
fi
ac_config_headers="$ac_config_headers include/clixon_config.h lib/clixon/clixon.h" ac_config_headers="$ac_config_headers include/clixon_config.h lib/clixon/clixon.h"
@ -4010,7 +4003,6 @@ test -n "$target_alias" &&
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CLIXON version is ${CLIXON_VERSION}" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CLIXON version is ${CLIXON_VERSION}" >&5
printf "%s\n" "CLIXON version is ${CLIXON_VERSION}" >&6; } printf "%s\n" "CLIXON version is ${CLIXON_VERSION}" >&6; }
@ -5903,6 +5895,10 @@ if test "$prefix" = "NONE"; then
prefix=${ac_default_prefix} prefix=${ac_default_prefix}
fi fi
if test "$exec_prefix" = "NONE"; then
exec_prefix=${prefix}
fi
# Postfix for shared libs # Postfix for shared libs
SH_SUFFIX=".so" SH_SUFFIX=".so"
# Postfix for static libs # Postfix for static libs
@ -5914,16 +5910,15 @@ LIBSTATIC_SUFFIX=".a"
if test ${with_cligen+y} if test ${with_cligen+y}
then : then :
withval=$with_cligen; withval=$with_cligen;
CLIGEN_DIR="$withval"
fi fi
if test -n "${CLIGEN_DIR}" -a -d "${CLIGEN_DIR}"; then if test -n "${CLIGEN_DIR}" -a -d "${CLIGEN_DIR}"; then
with_cligen=${CLIGEN_DIR} echo "Using CLIGEN here: ${CLIGEN_DIR}"
fi CPPFLAGS="-I${CLIGEN_DIR}$(eval echo ${includedir}) ${CPPFLAGS}"
if test -d "${with_cligen}"; then LDFLAGS="-L${CLIGEN_DIR}$(eval echo ${libdir}) ${LDFLAGS}"
echo "Using CLIGEN here: ${with_cligen}"
CPPFLAGS="-I${with_cligen}/include ${CPPFLAGS}"
LDFLAGS="-L${with_cligen}/lib ${LDFLAGS}"
test -d "$with_cligen" && CLIGEN_PREFIX="$with_cligen"
fi fi
# Disable/enable yang patch # Disable/enable yang patch
@ -6873,10 +6868,8 @@ fi
# Expand for easy replacement in example/main/example.xml.in # Expand for easy replacement in example/main/example.xml.in
# Special case is $libdir, which is composed from $exec_prefix # Special case is $libdir, which is composed from $exec_prefix
test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
SYSCONFDIR=`eval echo $sysconfdir` SYSCONFDIR=`eval echo $sysconfdir`
LIBDIR=`eval echo $libdir` LIBDIR=`eval echo $libdir`
LIBDIR=`eval echo $LIBDIR`
LOCALSTATEDIR=`eval echo $localstatedir` LOCALSTATEDIR=`eval echo $localstatedir`
ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile apps/snmp/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/main/Makefile example/main/example.xml docker/Makefile docker/clixon-dev/Makefile docker/example/Makefile docker/test/Makefile util/Makefile yang/Makefile yang/clixon/Makefile yang/mandatory/Makefile doc/Makefile test/Makefile test/config.sh test/cicd/Makefile test/vagrant/Makefile" ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile apps/snmp/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/main/Makefile example/main/example.xml docker/Makefile docker/clixon-dev/Makefile docker/example/Makefile docker/test/Makefile util/Makefile yang/Makefile yang/clixon/Makefile yang/mandatory/Makefile doc/Makefile test/Makefile test/config.sh test/cicd/Makefile test/vagrant/Makefile"

View file

@ -71,13 +71,6 @@ else
: ${CFLAGS="-O2 -Wall"} : ${CFLAGS="-O2 -Wall"}
fi fi
# Check CLIgen
if test "$prefix" = "NONE"; then
CLIGEN_PREFIX="$ac_default_prefix"
else
CLIGEN_PREFIX="$prefix"
fi
AC_CONFIG_HEADERS([include/clixon_config.h lib/clixon/clixon.h]) AC_CONFIG_HEADERS([include/clixon_config.h lib/clixon/clixon.h])
AC_DEFINE_UNQUOTED(CLIXON_VERSION_STRING, $CLIXON_VERSION, [Clixon version string]) AC_DEFINE_UNQUOTED(CLIXON_VERSION_STRING, $CLIXON_VERSION, [Clixon version string])
@ -96,7 +89,6 @@ AC_SUBST(CLIXON_VERSION)
AC_SUBST(CLIXON_VERSION_STRING) AC_SUBST(CLIXON_VERSION_STRING)
AC_SUBST(CLIXON_VERSION_MAJOR) AC_SUBST(CLIXON_VERSION_MAJOR)
AC_SUBST(CLIXON_VERSION_MINOR) AC_SUBST(CLIXON_VERSION_MINOR)
AC_SUBST(CLIGEN_PREFIX)
AC_MSG_RESULT(CLIXON version is ${CLIXON_VERSION}) AC_MSG_RESULT(CLIXON version is ${CLIXON_VERSION})
@ -177,21 +169,24 @@ if test "$prefix" = "NONE"; then
prefix=${ac_default_prefix} prefix=${ac_default_prefix}
fi fi
if test "$exec_prefix" = "NONE"; then
exec_prefix=${prefix}
fi
# Postfix for shared libs # Postfix for shared libs
SH_SUFFIX=".so" SH_SUFFIX=".so"
# Postfix for static libs # Postfix for static libs
LIBSTATIC_SUFFIX=".a" LIBSTATIC_SUFFIX=".a"
# This is for cligen # This is for cligen
AC_ARG_WITH([cligen], AS_HELP_STRING([--with-cligen=dir],[Use CLIGEN installation in this dir])) AC_ARG_WITH([cligen], [AS_HELP_STRING([--with-cligen=dir], [Use CLIGEN installation in this dir])], [
CLIGEN_DIR="$withval"
])
AC_SUBST(CLIGEN_DIR)
if test -n "${CLIGEN_DIR}" -a -d "${CLIGEN_DIR}"; then if test -n "${CLIGEN_DIR}" -a -d "${CLIGEN_DIR}"; then
with_cligen=${CLIGEN_DIR} echo "Using CLIGEN here: ${CLIGEN_DIR}"
fi CPPFLAGS="-I${CLIGEN_DIR}$(eval echo ${includedir}) ${CPPFLAGS}"
if test -d "${with_cligen}"; then LDFLAGS="-L${CLIGEN_DIR}$(eval echo ${libdir}) ${LDFLAGS}"
echo "Using CLIGEN here: ${with_cligen}"
CPPFLAGS="-I${with_cligen}/include ${CPPFLAGS}"
LDFLAGS="-L${with_cligen}/lib ${LDFLAGS}"
test -d "$with_cligen" && CLIGEN_PREFIX="$with_cligen"
fi fi
# Disable/enable yang patch # Disable/enable yang patch
@ -413,10 +408,8 @@ AH_BOTTOM([#include <clixon_custom.h>])
# Expand for easy replacement in example/main/example.xml.in # Expand for easy replacement in example/main/example.xml.in
# Special case is $libdir, which is composed from $exec_prefix # Special case is $libdir, which is composed from $exec_prefix
test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
SYSCONFDIR=`eval echo $sysconfdir` SYSCONFDIR=`eval echo $sysconfdir`
LIBDIR=`eval echo $libdir` LIBDIR=`eval echo $libdir`
LIBDIR=`eval echo $LIBDIR`
LOCALSTATEDIR=`eval echo $localstatedir` LOCALSTATEDIR=`eval echo $localstatedir`
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile

View file

@ -42,9 +42,8 @@ RUN apk add --update git make build-base gcc flex bison curl-dev
RUN apk add --update nghttp2 RUN apk add --update nghttp2
# Create a directory to hold source-code, dependencies etc # Create a directory to hold source-code, dependencies etc
RUN mkdir /clixon RUN mkdir -p /clixon/build
RUN mkdir /clixon/build
WORKDIR /clixon WORKDIR /clixon
# Clone cligen # Clone cligen
@ -52,34 +51,34 @@ RUN git clone https://github.com/clicon/cligen.git
# Build cligen # Build cligen
WORKDIR /clixon/cligen WORKDIR /clixon/cligen
RUN ./configure --prefix=/clixon/build RUN ./configure --prefix=/usr/local
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Need to add www user manually # Need to add www user manually
RUN adduser -D -H -G www-data www-data RUN adduser -D -H -G www-data www-data
# Copy Clixon from local dir # Copy Clixon from local dir
RUN mkdir /clixon/clixon RUN mkdir -p /clixon/clixon
WORKDIR /clixon/clixon WORKDIR /clixon/clixon
COPY clixon . COPY clixon .
# Configure, build and install clixon # Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 RUN ./configure --prefix=/usr/local --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
RUN make install-include RUN make DESTDIR=/clixon/build install-include
# Install main example # Install main example
WORKDIR /clixon/clixon/example/main WORKDIR /clixon/clixon/example/main
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Copy startscript # Copy startscript
WORKDIR /clixon WORKDIR /clixon
COPY startsystem.sh startsystem.sh COPY startsystem.sh startsystem.sh
RUN install startsystem.sh /clixon/build/bin/ RUN install startsystem.sh /clixon/build/usr/local/bin/
# #
# Stage 2 # Stage 2
@ -109,7 +108,7 @@ RUN echo "Subsystem netconf /usr/local/bin/clixon_netconf" >> /etc/ssh/sshd_conf
# Create clicon user and group # Create clicon user and group
RUN adduser -D -H clicon RUN adduser -D -H clicon
COPY --from=0 /clixon/build/ /usr/local/ COPY --from=0 /clixon/build/ /
# Overwrite config file since install dirs are wrong # Overwrite config file since install dirs are wrong
COPY example.xml /usr/local/etc/example.xml COPY example.xml /usr/local/etc/example.xml

View file

@ -42,10 +42,8 @@ RUN apk add --update git make build-base gcc flex bison curl-dev
# For netsnmp # For netsnmp
RUN apk add --update net-snmp net-snmp-dev RUN apk add --update net-snmp net-snmp-dev
WORKDIR /usr/local/share
# Checkout standard YANG models for tests (note >1G for full repo) # Checkout standard YANG models for tests (note >1G for full repo)
RUN mkdir yang RUN mkdir -p /usr/local/share/yang
WORKDIR /usr/local/share/yang WORKDIR /usr/local/share/yang
@ -56,12 +54,10 @@ RUN git config core.sparseCheckout true
RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "standard/" >> .git/info/sparse-checkout
RUN echo "experimental/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout
WORKDIR /usr/local/share/yang
RUN git pull origin main RUN git pull origin main
# Create a directory to hold source-code, dependencies etc # Create a directory to hold source-code, dependencies etc
RUN mkdir /clixon RUN mkdir -p /clixon/build
RUN mkdir /clixon/build
WORKDIR /clixon WORKDIR /clixon
# Clone cligen # Clone cligen
@ -69,9 +65,9 @@ RUN git clone https://github.com/clicon/cligen.git
# Build cligen # Build cligen
WORKDIR /clixon/cligen WORKDIR /clixon/cligen
RUN ./configure --prefix=/clixon/build RUN ./configure --prefix=/usr/local
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Copy Clixon from local dir # Copy Clixon from local dir
RUN mkdir /clixon/clixon RUN mkdir /clixon/clixon
@ -79,29 +75,26 @@ WORKDIR /clixon/clixon
COPY clixon . COPY clixon .
# Configure, build and install clixon # Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN ./configure --prefix=/usr/local --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Install utils (for tests) # Install utils (for tests)
WORKDIR /clixon/clixon/util WORKDIR /clixon/clixon/util
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
RUN make
RUN make install
# Copy tests # Copy tests
WORKDIR /clixon/clixon/test WORKDIR /clixon/clixon/test
RUN install -d /clixon/build/bin/test RUN install -d /clixon/build/usr/local/bin/test
RUN install *.sh /clixon/build/bin/test RUN install *.sh /clixon/build/usr/local/bin/test
RUN install *.exp /clixon/build/bin/test RUN install *.exp /clixon/build/usr/local/bin/test
RUN install clixon.png /clixon/build/bin/test RUN install clixon.png /clixon/build/usr/local/bin/test
# Copy startscript # Copy startscript
WORKDIR /clixon WORKDIR /clixon
COPY startsystem.sh startsystem.sh COPY startsystem.sh startsystem.sh
RUN install startsystem.sh /clixon/build/bin/ RUN install startsystem.sh /clixon/build/usr/local/bin/
# Add our generated YANG files # Add our generated YANG files
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
@ -131,7 +124,7 @@ RUN apk add --update sudo curl procps grep make bash expect
# Create clicon user and group # Create clicon user and group
RUN adduser -D -H clicon RUN adduser -D -H clicon
COPY --from=0 /clixon/build/ /usr/local/ COPY --from=0 /clixon/build/ /
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/

View file

@ -41,32 +41,28 @@ RUN apk add --update git make build-base gcc flex bison fcgi-dev curl-dev
# For netsnmp # For netsnmp
RUN apk add --update net-snmp net-snmp-dev RUN apk add --update net-snmp net-snmp-dev
# Checkut models
WORKDIR /usr/local/share/
# Checkout standard YANG models for tests (note >1G for full repo) # Checkout standard YANG models for tests (note >1G for full repo)
RUN mkdir yang RUN mkdir -p /usr/local/share/yang
WORKDIR /usr/local/share/yang WORKDIR /usr/local/share/yang
RUN git config --global init.defaultBranch master RUN git config --global init.defaultBranch master
RUN git init; RUN git init
RUN git remote add -f origin https://github.com/YangModels/yang; RUN git remote add -f origin https://github.com/YangModels/yang
RUN git config core.sparseCheckout true RUN git config core.sparseCheckout true
RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "standard/" >> .git/info/sparse-checkout
RUN echo "experimental/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout
RUN git pull origin main RUN git pull origin main
RUN mkdir /usr/local/share/openconfig RUN mkdir -p /usr/local/share/openconfig
WORKDIR /usr/local/share/openconfig WORKDIR /usr/local/share/openconfig
# Checkut Openconfig models for tests # Checkut Openconfig models for tests
RUN git clone https://github.com/openconfig/public RUN git clone https://github.com/openconfig/public
# Create a directory to hold source-code, dependencies etc # Create a directory to hold source-code, dependencies etc
RUN mkdir /clixon RUN mkdir -p /clixon/build
RUN mkdir /clixon/build
WORKDIR /clixon WORKDIR /clixon
# Clone cligen # Clone cligen
@ -74,12 +70,12 @@ RUN git clone https://github.com/clicon/cligen.git
# Build cligen # Build cligen
WORKDIR /clixon/cligen WORKDIR /clixon/cligen
RUN ./configure --prefix=/clixon/build RUN ./configure --prefix=/usr/local --sysconfdir=/etc
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Copy Clixon from local dir # Copy Clixon from local dir
RUN mkdir /clixon/clixon RUN mkdir -p /clixon/clixon
WORKDIR /clixon/clixon WORKDIR /clixon/clixon
COPY clixon . COPY clixon .
@ -89,27 +85,28 @@ RUN adduser -D -H -G www-data www-data
RUN apk add --update nginx RUN apk add --update nginx
# Configure, build and install clixon # Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN ./configure --prefix=/usr/local --sysconfdir=/etc --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Install utils (for tests) # Install utils (for tests)
WORKDIR /clixon/clixon/util WORKDIR /clixon/clixon/util
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Build and install the clixon example # Build and install the clixon example
WORKDIR /clixon/clixon/example/main WORKDIR /clixon/clixon/example/main
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
RUN mkdir -p /clixon/build/etc
RUN install example.xml /clixon/build/etc/clixon.xml RUN install example.xml /clixon/build/etc/clixon.xml
# Copy tests # Copy tests
WORKDIR /clixon/clixon/test WORKDIR /clixon/clixon/test
RUN install -d /clixon/build/bin/test RUN install -d /clixon/build/usr/local/bin/test
RUN install *.sh /clixon/build/bin/test RUN install *.sh /clixon/build/usr/local/bin/test
RUN install *.exp /clixon/build/bin/test RUN install *.exp /clixon/build/usr/local/bin/test
RUN install clixon.png /clixon/build/bin/test RUN install clixon.png /clixon/build/usr/local/bin/test
RUN install -d /clixon/build/mibs RUN install -d /clixon/build/mibs
RUN install mibs/* /clixon/build/mibs RUN install mibs/* /clixon/build/mibs
@ -117,7 +114,7 @@ RUN install mibs/* /clixon/build/mibs
# Copy startscript # Copy startscript
WORKDIR /clixon WORKDIR /clixon
COPY startsystem_fcgi.sh startsystem.sh COPY startsystem_fcgi.sh startsystem.sh
RUN install startsystem.sh /clixon/build/bin/ RUN install startsystem.sh /clixon/build/usr/local/bin/
# Add our generated YANG files # Add our generated YANG files
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
@ -157,7 +154,7 @@ RUN adduser -D -H clicon
RUN adduser nginx clicon RUN adduser nginx clicon
RUN adduser www-data clicon RUN adduser www-data clicon
COPY --from=0 /clixon/build/ /usr/local/ COPY --from=0 /clixon/build/ /
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/
COPY --from=0 /clixon/build/mibs/* /usr/share/snmp/mibs/ COPY --from=0 /clixon/build/mibs/* /usr/share/snmp/mibs/

View file

@ -44,32 +44,28 @@ RUN apk add --update nghttp2
# For netsnmp # For netsnmp
RUN apk add --update net-snmp net-snmp-dev RUN apk add --update net-snmp net-snmp-dev
# Checkut models
WORKDIR /usr/local/share/
# Checkout standard YANG models for tests (note >1G for full repo) # Checkout standard YANG models for tests (note >1G for full repo)
RUN mkdir yang RUN mkdir -p /usr/local/share/yang
WORKDIR /usr/local/share/yang WORKDIR /usr/local/share/yang
RUN git config --global init.defaultBranch master RUN git config --global init.defaultBranch master
RUN git init; RUN git init
RUN git remote add -f origin https://github.com/YangModels/yang; RUN git remote add -f origin https://github.com/YangModels/yang
RUN git config core.sparseCheckout true RUN git config core.sparseCheckout true
RUN echo "standard/" >> .git/info/sparse-checkout RUN echo "standard/" >> .git/info/sparse-checkout
RUN echo "experimental/" >> .git/info/sparse-checkout RUN echo "experimental/" >> .git/info/sparse-checkout
RUN git pull origin main RUN git pull origin main
RUN mkdir /usr/local/share/openconfig RUN mkdir -p /usr/local/share/openconfig
WORKDIR /usr/local/share/openconfig WORKDIR /usr/local/share/openconfig
# Checkut Openconfig models for tests # Checkut Openconfig models for tests
RUN git clone https://github.com/openconfig/public RUN git clone https://github.com/openconfig/public
# Create a directory to hold source-code, dependencies etc # Create a directory to hold source-code, dependencies etc
RUN mkdir /clixon RUN mkdir -p /clixon/build
RUN mkdir /clixon/build
WORKDIR /clixon WORKDIR /clixon
# Clone cligen # Clone cligen
@ -77,41 +73,42 @@ RUN git clone https://github.com/clicon/cligen.git
# Build cligen # Build cligen
WORKDIR /clixon/cligen WORKDIR /clixon/cligen
RUN ./configure --prefix=/clixon/build RUN ./configure --prefix=/usr/local --sysconfdir=/etc
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Need to add www user manually # Need to add www user manually
RUN adduser -D -H -G www-data www-data RUN adduser -D -H -G www-data www-data
# Copy Clixon from local dir # Copy Clixon from local dir
RUN mkdir /clixon/clixon RUN mkdir -p /clixon/clixon
WORKDIR /clixon/clixon WORKDIR /clixon/clixon
COPY clixon . COPY clixon .
# Configure, build and install clixon # Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/ RUN ./configure --prefix=/usr/local --sysconfdir=/etc --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Install utils (for tests) # Install utils (for tests)
WORKDIR /clixon/clixon/util WORKDIR /clixon/clixon/util
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
# Build and install the clixon example # Build and install the clixon example
WORKDIR /clixon/clixon/example/main WORKDIR /clixon/clixon/example/main
RUN make RUN make
RUN make install RUN make DESTDIR=/clixon/build install
RUN mkdir -p /clixon/build/etc
RUN install example.xml /clixon/build/etc/clixon.xml RUN install example.xml /clixon/build/etc/clixon.xml
# Copy tests # Copy tests
WORKDIR /clixon/clixon/test WORKDIR /clixon/clixon/test
RUN install -d /clixon/build/bin/test RUN install -d /clixon/build/usr/local/bin/test
RUN install *.sh /clixon/build/bin/test RUN install *.sh /clixon/build/usr/local/bin/test
RUN install *.exp /clixon/build/bin/test RUN install *.exp /clixon/build/usr/local/bin/test
RUN install clixon.png /clixon/build/bin/test RUN install clixon.png /clixon/build/usr/local/bin/test
RUN install -d /clixon/build/mibs RUN install -d /clixon/build/mibs
RUN install mibs/* /clixon/build/mibs RUN install mibs/* /clixon/build/mibs
@ -119,7 +116,7 @@ RUN install mibs/* /clixon/build/mibs
# Copy startscript # Copy startscript
WORKDIR /clixon WORKDIR /clixon
COPY startsystem_native.sh startsystem.sh COPY startsystem_native.sh startsystem.sh
RUN install startsystem.sh /clixon/build/bin/ RUN install startsystem.sh /clixon/build/usr/local/bin/
# Add our generated YANG files # Add our generated YANG files
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
@ -161,7 +158,7 @@ EXPOSE 443/tcp
# Create clicon user and group # Create clicon user and group
RUN adduser -D -H clicon RUN adduser -D -H clicon
COPY --from=0 /clixon/build/ /usr/local/ COPY --from=0 /clixon/build/ /
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/ COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
COPY --from=0 /usr/local/share/openconfig/* /usr/local/share/openconfig/ COPY --from=0 /usr/local/share/openconfig/* /usr/local/share/openconfig/
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/ COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/