summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-11-10 15:40:53 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:28 +0100
commit889489c8ce3339ca3b6cab45ec58e73cca40a51a (patch)
treede2933b3f24f5168728a46565eb662c38195cf37
parent7fc3e5c0e408a206184fddf6cda1ffc8831078bd (diff)
downloadvyos-live-build-889489c8ce3339ca3b6cab45ec58e73cca40a51a.tar.gz
vyos-live-build-889489c8ce3339ca3b6cab45ec58e73cca40a51a.zip
Using shell redirection to truncate rather than additional commands/forks/files, thanks to Justin Pryzby <jpryzby@quoininc.com>.
-rwxr-xr-xfunctions/aliases.sh18
-rwxr-xr-xhelpers/lh_chroot_hosts2
-rwxr-xr-xhelpers/lh_chroot_resolv2
-rwxr-xr-xhooks/mini2
-rwxr-xr-xhooks/minimal2
5 files changed, 22 insertions, 4 deletions
diff --git a/functions/aliases.sh b/functions/aliases.sh
new file mode 100755
index 000000000..04efc24a7
--- /dev/null
+++ b/functions/aliases.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# aliases.sh - internal shell aliases
+# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
+#
+# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+# This is free software, and you are welcome to redistribute it
+# under certain conditions; see COPYING for details.
+
+set -e
+
+Truncate ()
+{
+ for FILE in ${@}
+ do
+ : > ${FILE}
+ done
+}
diff --git a/helpers/lh_chroot_hosts b/helpers/lh_chroot_hosts
index 848038369..6a91831ed 100755
--- a/helpers/lh_chroot_hosts
+++ b/helpers/lh_chroot_hosts
@@ -89,7 +89,7 @@ EOF
else
# Blank out hosts file, don't remove in case
# its a symlink, as in the case of exposedroot mode
- cat /dev/null > chroot/etc/hosts
+ Truncate chroot/etc/hosts
fi
# Removing stage file
diff --git a/helpers/lh_chroot_resolv b/helpers/lh_chroot_resolv
index eeeead226..bc53c6847 100755
--- a/helpers/lh_chroot_resolv
+++ b/helpers/lh_chroot_resolv
@@ -80,7 +80,7 @@ case "${1}" in
mv chroot/etc/resolv.conf.orig chroot/etc/resolv.conf
else
# Truncating resolv file
- cat < /dev/null > chroot/etc/resolv.conf
+ Truncate chroot/etc/resolv.conf
fi
# Removing stage file
diff --git a/hooks/mini b/hooks/mini
index 491091463..c33186e10 100755
--- a/hooks/mini
+++ b/hooks/mini
@@ -40,5 +40,5 @@ mkdir -p /var/lib/apt/lists/partial
# Truncating logs
for FILE in $(find /var/log/ -type f)
do
- cat < /dev/null > $FILE
+ : > ${FILE}
done
diff --git a/hooks/minimal b/hooks/minimal
index 3886d9a5f..ff57deb2d 100755
--- a/hooks/minimal
+++ b/hooks/minimal
@@ -32,5 +32,5 @@ mkdir -p /var/lib/apt/lists/partial
# Truncating logs
for FILE in $(find /var/log/ -type f)
do
- cat < /dev/null > $FILE
+ : > ${FILE}
done