Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
83b5aae6
Commit
83b5aae6
authored
Mar 02, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: second half of previous
parent
72e46245
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
4 deletions
+70
-4
sample.ucl
Keywords/sample.ucl
+61
-0
tree.mk
Mk/tree.mk
+9
-4
No files found.
Keywords/sample.ucl
0 → 100644
View file @
83b5aae6
# $FreeBSD$
#
# MAINTAINER: portmgr@FreeBSD.org
#
# @sample etc/somefile.conf.sample
# or
# @sample file1 file2
#
# Where file1 is considered as a sample file and file2 the target file
#
# This will install the somefile.conf.sample and automatically copy to
# somefile.conf if it doesn't exist. On deinstall it will remove the
# somefile.conf if it still matches the sample, otherwise it is
# kept.
#
# This replaces the old pattern:
# @unexec if cmp -s %D/etc/pkgtools.conf %D/etc/pkgtools.conf.sample; then rm -f %D/etc/pkgtools.conf; fi
# etc/pkgtools.conf.sample
# @exec [ -f %B/pkgtools.conf ] || cp %B/%f %B/pkgtools.conf
actions: [file(1)]
arguments: true
post-install: <<EOD
case "%1" in
/*) sample_file="%1" ;;
*) sample_file="%D/%1" ;;
esac
target_file="${sample_file%.sample}"
set -- %@
if [ $# -eq 2 ]; then
target_file=${2}
fi
case "${target_file}" in
/*) target_file="${target_file}" ;;
*) target_file="%D/${target_file}" ;;
esac
if ! [ -f "${target_file}" ]; then
/bin/cp -p "${sample_file}" "${target_file}"
fi
EOD
pre-deinstall: <<EOD
case "%1" in
/*) sample_file="%1" ;;
*) sample_file="%D/%1" ;;
esac
target_file="${sample_file%.sample}"
set -- %@
if [ $# -eq 2 ]; then
set -- %@
target_file=${2}
fi
case "${target_file}" in
/*) target_file="${target_file}" ;;
*) target_file="%D/${target_file}" ;;
esac
if cmp -s "${target_file}" "${sample_file}"; then
rm -f "${target_file}"
else
echo "You may need to manually remove ${target_file} if it is no longer needed."
fi
EOD
Mk/tree.mk
View file @
83b5aae6
# Copyright (c) 2015-201
6
Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-201
7
Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
...
...
@@ -69,9 +69,14 @@ install-${TARGET}: force
mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.sample}"; \
fi; \
if [ -n "${NO_SAMPLE}" -a "$${FILE%%.shadow}" != "$${FILE}" ]; then \
mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.shadow}"; \
if [ "$${FILE%%.shadow}" != "$${FILE}" ]; then \
if [ -n "${NO_SAMPLE}" ]; then \
mv -v "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.shadow}"; \
else \
mv "${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}/${TREE}/$${FILE%%.shadow}.sample"; \
fi; \
fi; \
done
.endfor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment