X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=install.sh;h=e3b0359d97da73b35246a198243c3de811cac2ad;hb=d7a7a2e76a1a370be33fb6a0281d45d7b7791f66;hp=19110835968754dac45e9353912663acfe875606;hpb=82ed94b6df44e1d8fa9523ce5b19f8cbad444fc6;p=ConfigScripts.git diff --git a/install.sh b/install.sh index 1911083..e3b0359 100755 --- a/install.sh +++ b/install.sh @@ -26,7 +26,7 @@ Copy_File() { fi fi Msg " " - cp --preserve=timestamps "$src" "$dst" || Abort + cp -p "$src" "$dst" || Abort if [ -n "$own" ]; then chown "$own" "$dst" || Abort fi @@ -37,15 +37,15 @@ Copy_File() { } Config_System() { - if [ "$UID" = "0" -a -z "$I_local" ]; then + if [ "$EUID" = "0" -a -z "$I_local" ]; then Msg "Starting system configuration:\n" Msg " - bash shell:\n" if [ -e /etc/bash.bashrc ]; then - Copy_File sys/bashrc /etc/bash.bashrc root 644 + Copy_File sys/bashrc /etc/bash.bashrc root:0 644 else - Copy_File sys/bashrc /etc/bashrc root 644 + Copy_File sys/bashrc /etc/bashrc root:0 644 fi - Copy_File sys/profile /etc/profile root 644 + Copy_File sys/profile /etc/profile root:0 644 else Msg "Not running with root privileges - system configuration SKIPPED.\n" grep "alex@barton.de" /etc/profile >/dev/null 2>&1 @@ -89,13 +89,13 @@ Config_Skel() { if [ -w /etc/skel -a -z "$I_local" ]; then Msg "Starting \"/etc/skel\" configuration:\n" Msg " - bash shell:\n" - Copy_File user/bash_logout /etc/skel/.bash_logout root 644 + Copy_File user/bash_logout /etc/skel/.bash_logout root:0 644 if [ -e /etc/skel/.profile ]; then - Copy_File user/bash_profile /etc/skel/.profile root 644 + Copy_File user/bash_profile /etc/skel/.profile root:0 644 else - Copy_File user/bash_profile /etc/skel/.bash_profile root 644 + Copy_File user/bash_profile /etc/skel/.bash_profile root:0 644 fi - Copy_File user/bashrc /etc/skel/.bashrc root 644 + Copy_File user/bashrc /etc/skel/.bashrc root:0 644 else [ -z "$I_local" ] \ && Msg "Can't write to \"/etc/skel\" - configuration SKIPPED.\n" \ @@ -103,16 +103,6 @@ Config_Skel() { fi } -Config_RootUser() { - if [ "$UID" = "0" ]; then - user=`grep "^.*:.*:0:" /etc/passwd | head -n 1 | cut -d':' -f1` - home=`grep "^.*:.*:0:" /etc/passwd | cut -d':' -f6` - Config_User "$user" "$home" - else - Msg "Not running with root privileges - root user configuration SKIPPED.\n" - fi -} - while [ $# -gt 0 ]; do case "$1" in "--local"|"-l") @@ -124,17 +114,17 @@ while [ $# -gt 0 ]; do shift done -[ -n "$UID" ] || UID=`id -u` -export UID +[ -n "$UID" ] || UID=`id -r -u` +[ -n "$EUID" ] || EUID=`id -u` +export UID EUID -Msg "Running $NAME (uid=$UID) ...\n" +Msg "Running $NAME (uid=$UID; euid=$EUID) ...\n" user=`basename "$HOME"` Config_Skel Config_System Config_User "$user" "$HOME" -Config_RootUser Msg "$NAME: Done.\n"