summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2020-09-09 17:16:27 +0200
committerUlrich Müller <ulm@gentoo.org>2020-09-12 18:02:58 +0200
commit80f9e1b4058fddc6df645f36c06367a676a11cbe (patch)
tree00c198a310f848b2c20de64b29ea82fc9ff05b0c /eclass/edos2unix.eclass
parenteutils.eclass: Specify supported EAPIs. (diff)
downloadgentoo-80f9e1b4058fddc6df645f36c06367a676a11cbe.tar.gz
gentoo-80f9e1b4058fddc6df645f36c06367a676a11cbe.tar.bz2
gentoo-80f9e1b4058fddc6df645f36c06367a676a11cbe.zip
edos2unix.eclass: New eclass, split off from eutils.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass/edos2unix.eclass')
-rw-r--r--eclass/edos2unix.eclass21
1 files changed, 21 insertions, 0 deletions
diff --git a/eclass/edos2unix.eclass b/eclass/edos2unix.eclass
new file mode 100644
index 00000000000..8b774844cb8
--- /dev/null
+++ b/eclass/edos2unix.eclass
@@ -0,0 +1,21 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: edos2unix.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: convert files from DOS CRLF to UNIX LF line endings
+
+# @FUNCTION: edos2unix
+# @USAGE: <file> [more files ...]
+# @DESCRIPTION:
+# A handy replacement for dos2unix, recode, fixdos, etc... This allows
+# you to remove all of these text utilities from DEPEND variables
+# because this is a script based solution. Just give it a list of files
+# to convert and they will all be changed from the DOS CRLF format to
+# the UNIX LF format.
+
+edos2unix() {
+ [[ $# -eq 0 ]] && return 0
+ sed -i 's/\r$//' -- "$@" || die
+}