[24181] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23782 - in trunk/debathena/debathena/dotfiles: . debian

daemon@ATHENA.MIT.EDU (Evan Broder)
Thu May 14 01:08:38 2009

Date: Thu, 14 May 2009 01:08:28 -0400
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200905140508.n4E58SrN019760@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-05-14 01:08:28 -0400 (Thu, 14 May 2009)
New Revision: 23782

Added:
   trunk/debathena/debathena/dotfiles/env_remove.bash
   trunk/debathena/debathena/dotfiles/env_setup.bash
Modified:
   trunk/debathena/debathena/dotfiles/Makefile
   trunk/debathena/debathena/dotfiles/bashrc
   trunk/debathena/debathena/dotfiles/cshrc
   trunk/debathena/debathena/dotfiles/debian/changelog
Log:
In dotfiles:
  * Implement setup for bash. (Trac: #104)


Modified: trunk/debathena/debathena/dotfiles/Makefile
===================================================================
--- trunk/debathena/debathena/dotfiles/Makefile	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/Makefile	2009-05-14 05:08:28 UTC (rev 23782)
@@ -39,6 +39,8 @@
 	install -c -m 0644 dot.generation ${DESTDIR}${PROTOTMP}/.generation
 	install -c -m 0644 env_remove ${DESTDIR}${SYSTEM}
 	install -c -m 0644 env_setup ${DESTDIR}${SYSTEM}
+	install -c -m 0644 env_remove.bash ${DESTDIR}${SYSTEM}
+	install -c -m 0644 env_setup.bash ${DESTDIR}${SYSTEM}
 	install -c -m 0755 gnome-stuff-1-to-2 ${DESTDIR}${SYSTEM}
 	install -c -m 0755 gnome-panel-1-to-2 ${DESTDIR}${SYSTEM}
 	install -c -m 0444 lockers.7 ${DESTDIR}${ATHMANDIR}/man7

Modified: trunk/debathena/debathena/dotfiles/bashrc
===================================================================
--- trunk/debathena/debathena/dotfiles/bashrc	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/bashrc	2009-05-14 05:08:28 UTC (rev 23782)
@@ -115,9 +115,24 @@
 
 #   aliases dealing with adding locker programs
 
-alias setup='echo "setup is not supported in bash yet"'
+setup_tty () {(export SUBJECT="$@"; $SHELL)}
+setup_X () {(export SUBJECT="$@"; xterm -title "$@" &)}
 
+if [ -n "$XSESSION" ]; then
+   alias setup=setup_X
+else
+   alias setup=setup_tty
+fi
 
+remove () { export SUBJECT="$@"; 
+       	    source $initdir/env_remove.bash; 
+	    unset SUBJECT; }
+
+if [ -n "$SUBJECT" -a -r $initdir/env_setup.bash ]; then
+	source $initdir/env_setup.bash
+fi
+
+
 # All of the bash initializing commands above can be overridden by using
 # "unset" or "unalias" commands (or by changing things using "set" or
 # "alias" again) in your ~/.bashrc.mine file, which is sourced here.

Modified: trunk/debathena/debathena/dotfiles/cshrc
===================================================================
--- trunk/debathena/debathena/dotfiles/cshrc	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/cshrc	2009-05-14 05:08:28 UTC (rev 23782)
@@ -159,7 +159,7 @@
 else
   alias setup setup_tty
 endif
-alias remove 'setenv SUBJECT \!* ; source $initdir/env_remove'
+alias remove 'setenv SUBJECT \!* ; source $initdir/env_remove ; unsetenv SUBJECT'
 
 # If this is a subject window, run the env_setup script
 if (($?SUBJECT) && (-r $initdir/env_setup)) source $initdir/env_setup

Modified: trunk/debathena/debathena/dotfiles/debian/changelog
===================================================================
--- trunk/debathena/debathena/dotfiles/debian/changelog	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/debian/changelog	2009-05-14 05:08:28 UTC (rev 23782)
@@ -2,8 +2,9 @@
 
   * Remove VISUAL, term, and xresize from the standard dotfiles. (Trac:
     #151)
+  * Implement setup for bash. (Trac: #104)
 
- -- Evan Broder <broder@mit.edu>  Thu, 14 May 2009 01:03:59 -0400
+ -- Evan Broder <broder@mit.edu>  Thu, 14 May 2009 01:07:14 -0400
 
 debathena-dotfiles (10.0.10-0debathena1) unstable; urgency=low
 

Added: trunk/debathena/debathena/dotfiles/env_remove.bash
===================================================================
--- trunk/debathena/debathena/dotfiles/env_remove.bash	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/env_remove.bash	2009-05-14 05:08:28 UTC (rev 23782)
@@ -0,0 +1,12 @@
+# Prototype file sourced by "remove" alias
+
+if [ -n "$setup_dir" -a -n "$setup_filsys" ]; then
+	if [ -r $setup_dir/.detachrc.bash ]; then
+	    source $setup_dir/.detachrc.bash
+	fi
+	cd /			# get out of locker
+	/bin/detach $setup_filsys
+	kill -HUP $$ 		# cause shell to exit
+fi
+
+echo "Remove only works from the same shell in which you typed setup."

Added: trunk/debathena/debathena/dotfiles/env_setup.bash
===================================================================
--- trunk/debathena/debathena/dotfiles/env_setup.bash	2009-05-14 05:04:29 UTC (rev 23781)
+++ trunk/debathena/debathena/dotfiles/env_setup.bash	2009-05-14 05:08:28 UTC (rev 23782)
@@ -0,0 +1,46 @@
+# Prototype file for setting up course-specific environment
+
+echo "Attaching $SUBJECT ... "
+setup_dir=`/bin/attach -p $SUBJECT`
+
+if [ $? == 0 ]; then
+
+	# Record information to remove setup later
+	setup_filsys=$SUBJECT
+
+	# Set prompt to reflect changed environment
+	PS1="${SUBJECT}\$ "
+
+	if [ -r $setup_dir/.attachrc.bash ]; then
+		unset SUBJECT	# to prevent infinite loops
+		echo "Running commands in $setup_dir/.attachrc.bash ... "
+		source $setup_dir/.attachrc.bash
+        else
+	    if [ -r $setup_dir/.attachrc ]; then
+		echo "This locker is not yet configured for the 'setup' command."
+		echo "Contact the locker maintainer for more information."
+	    fi
+	    # Do minimal environment setup
+	    add $setup_filsys
+
+	fi
+else
+	echo ""
+        echo "The $SUBJECT filesystem could not be attached."
+	filsys=(`hesinfo $SUBJECT filsys`)
+	if [ ${#filsys} -lt 3 ]; then
+		echo "Check your spelling of the filesystem name."
+	else
+		echo -n "The ${filsys[0]} fileserver"
+		if [ ${filsys[0]} != "AFS" ]; then 
+		    echo -n " named ${filsys[2]}"
+		fi
+		echo " may be down."
+	fi
+	if [ -n "$XSESSION" ]; then
+	    echo "Type exit to get rid of this window."
+	else
+	    kill -HUP $$	# cause shell to exit
+	fi
+fi
+unset SUBJECT	# to prevent infinite loops


home help back first fref pref prev next nref lref last post