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