Using shell redirection to truncate rather than additional commands/forks/files, thanks to Justin Pryzby <jpryzby@quoininc.com>.

This commit is contained in:
Daniel Baumann 2007-11-10 15:40:53 +01:00
parent 7cacae2d94
commit 51cfe60fc6
5 changed files with 22 additions and 4 deletions

18
functions/aliases.sh Executable file
View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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