public inbox for network@lists.ipfire.org
 help / color / mirror / Atom feed
* Add copy before the vpn security policies
@ 2017-07-19  8:09 Jonatan Schlag
  2017-07-19  8:09 ` [PATCH v4] util: add new function copy Jonatan Schlag
  0 siblings, 1 reply; 2+ messages in thread
From: Jonatan Schlag @ 2017-07-19  8:09 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

just for clarification why I send this patch alone. I think it is easier to get this patch merged before we talk about the vpn security policies. 
Make my branches easier and the emails shorter.
This method works fine and results in an error every time something goes wrong. The message should be enough o encounter what the problem is.

So hopefully this one is ok :-)

Jonatan

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v4] util: add new function copy
  2017-07-19  8:09 Add copy before the vpn security policies Jonatan Schlag
@ 2017-07-19  8:09 ` Jonatan Schlag
  0 siblings, 0 replies; 2+ messages in thread
From: Jonatan Schlag @ 2017-07-19  8:09 UTC (permalink / raw)
  To: network

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/functions/functions.util | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/functions/functions.util b/src/functions/functions.util
index 381208c..8c8f569 100644
--- a/src/functions/functions.util
+++ b/src/functions/functions.util
@@ -752,3 +752,22 @@ hex2dec() {
 dec2hex() {
 	printf "%02x\n" "${1}"
 }
+
+copy() {
+	# This function just copy config files
+	assert [ $# -eq 2 ]
+
+	local src=${1}
+	local dst=${2}
+
+	# Check if ${dst} is a directory
+	if [ -d ${dst} ]; then
+		log ERROR "${dst} is a directory."
+		return ${EXIT_ERROR}
+	fi
+
+	if ! fread "${src}" > "${dst}"; then
+		log ERROR "Could not copy data from ${src} to ${dst}"
+		return ${EXIT_ERROR}
+	fi
+}
-- 
2.6.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-19  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19  8:09 Add copy before the vpn security policies Jonatan Schlag
2017-07-19  8:09 ` [PATCH v4] util: add new function copy Jonatan Schlag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox