From 55db8dab0f19c5a9e882957087571f650608cfec Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 20 Apr 2015 12:11:33 +0200 Subject: [PATCH] pkg: do not overwrite default config.xml anymore; fixes #145 Fixes spurious overwrite of a standard config, but also doesn't update the standards anymore in a running installation. Install media is unaffected from this change. Users that have had their standard config overwritten need to rewrite the file accordingly: /usr/local/etc/config.xml It also enables users to use their own sample configs on a running installation from now on. Might add a knob in the GUI to do e.g. `use this config as the factory reset configuration'. :) While there, move the pkg-related Makefile glue into its own file in the subdirectory for clarity. --- Makefile | 16 ++-------------- pkg/Makefile | 19 +++++++++++++++++++ src/etc/config.xml => pkg/config.xml.sample | 0 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 pkg/Makefile rename src/etc/config.xml => pkg/config.xml.sample (100%) diff --git a/Makefile b/Makefile index fe0228ab6..725c4a299 100644 --- a/Makefile +++ b/Makefile @@ -9,26 +9,14 @@ umount: /sbin/umount -f ":${.CURDIR}/src" install: - # hardcode package meta files to catch mishaps - @cp ${.CURDIR}/pkg/+PRE_DEINSTALL ${DESTDIR} - @cp ${.CURDIR}/pkg/+POST_INSTALL ${DESTDIR} - @cp ${.CURDIR}/pkg/+MANIFEST ${DESTDIR} + # invoke pkg(8) bootstraping + @make -C ${.CURDIR}/pkg install # move all sources to their destination @mkdir -p ${DESTDIR}/usr/local @cp -r ${.CURDIR}/src/* ${DESTDIR}/usr/local # disable warnings for production systems @sed -i '' -e 's/E_STRICT/E_STRICT | E_WARNING/g' \ ${DESTDIR}/usr/local/etc/rc.php_ini_setup - # bootstrap pkg(8) files that are not in sources - @mkdir -p ${DESTDIR}/usr/local/etc/pkg/repos - @cp ${.CURDIR}/pkg/OPNsense.conf ${DESTDIR}/usr/local/etc/pkg/repos - @echo /usr/local/etc/pkg/repos/OPNsense.conf - @cp ${.CURDIR}/pkg/pkg.conf ${DESTDIR}/usr/local/etc - @echo /usr/local/etc/pkg.conf - @mkdir -p ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted - @cp ${.CURDIR}/pkg/trusted/pkg.opnsense.org.20150402 \ - ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted - @echo /usr/local/etc/pkg/fingerprints/OPNsense/trusted/pkg.opnsense.org.20150402 # finally pretty-print a list of files present @(cd ${.CURDIR}/src; find * -type f) | \ xargs -n1 printf "/usr/local/%s\n" diff --git a/pkg/Makefile b/pkg/Makefile new file mode 100644 index 000000000..45116a606 --- /dev/null +++ b/pkg/Makefile @@ -0,0 +1,19 @@ +all: + +install: + @cp ${.CURDIR}/+PRE_DEINSTALL ${DESTDIR} + @cp ${.CURDIR}/+POST_INSTALL ${DESTDIR} + @cp ${.CURDIR}/+MANIFEST ${DESTDIR} + @mkdir -p ${DESTDIR}/usr/local/etc/pkg/repos + @cp ${.CURDIR}/OPNsense.conf ${DESTDIR}/usr/local/etc/pkg/repos + @echo /usr/local/etc/pkg/repos/OPNsense.conf + @cp ${.CURDIR}/pkg.conf ${DESTDIR}/usr/local/etc + @echo /usr/local/etc/pkg.conf + @cp ${.CURDIR}/config.xml.sample ${DESTDIR}/usr/local/etc + @echo "@sample /usr/local/etc/config.xml.sample" + @mkdir -p ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted + @cp ${.CURDIR}/trusted/pkg.opnsense.org.20150402 \ + ${DESTDIR}/usr/local/etc/pkg/fingerprints/OPNsense/trusted + @echo /usr/local/etc/pkg/fingerprints/OPNsense/trusted/pkg.opnsense.org.20150402 + +.PHONY: install diff --git a/src/etc/config.xml b/pkg/config.xml.sample similarity index 100% rename from src/etc/config.xml rename to pkg/config.xml.sample