]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
do not use `:>` which aborts whole script on error
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 26 May 2013 19:20:46 +0000 (19:20 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sun, 26 May 2013 19:20:46 +0000 (19:20 +0000)
special builtins like `:>` abort whole script on error while `>` doesn't

and that is so by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01

svn-id: @12662

rc.d/init.d/sys-chroots
rc.d/rc.sysinit

index 3a32767890c4f425ef3700bf1a0265619aa37e8c..19ba42fe9e0255e8c703569eebaef7cb470426b9 100755 (executable)
@@ -53,8 +53,8 @@ start() {
                chroot $dir sh -c '
                . /etc/rc.d/init.d/functions
                # Clear mtab
-               :>/etc/mtab
-               [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
+               /etc/mtab
+               [ -f /etc/cryptomtab ] && /etc/cryptomtab
 
                # Remove stale backups
                rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
@@ -78,12 +78,12 @@ start() {
 
                # Clean up utmp/wtmp
                if ! is_no "$NEED_XFILES" ; then
-                       :>/var/run/utmpx
+                       /var/run/utmpx
                        touch /var/log/wtmpx
                        chown root:utmp /var/run/utmpx /var/log/wtmpx
                        chmod 0664 /var/run/utmpx /var/log/wtmpx
                else
-                       :>/var/run/utmp
+                       /var/run/utmp
                        touch /var/log/wtmp
                        chown root:utmp /var/run/utmp /var/log/wtmp
                        chmod 0664 /var/run/utmp /var/log/wtmp
index 92cad0319e1c962b5d3f74f77fcec22684ce9334..e63cbf7dd5475f35615cc41a5db4c37eeb42ecd8 100755 (executable)
@@ -72,7 +72,7 @@ relabel_selinux() {
 
 # Remove duplicate entries from mtab (for vserver guest use only)
 clean_vserver_mtab() {
-       :>/etc/mtab.clean
+       /etc/mtab.clean
        while read device mountpoint line; do
                grep -qs "$mountpoint" /etc/mtab.clean || \
                        echo "$device $mountpoint $line" >> /etc/mtab.clean
@@ -465,8 +465,8 @@ fi
 
 if ! is_yes "$VSERVER"; then
        # Clear mtab
-       :>/etc/mtab
-       [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
+       /etc/mtab
+       [ -f /etc/cryptomtab ] && /etc/cryptomtab
 
        # Enter root, /proc, /sys and other into mtab.
        mount -f / 2> /dev/null
@@ -963,12 +963,12 @@ rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
 {
 # Clean up utmp/wtmp
 if ! is_no "$NEED_XFILES"; then
-       :>/var/run/utmpx
+       /var/run/utmpx
        touch /var/log/wtmpx
        chown root:utmp /var/run/utmpx /var/log/wtmpx
        chmod 0664 /var/run/utmpx /var/log/wtmpx
 else
-       :>/var/run/utmp
+       /var/run/utmp
        touch /var/log/wtmp
        chown root:utmp /var/run/utmp /var/log/wtmp
        chmod 0664 /var/run/utmp /var/log/wtmp
This page took 0.069877 seconds and 4 git commands to generate.