]> arthur.barton.de Git - ConfigScripts.git/blobdiff - install.sh
Install system files locally, when already present there
[ConfigScripts.git] / install.sh
index 877058beb19d507b8763729c5063d86afbcb9a23..f42c52e666b71b4f28578d94b84dbb45e7409a2f 100755 (executable)
@@ -26,8 +26,8 @@ Copy_File() {
                fi
        fi
        Msg " "
-       cp "$src" "$dst" || Abort
-       if [ -n "$own" -a "$own" != "$USER" ]; then
+       cp --preserve=timestamps "$src" "$dst" || Abort
+       if [ -n "$own" ]; then
                chown "$own" "$dst" || Abort
        fi
        if [ -n "$perm" ]; then
@@ -49,7 +49,7 @@ Config_System() {
        else
                Msg "Not running with root privileges - system configuration SKIPPED.\n"
                grep "alex@barton.de" /etc/profile >/dev/null 2>&1
-               if [ $? -ne 0 -o -n "$I_local" ]; then
+               if [ $? -ne 0 -o -n "$I_local" -o -d $HOME/.etc ]; then
                        Msg "Installing system files to $HOME/.etc/ ...\n"
                        mkdir -p "$HOME/.etc"
                        Copy_File sys/bashrc $HOME/.etc/bashrc "$user" 600
@@ -85,9 +85,9 @@ Config_User() {
 }
 
 Config_Skel() {
-       if [ -w /etc/skel ]; then
+       if [ -w /etc/skel -a -z "$I_local" ]; then
                Msg "Starting \"/etc/skel\" configuration:\n"
-               Copy_File user/bash_logout /etc/skel/.bash_logout
+               Copy_File user/bash_logout /etc/skel/.bash_logout root 644
                if [ -e /etc/skel/.profile ]; then
                        Copy_File user/bash_profile /etc/skel/.profile root 644
                else
@@ -95,7 +95,9 @@ Config_Skel() {
                fi
                Copy_File user/bashrc /etc/skel/.bashrc root 644
        else
-               Msg "Can't write to \"/etc/skel\" - configuration SKIPPED.\n"
+               [ -z "$I_local" ] \
+                       && Msg "Can't write to \"/etc/skel\" - configuration SKIPPED.\n" \
+                       || Msg "Local install selected, \"/etc/skel\" configuration SKIPPED.\n"
        fi
 }
 
@@ -127,8 +129,8 @@ Msg "Running $NAME (uid=$UID) ...\n"
 
 user=`basename "$HOME"`
 
-Config_System
 Config_Skel
+Config_System
 Config_User "$user" "$HOME"
 Config_RootUser