Commit d5cd97a4 authored by Franco Fichtner's avatar Franco Fichtner

pkg: generalise packaging magic; add .in suffix awareness

o Makes live-mounting easier as the package config samples won't
  be clobbered anymore.

o Automatically picks up ".in" files, runs replace and moves them
  to their permanent location.

o Refactored src directory install while at it.
parent fb55c719
...@@ -9,10 +9,10 @@ force: ...@@ -9,10 +9,10 @@ force:
mount: force mount: force
@${.CURDIR}/scripts/version.sh > \ @${.CURDIR}/scripts/version.sh > \
${.CURDIR}/src/opnsense/version/opnsense ${.CURDIR}/src/opnsense/version/opnsense
/sbin/mount_unionfs ${.CURDIR}/src /usr/local mount_unionfs ${.CURDIR}/src /usr/local
umount: force umount: force
/sbin/umount -f "<above>:${.CURDIR}/src" umount -f "<above>:${.CURDIR}/src"
CORE_COMMIT!= ${.CURDIR}/scripts/version.sh CORE_COMMIT!= ${.CURDIR}/scripts/version.sh
CORE_VERSION= ${CORE_COMMIT:C/-.*$//1} CORE_VERSION= ${CORE_COMMIT:C/-.*$//1}
...@@ -144,25 +144,16 @@ scripts: force ...@@ -144,25 +144,16 @@ scripts: force
${DESTDIR}/+POST_INSTALL ${DESTDIR}/+POST_INSTALL
install: force install: force
@${MAKE} -C ${.CURDIR}/lang install DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR} @${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR}
@mkdir -p ${DESTDIR}/usr/local @${MAKE} -C ${.CURDIR}/lang install DESTDIR=${DESTDIR}
@cp -vr ${.CURDIR}/src/* ${DESTDIR}/usr/local @${MAKE} -C ${.CURDIR}/src install DESTDIR=${DESTDIR} \
@sed -i '' -e "s/%%CORE_PACKAGESITE%%/${CORE_PACKAGESITE}/g" \ CORE_PACKAGESITE=${CORE_PACKAGESITE} \
${DESTDIR}/usr/local/etc/pkg/repos/origin.conf.sample CORE_REPOSITORY=${CORE_REPOSITORY}
@sed -i '' -e "s/%%CORE_REPOSITORY%%/${CORE_REPOSITORY}/g" \
${DESTDIR}/usr/local/etc/pkg/repos/origin.conf.sample
plist: force plist: force
@${MAKE} -C ${.CURDIR}/conrtib plist
@${MAKE} -C ${.CURDIR}/lang plist @${MAKE} -C ${.CURDIR}/lang plist
@${MAKE} -C ${.CURDIR}/contrib plist @${MAKE} -C ${.CURDIR}/src plist
@(cd ${.CURDIR}/src; find * -type f) | while read FILE; do \
if [ $${FILE%%.sample} != $${FILE} ]; then \
echo "@sample /usr/local/$${FILE}"; \
else \
echo "/usr/local/$${FILE}"; \
fi; \
done
lint: force lint: force
find ${.CURDIR}/src ${.CURDIR}/lang/dynamic/helpers \ find ${.CURDIR}/src ${.CURDIR}/lang/dynamic/helpers \
......
...@@ -4,12 +4,27 @@ install: ...@@ -4,12 +4,27 @@ install:
.for TREE in ${TREES} .for TREE in ${TREES}
@mkdir -p ${DESTDIR}${ROOT} @mkdir -p ${DESTDIR}${ROOT}
@cp -vr ${TREE} ${DESTDIR}${ROOT} @cp -vr ${TREE} ${DESTDIR}${ROOT}
@(cd ${TREE}; find * -type f) | while read FILE; do \
if [ $${FILE%%.in} != $${FILE} ]; then \
sed -i '' \
-e "s=%%CORE_PACKAGESITE%%=${CORE_PACKAGESITE}=g" \
-e "s=%%CORE_REPOSITORY%%=${CORE_REPOSITORY}=g" \
${DESTDIR}${ROOT}/${TREE}/$${FILE}; \
mv -v ${DESTDIR}${ROOT}/${TREE}/$${FILE} \
${DESTDIR}${ROOT}/${TREE}/$${FILE%%.in}; \
fi \
done
.endfor .endfor
plist: plist:
.for TREE in ${TREES} .for TREE in ${TREES}
@(cd ${TREE}; find * -type f) | \ @(cd ${TREE}; find * -type f) | while read FILE; do \
xargs -n1 printf "${ROOT}/${TREE}/%s\n" FILE="$${FILE%%.in}"; PREFIX=""; \
if [ $${FILE%%.sample} != $${FILE} ]; then \
PREFIX="@sample "; \
fi; \
echo "${PREFIX} ${ROOT}/${TREE}/$${FILE}"; \
done
.endfor .endfor
.PHONY: install plist .PHONY: install plist
ROOT= /usr/local
TREES= captiveportal etc opnsense pkg sbin www
.include "../Mk/tree.mk"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment