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:
mount: force
@${.CURDIR}/scripts/version.sh > \
${.CURDIR}/src/opnsense/version/opnsense
/sbin/mount_unionfs ${.CURDIR}/src /usr/local
mount_unionfs ${.CURDIR}/src /usr/local
umount: force
/sbin/umount -f "<above>:${.CURDIR}/src"
umount -f "<above>:${.CURDIR}/src"
CORE_COMMIT!= ${.CURDIR}/scripts/version.sh
CORE_VERSION= ${CORE_COMMIT:C/-.*$//1}
......@@ -144,25 +144,16 @@ scripts: force
${DESTDIR}/+POST_INSTALL
install: force
@${MAKE} -C ${.CURDIR}/lang install DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR}
@mkdir -p ${DESTDIR}/usr/local
@cp -vr ${.CURDIR}/src/* ${DESTDIR}/usr/local
@sed -i '' -e "s/%%CORE_PACKAGESITE%%/${CORE_PACKAGESITE}/g" \
${DESTDIR}/usr/local/etc/pkg/repos/origin.conf.sample
@sed -i '' -e "s/%%CORE_REPOSITORY%%/${CORE_REPOSITORY}/g" \
${DESTDIR}/usr/local/etc/pkg/repos/origin.conf.sample
@${MAKE} -C ${.CURDIR}/lang install DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/src install DESTDIR=${DESTDIR} \
CORE_PACKAGESITE=${CORE_PACKAGESITE} \
CORE_REPOSITORY=${CORE_REPOSITORY}
plist: force
@${MAKE} -C ${.CURDIR}/conrtib plist
@${MAKE} -C ${.CURDIR}/lang plist
@${MAKE} -C ${.CURDIR}/contrib 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
@${MAKE} -C ${.CURDIR}/src plist
lint: force
find ${.CURDIR}/src ${.CURDIR}/lang/dynamic/helpers \
......
......@@ -4,12 +4,27 @@ install:
.for TREE in ${TREES}
@mkdir -p ${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
plist:
.for TREE in ${TREES}
@(cd ${TREE}; find * -type f) | \
xargs -n1 printf "${ROOT}/${TREE}/%s\n"
@(cd ${TREE}; find * -type f) | while read FILE; do \
FILE="$${FILE%%.in}"; PREFIX=""; \
if [ $${FILE%%.sample} != $${FILE} ]; then \
PREFIX="@sample "; \
fi; \
echo "${PREFIX} ${ROOT}/${TREE}/$${FILE}"; \
done
.endfor
.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