1 #!/bin/sh 2 # 3 # tcshrc_config configuration script by Simos Xenitellis <simos.lists@googlemail.com>. 4 # 5 6 SOURCE="/usr/share/tcshrc" 7 ETCSKEL="/etc/skel" 8 9 USER=n 10 SYSTEM=n 11 VERBOSE= 12 13 usage() 14 { 15 echo "usage: $0 [-v|--verbose] [[-u|--user] | [-s|--system]] [-h|--help]" >&2 16 echo " -v --verbose be verbose" >&2 17 echo " -u --user installation for the current user" >&2 18 echo " -s --system system-wide installation (in /etc/skel)" >&2 19 echo "" >&2 20 echo "The system-wide installation populates $ETCSKEL" >&2 21 echo "and new accounts created will have the tcsh" >&2 22 echo "configuration files by default." >&2 23 echo "" >&2 24 exit 0 25 } 26 27 while [ $# -gt 0 ] ; do 28 case $1 in 29 -u|--user) 30 USER=y 31 ;; 32 -s|--system) 33 SYSTEM=y 34 ;; 35 -v|--verbose) 36 VERBOSE=--verbose 37 ;; 38 -*) 39 usage 40 exit 0 41 ;; 42 *) 43 break 44 ;; 45 esac 46 shift 47 done 48 49 if [ "$USER" = "y" -a "$SYSTEM" = "y" ] ; then 50 echo "Please choose either a user or system-wide installation." >&2 51 exit 1 52 fi 53 54 if [ "$USER" = "y" ] ; then 55 echo -n "Copying files from ${SOURCE} to ${HOME}..." >&2 56 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc ${HOME}/.tcshrc 57 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.bindkey ${HOME}/.tcshrc.bindkey 58 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.complete ${HOME}/.tcshrc.complete 59 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.set ${HOME}/.tcshrc.set 60 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.alias ${HOME}/.tcshrc.alias 61 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.hosts ${HOME}/.tcshrc.hosts 62 /bin/cp -u ${VERBOSE} ${SOURCE}/tcshrc.local ${HOME}/.tcshrc.local 63 echo " done." >&2 64 exit 0 65 fi 66 67 if [ "$SYSTEM" = "y" ] ; then 68 echo -n "Copying files from ${SOURCE} to ${ETCSKEL}..." >&2 69 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc ${ETCSKEL}/.tcshrc 70 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.bindkey ${ETCSKEL}/.tcshrc.bindkey 71 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.complete ${ETCSKEL}/.tcshrc.complete 72 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.set ${ETCSKEL}/.tcshrc.set 73 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.alias ${ETCSKEL}/.tcshrc.alias 74 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.hosts ${ETCSKEL}/.tcshrc.hosts 75 /bin/cp -f ${VERBOSE} ${SOURCE}/tcshrc.local ${ETCSKEL}/.tcshrc.local 76 echo " done." >&2 77 exit 0 78 fi 79 80 usage 81 exit 0