archdir=/mit/$(ATHENA_USER)/arch/
common=$(archdir)/common/
-scripts=bores-me card-access grep-owners ldapfinger list-members list-of-lists-updater lists-lint rt-set rt-resolve check-host update-officers make-zcrypt-key get-emails mail-merge sshroot
+scripts=bores-me card-access grep-owners ldapfinger list-members list-of-lists-updater lists-lint rt-set rt-resolve check-host update-officers make-zcrypt-key get-emails mail-merge sshroot pag-screen
arches=i386_deb31 i386_deb40 i386_deb50 i386_rhel4
all : install
--- /dev/null
+#!/usr/bin/env pagsh
+
+screen=`which screen`
+
+# Check for pre-existing screens.
+screenlist=`$screen -list | grep owl`
+if [ "x$screenlist" != "x" ]; then
+ echo "Found a pre-existing owl-screen session:"
+ echo "$screenlist"
+ echo "You probably want to reattach it instead."
+ echo
+ exit 1
+fi
+
+# Get AFS tokens for the screen session.
+# We are now in a new PAG (because of pagsh).
+# If you want to get tokens for other cells, list them in ~/.xlog
+aklog
+
+# Use separate kerberos tickets for screen. Even if we accidentally
+# (or intentionally) log out, screen and owl will still have tickets.
+NEWKRB5=/tmp/krb5cc_${USER}_screen
+
+# Copy the tickets we obtained on login to the screen tickets.
+KRB5CCNAME=`echo $KRB5CCNAME | sed 's/FILE://'`
+cp $KRB5CCNAME $NEWKRB5
+
+# Now actually use the new tickets.
+KRB5CCNAME=FILE:$NEWKRB5; export KRB5CCNAME
+
+# Repeat for krb4 if appropriate.
+if [ "x$KRBTKFILE" != "x" ]; then
+ NEWKRB4=/tmp/tkt_${USER}_screen
+ KRBTKFILE=`echo $KRBTKFILE | sed 's/FILE://'`
+ cp $KRBTKFILE $NEWKRB4
+ KRBTKFILE=$NEWKRB4; export KRBTKFILE
+fi
+
+# Figure out which zephyr client to use. Defaults to barnowl.
+if [ "x$ZEPHYR_SCREEN_CLIENT" = "x" ]; then
+ barnowl=`which barnowl`
+ if [ ! -x "$barnowl" ]; then
+ attach -n -q barnowl
+ barnowl=`athdir /mit/barnowl`/barnowl
+ fi
+ ZEPHYR_SCREEN_CLIENT="$barnowl"
+fi
+
+# Renew tickets and tokens.
+contrenew=`which cont-renew-notify`
+if [ ! -x "$contrenew" ]; then
+ zwrite $ATHENA_USER -d -m "$0: cont-renew doesn't exist on $(hostname)... Not doing renewals"
+ contrenew=/bin/true
+fi
+nohup $contrenew < /dev/null > /dev/null 2> /dev/null &
+
+# Name the screen pag so we can reattach the right screen later.
+$screen -S pag