From 6169d290b8a59621881b8c5b0c772b51ad4fc39c Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 10 Aug 2017 08:25:07 +0200 Subject: [PATCH] Framework: add a migration argument This is for future use, right now it's not supported. --- Mk/plugins.mk | 12 ++++++++---- Templates/models | 4 ++-- Templates/templates | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 Templates/templates diff --git a/Mk/plugins.mk b/Mk/plugins.mk index 4736b80ed..cb303a0b0 100644 --- a/Mk/plugins.mk +++ b/Mk/plugins.mk @@ -129,14 +129,18 @@ scripts-auto: done; \ fi @if [ -d ${.CURDIR}/src/opnsense/mvc/app/models ]; then \ - cat ${TEMPLATESDIR}/models >> ${DESTDIR}/+POST_INSTALL; \ + for FILE in $$(cd ${.CURDIR}/src/opnsense/service/templates && \ + find -s . -mindepth 2 -type d); do \ + cat ${TEMPLATESDIR}/models | \ + sed "s:%%ARG%%:$${FILE#./}:g" >> \ + ${DESTDIR}/+POST_INSTALL; \ + done; \ fi @if [ -d ${.CURDIR}/src/opnsense/service/templates ]; then \ for FILE in $$(cd ${.CURDIR}/src/opnsense/service/templates && \ find -s . -mindepth 2 -type d); do \ - echo "echo -n \"Reloading template $${FILE#./}: \"" >> \ - ${DESTDIR}/+POST_INSTALL; \ - echo "/usr/local/sbin/configctl template reload $${FILE#./}" >> \ + cat ${TEMPLATESDIR}/templates | \ + sed "s:%%ARG%%:$${FILE#./}:g" >> \ ${DESTDIR}/+POST_INSTALL; \ done; \ fi diff --git a/Templates/models b/Templates/models index 0ea75f82d..a33507559 100644 --- a/Templates/models +++ b/Templates/models @@ -1,2 +1,2 @@ -echo "Running migration" -/usr/local/opnsense/mvc/script/run_migrations.php +echo "Migrating %%ARG%%" +/usr/local/opnsense/mvc/script/run_migrations.php %%ARG%% diff --git a/Templates/templates b/Templates/templates new file mode 100644 index 000000000..636ea1374 --- /dev/null +++ b/Templates/templates @@ -0,0 +1,2 @@ +echo -n "Reloading template %%ARG%%: " +/usr/local/sbin/configctl template reload %%ARG%%