]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Use "printf" instead of "echo".
authorAlexander Barton <alex@barton.de>
Wed, 26 Nov 2008 19:12:25 +0000 (20:12 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 26 Nov 2008 19:12:25 +0000 (20:12 +0100)
install.sh

index c02d344ff1f66e0bacae4c9197303d4872677f41..372606925ba93e25e4582420807f656f5e638678 100755 (executable)
@@ -7,41 +7,41 @@
 NAME=`basename "$0"`
 
 Msg() {
-       /bin/echo -e "$*"
+       printf -- "$*"
 }
 
 Abort() {
-       Msg "- ERROR!"
+       Msg "- ERROR!\n"
        exit 1
 }
 
 Copy_File() {
        src="$1"; dst="$2"; own="$3"; perm="$4"
-       Msg "     $src -> $dst\c"
+       Msg "     $src -> $dst"
        if [ -e "$dst" ]; then
                grep "alex@barton.de" "$dst" >/dev/null 2>&1
                if [ $? -ne 0 ]; then
-                       Msg " (B)\c"
+                       Msg " (B)"
                        cp "$dst" "$dst.bak"
                fi
        fi
-       Msg " \c"
+       Msg " "
        cp "$src" "$dst" || Abort
        [ -n "$own" ] && chown "$own" "$dst" || Abort
        [ -n "$perm" ] && chmod "$perm" "$dst" || Abort
-       Msg "- OK."
+       Msg "- OK.\n"
 }
 
 [ -n "$UID" ] || UID=`id -u`
 export UID
 
-Msg "Running $NAME (uid=$UID) ..."
+Msg "Running $NAME (uid=$UID) ...\n"
 
 user=`basename "$HOME"`
 
 if [ "$UID" = "0" ]; then
-       Msg "Starting system configuration:"
-       Msg " - bash shell:"
+       Msg "Starting system configuration:\n"
+       Msg " - bash shell:\n"
        if [ -e /etc/bash.bashrc ]; then
                Copy_File sys/bashrc /etc/bash.bashrc root 644
        else
@@ -49,23 +49,23 @@ if [ "$UID" = "0" ]; then
        fi
        Copy_File sys/profile /etc/profile root 644
 else
-       Msg "Not running with root privileges - system configuration SKIPPED."
+       Msg "Not running with root privileges - system configuration SKIPPED.\n"
        grep "alex@barton.de" /etc/profile >/dev/null 2>&1
        if [ $? -ne 0 ]; then
-               Msg "Installing system files to $HOME/.etc/ ..."
+               Msg "Installing system files to $HOME/.etc/ ...\n"
                mkdir -p "$HOME/.etc"
                Copy_File sys/bashrc $HOME/.etc/bashrc "$user" 600
                Copy_File sys/profile $HOME/.etc/profile "$user" 600
        else
-               Msg "System configuration seems to be modified: not installing locally."
+               Msg "System configuration seems to be modified: not installing locally.\n"
        fi
 fi
 
 touch "$HOME/.test.$$" >/dev/null 2>&1
 if [ $? -eq 0 ]; then
        rm -f "$HOME/.test.$$"
-       Msg "Starting user configuration ($user in $HOME):"
-       Msg " - bash shell:"
+       Msg "Starting user configuration ($user in $HOME):\n"
+       Msg " - bash shell:\n"
        if [ -e "$HOME/.profile" ]; then
                Copy_File user/bash_profile "$HOME/.profile" "$user" 600
        else
@@ -74,9 +74,9 @@ if [ $? -eq 0 ]; then
        Copy_File user/bashrc "$HOME/.bashrc" "$user" 600
        Copy_File user/bash_logout "$HOME/.bash_logout" "$user" 600
 else
-       Msg "Can't write to user home directory - user configuration SKIPPED."
+       Msg "Can't write to user home directory - user configuration SKIPPED.\n"
 fi
 
-Msg "$NAME: Done."
+Msg "$NAME: Done.\n"
 
 # -eof-