From: Alexander Barton Date: Sun, 27 Feb 2011 17:56:48 +0000 (+0100) Subject: New make target "install-local": install to ~/.etc X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83c9d9387e2895e1cf7175f3abdd3ba1564fd5da;p=ConfigScripts.git New make target "install-local": install to ~/.etc --- diff --git a/Makefile b/Makefile index e76ad87..1ca1b33 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ all: install: sh ./install.sh +install-local: + sh ./install.sh --local + clean: check: diff --git a/install.sh b/install.sh index 86849bb..b150112 100755 --- a/install.sh +++ b/install.sh @@ -37,7 +37,7 @@ Copy_File() { } Config_System() { - if [ "$UID" = "0" ]; then + if [ "$UID" = "0" -a -z "$I_local" ]; then Msg "Starting system configuration:\n" Msg " - bash shell:\n" if [ -e /etc/bash.bashrc ]; 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 ]; then + if [ $? -ne 0 -o -n "$I_local" ]; then Msg "Installing system files to $HOME/.etc/ ...\n" mkdir -p "$HOME/.etc" Copy_File sys/bashrc $HOME/.etc/bashrc "$user" 600 @@ -94,6 +94,17 @@ Config_RootUser() { fi } +while [ $# -gt 0 ]; do + case "$1" in + "--local"|"-l") + export I_local=1; ;; + *) + echo "Usage: $0 [--local|-l]" + exit 1 + esac + shift +done + [ -n "$UID" ] || UID=`id -u` export UID