Fixed DESTDIR make install/uninstall and break immediately on errors
This commit is contained in:
parent
496754f5c5
commit
96a7ec86f0
16 changed files with 115 additions and 39 deletions
|
|
@ -42,6 +42,7 @@ plugin. The example application shows how.
|
||||||
* Clixon can now be compiled and run on Apple Darwin. Thanks SUNET.
|
* Clixon can now be compiled and run on Apple Darwin. Thanks SUNET.
|
||||||
|
|
||||||
### Minor changes:
|
### Minor changes:
|
||||||
|
* Fixed DESTDIR make install/uninstall and break immediately on errors
|
||||||
* Disabled key-value datastore. Enable with --with-keyvalue
|
* Disabled key-value datastore. Enable with --with-keyvalue
|
||||||
* Removed mandatory requirements for BACKEND, NETCONF, RESTCONF and CLI dirs.
|
* Removed mandatory requirements for BACKEND, NETCONF, RESTCONF and CLI dirs.
|
||||||
|
|
||||||
|
|
|
||||||
14
Makefile.in
14
Makefile.in
|
|
@ -63,7 +63,7 @@ $(SUBDIRS):
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
for i in $(SUBDIRS) doc example docker; \
|
for i in $(SUBDIRS) doc example docker; \
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) depend); done
|
do (cd $$i && $(MAKE) $(MFLAGS) depend); done
|
||||||
|
|
||||||
# template clixon.conf file
|
# template clixon.conf file
|
||||||
clixon.conf.cpp: clixon.conf.cpp.cpp
|
clixon.conf.cpp: clixon.conf.cpp.cpp
|
||||||
|
|
@ -73,23 +73,23 @@ clixon.mk: clixon.mk.cpp
|
||||||
$(CPP) -P -traditional-cpp -x assembler-with-cpp -Dprefix=$(prefix) -Dlocalstatedir=$(localstatedir) -Dsysconfdir=$(sysconfdir) -Ddatadir=$(datadir) -Dlibdir=$(libdir) $< > $@
|
$(CPP) -P -traditional-cpp -x assembler-with-cpp -Dprefix=$(prefix) -Dlocalstatedir=$(localstatedir) -Dsysconfdir=$(sysconfdir) -Ddatadir=$(datadir) -Dlibdir=$(libdir) $< > $@
|
||||||
|
|
||||||
install: clixon.conf.cpp clixon.mk
|
install: clixon.conf.cpp clixon.mk
|
||||||
|
install -d -m 755 $(DESTDIR)$(datadir)/clixon
|
||||||
install -m 755 clixon.conf.cpp $(DESTDIR)$(datadir)/clixon
|
install -m 755 clixon.conf.cpp $(DESTDIR)$(datadir)/clixon
|
||||||
install -m 755 clixon.mk $(DESTDIR)$(datadir)/clixon
|
install -m 755 clixon.mk $(DESTDIR)$(datadir)/clixon
|
||||||
for i in $(SUBDIRS) doc; \
|
for i in $(SUBDIRS) doc; \
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) $@); done; \
|
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done; \
|
||||||
install -d -m 755 $(DESTDIR)$(datadir)/clixon
|
|
||||||
echo "Install for compilation by: make install-include"
|
echo "Install for compilation by: make install-include"
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
for i in $(SUBDIRS) doc; \
|
for i in $(SUBDIRS) doc; \
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) $@); done; \
|
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done; \
|
||||||
echo "To install example app: cd example; make; make install"
|
echo "To install example app: cd example; make; make install"
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in $(SUBDIRS) doc example docker; \
|
for i in $(SUBDIRS) doc example docker; \
|
||||||
do (cd $$i && $(MAKE) $(MFLAGS) $@); done;
|
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done;
|
||||||
rm -f $(datadir)/clixon/clixon.conf.cpp
|
rm -f $(DESTDIR)$(datadir)/clixon/clixon.conf.cpp
|
||||||
rm -f $(datadir)/clixon/clixon.mk
|
rm -f $(DESTDIR)$(datadir)/clixon/clixon.mk
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
cd $@; $(MAKE) $(MFLAGS) $@
|
cd $@; $(MAKE) $(MFLAGS) $@
|
||||||
|
|
|
||||||
|
|
@ -61,15 +61,15 @@ $(SUBDIRS):
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i ; $(MAKE) $(MFLAGS) $@); done;
|
do (cd $$i && $(MAKE) $(MFLAGS) $@||exit 1); done;
|
||||||
|
|
||||||
install:
|
install:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,9 @@ install-lib: $(MYLIB)
|
||||||
install -d $(DESTDIR)$(libdir)/clixon/plugins/backend
|
install -d $(DESTDIR)$(libdir)/clixon/plugins/backend
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(sbindir)/$(APPL)
|
rm -f $(DESTDIR)$(sbindir)/$(APPL)
|
||||||
rm -f $(libdir)/$(MYLIB)
|
rm -f $(DESTDIR)$(libdir)/$(MYLIBLINK)*
|
||||||
rm -f $(includedir)/clixon/*
|
rm -f $(DESTDIR)$(includedir)/clixon/*
|
||||||
|
|
||||||
install-include: clixon_backend.h clixon_backend_handle.h clixon_backend_transaction.h
|
install-include: clixon_backend.h clixon_backend_handle.h clixon_backend_transaction.h
|
||||||
install -d $(DESTDIR)$(includedir)/clixon
|
install -d $(DESTDIR)$(includedir)/clixon
|
||||||
|
|
|
||||||
|
|
@ -824,7 +824,7 @@ main(int argc, char **argv)
|
||||||
if (yang_spec_main(h, stdout, printspec) < 0)
|
if (yang_spec_main(h, stdout, printspec) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Set options: database dir aqnd yangspec (could be hidden in connect?)*/
|
/* Set options: database dir and yangspec (could be hidden in connect?)*/
|
||||||
if (xmldb_setopt(h, "dbdir", clicon_xmldb_dir(h)) < 0)
|
if (xmldb_setopt(h, "dbdir", clicon_xmldb_dir(h)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xmldb_setopt(h, "yangspec", clicon_dbspec_yang(h)) < 0)
|
if (xmldb_setopt(h, "yangspec", clicon_dbspec_yang(h)) < 0)
|
||||||
|
|
|
||||||
|
|
@ -108,9 +108,9 @@ install-include: clixon_cli.h clixon_cli_api.h
|
||||||
install -m 644 $^ $(DESTDIR)$(includedir)/clixon
|
install -m 644 $^ $(DESTDIR)$(includedir)/clixon
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(bindir)/$(APPL)
|
rm -f $(DESTDIR)$(bindir)/$(APPL)
|
||||||
rm -f $(libdir)/$(MYLIB)
|
rm -f $(DESTDIR)$(libdir)/$(MYLIBLINK)*
|
||||||
rm -f $(includedir)/clixon/*
|
rm -f $(DESTDIR)$(includedir)/clixon/*
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,9 @@ install-include: clixon_netconf.h
|
||||||
install -m 644 $^ $(DESTDIR)$(includedir)/clixon
|
install -m 644 $^ $(DESTDIR)$(includedir)/clixon
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(bindir)/$(APPL)
|
rm -f $(DESTDIR)$(bindir)/$(APPL)
|
||||||
rm -f $(libdir)/$(MYLIB)
|
rm -f $(DESTDIR)$(libdir)/$(MYLIBLINK)*
|
||||||
rm -f $(includedir)/clixon/*
|
rm -f $(DESTDIR)$(includedir)/clixon/*
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ install: $(APPL)
|
||||||
install-include:
|
install-include:
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(wwwdir)/$(APPL)
|
rm -f $(DESTDIR)$(wwwdir)/$(APPL)
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
|
||||||
|
|
@ -101,18 +101,18 @@ $(SUBDIRS):
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i ; $(MAKE) $(MFLAGS) $@); done;
|
do (cd $$i ; $(MAKE) $(MFLAGS) $@)||exit 1; done;
|
||||||
|
|
||||||
install: $(APPL)
|
install: $(APPL)
|
||||||
install -d $(DESTDIR)$(bindir)
|
install -d $(DESTDIR)$(bindir)
|
||||||
install $(APPL) $(DESTDIR)$(bindir)
|
install $(APPL) $(DESTDIR)$(bindir)
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(bindir)/$(APPL)
|
rm -f $(DESTDIR)$(bindir)/$(APPL)
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.core $(APPL) $(APPOBJ)
|
rm -f *.core $(APPL) $(APPOBJ)
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@ install: clixonrc
|
||||||
install -m 755 clixonrc $(DESTDIR)$(sysconfdir)
|
install -m 755 clixonrc $(DESTDIR)$(sysconfdir)
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/clixonrc
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,20 +55,20 @@ $(SUBDIRS):
|
||||||
(cd $@; $(MAKE) $(MFLAGS) all)
|
(cd $@; $(MAKE) $(MFLAGS) all)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i && $(MAKE) $(MFLAGS) $@); done
|
||||||
|
|
||||||
install-include:
|
install-include:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done; \
|
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done; \
|
||||||
(cd clixon; $(MAKE) $(MFLAGS) $@)
|
(cd clixon; $(MAKE) $(MFLAGS) $@)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||||
|
|
||||||
config.status: configure
|
config.status: configure
|
||||||
$(SHELL) config.status --recheck
|
$(SHELL) config.status --recheck
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for i in $(SUBDIRS); \
|
for i in $(SUBDIRS); \
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ install-include:
|
||||||
install -m 644 *.h $(DESTDIR)$(includedir)/clixon
|
install -m 644 *.h $(DESTDIR)$(includedir)/clixon
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(includedir)/clixon
|
rm -rf $(DESTDIR)$(includedir)/clixon
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ install-lib: $(MYLIB)
|
||||||
ln -sf $(MYLIBSO) $(DESTDIR)$(libdir)/$(MYLIBLINK) # -l:libclixon.so
|
ln -sf $(MYLIBSO) $(DESTDIR)$(libdir)/$(MYLIBLINK) # -l:libclixon.so
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(libdir)/$(MYLIB)
|
rm -f $(DESTDIR)$(libdir)/$(MYLIBLINK)*
|
||||||
|
|
||||||
TAGS:
|
TAGS:
|
||||||
find . -name '*.[chyl]' -print | etags -
|
find . -name '*.[chyl]' -print | etags -
|
||||||
|
|
|
||||||
10
test/lib.sh
10
test/lib.sh
|
|
@ -1,13 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
testnr=0
|
testnr=0
|
||||||
testnname=
|
testname=
|
||||||
clixon_cf=/usr/local/etc/routing.xml
|
clixon_cf=/usr/local/etc/routing.xml
|
||||||
# error and exit, arg is optional extra errmsg
|
# error and exit, arg is optional extra errmsg
|
||||||
err(){
|
err(){
|
||||||
echo "Error in Test$testnr [$testname]:"
|
echo "Error in Test$testnr [$testname]:"
|
||||||
echo "Expected: $1"
|
if [ $# -gt 0 ]; then
|
||||||
echo "Received: $2"
|
echo "Expected: $1"
|
||||||
|
fi
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
echo "Received: $2"
|
||||||
|
fi
|
||||||
exit $testnr
|
exit $testnr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
67
test/test_install.sh
Executable file
67
test/test_install.sh
Executable file
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Install test
|
||||||
|
|
||||||
|
# include err() and new() functions
|
||||||
|
. ./lib.sh
|
||||||
|
|
||||||
|
DIR=/tmp/clixoninstall
|
||||||
|
|
||||||
|
new "Set up installdir $DIR"
|
||||||
|
rm -rf $DIR
|
||||||
|
mkdir $DIR
|
||||||
|
|
||||||
|
new "Make DESTDIR install"
|
||||||
|
(cd ..; make DESTDIR=$DIR install)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
|
||||||
|
new "Check installed files"
|
||||||
|
if [ ! -d $DIR/usr ]; then
|
||||||
|
err $DIR/usr
|
||||||
|
fi
|
||||||
|
if [ ! -d $DIR/www-data ]; then
|
||||||
|
err $DIR/www-data
|
||||||
|
fi
|
||||||
|
if [ ! -f $DIR/usr/local/share/clixon/clixon.mk ]; then
|
||||||
|
err $DIR/usr/local/share/clixon/clixon.mk
|
||||||
|
fi
|
||||||
|
if [ ! -f $DIR/usr/local/share/clixon/clixon.conf.cpp ]; then
|
||||||
|
err $DIR/usr/local/share/clixon/clixon.conf.cpp
|
||||||
|
fi
|
||||||
|
if [ ! -f $DIR/usr/local/share/clixon/clixon-config* ]; then
|
||||||
|
err $DIR/usr/local/share/clixon/clixon-config*
|
||||||
|
fi
|
||||||
|
if [ ! -h $DIR/usr/local/lib/libclixon.so ]; then
|
||||||
|
err $DIR/usr/local/lib/libclixon.so
|
||||||
|
fi
|
||||||
|
if [ ! -h $DIR/usr/local/lib/libclixon_backend.so ]; then
|
||||||
|
err $DIR/usr/local/lib/libclixon_backend.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
new "Make DESTDIR install include"
|
||||||
|
(cd ..; make DESTDIR=$DIR install-include)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
new "Check installed includes"
|
||||||
|
if [ ! -f $DIR/usr/local/include/clixon/clixon.h ]; then
|
||||||
|
err $DIR/usr/local/include/clixon/clixon.h
|
||||||
|
fi
|
||||||
|
new "Make DESTDIR uninstall"
|
||||||
|
(cd ..; make DESTDIR=$DIR uninstall)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
|
||||||
|
new "Check remaining files"
|
||||||
|
f=$(find $DIR -type f)
|
||||||
|
if [ -n "$f" ]; then
|
||||||
|
err "$f"
|
||||||
|
fi
|
||||||
|
|
||||||
|
new "Check remaining symlinks"
|
||||||
|
l=$(find $DIR -type l)
|
||||||
|
if [ -n "$l" ]; then
|
||||||
|
err "$l"
|
||||||
|
fi
|
||||||
|
|
@ -54,7 +54,9 @@ distclean: clean
|
||||||
rm -f Makefile *~ .depend
|
rm -f Makefile *~ .depend
|
||||||
|
|
||||||
install: $(YANGSPECS)
|
install: $(YANGSPECS)
|
||||||
install -d $(DESTDIR)/yang
|
echo $(DESTDIR)$(datarootdir)/clixon/clixon.mk
|
||||||
|
echo $(DESTDIR)$(clixon_DATADIR)
|
||||||
|
install -d $(DESTDIR)$(clixon_DATADIR)
|
||||||
install $(YANGSPECS) $(DESTDIR)$(clixon_DATADIR)
|
install $(YANGSPECS) $(DESTDIR)$(clixon_DATADIR)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue