aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-11-02 09:47:31 +0100
committerMattias Andrée <maandree@operamail.com>2013-11-02 09:47:31 +0100
commit1fa9efd6de57133ff012efeb42eb41597c705c3d (patch)
treec9855d77e51d614f10ce9fc9def2acf2b4db84ae
parentTo bad this does not work... (diff)
downloadgates-of-tartaros-1fa9efd6de57133ff012efeb42eb41597c705c3d.tar.gz
gates-of-tartaros-1fa9efd6de57133ff012efeb42eb41597c705c3d.tar.bz2
gates-of-tartaros-1fa9efd6de57133ff012efeb42eb41597c705c3d.tar.xz
more flexible, the commands got using ssh, login and locking the screen can be replace or extended
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-xgot33
1 files changed, 27 insertions, 6 deletions
diff --git a/got b/got
index a248961..a2325cc 100755
--- a/got
+++ b/got
@@ -65,17 +65,38 @@ login_function=_login
_login ()
{
if [ ! "${user%@*}" = "${user}" ]; then
- setsid -c @ssh@ ${user} || sleep 3
- # The sleep allows you to see any error you made
+ $_use_ssh_function
elif [ ! "${user}" = "" ] && [ "${user%%-*}" = "" ]; then
- stty -icanon -echo -isig -ixon -ixoff -ixany
- echo -e '\e[01;31mNice try! Sleeping for 10 minutes...\e[00m'
- sleep 600
+ $_lock_tty_function
else
- setsid -c login -- "${user}"
+ $_use_login_function
fi
}
+# Function for locking the TTY
+_lock_tty_function=_lock_tty
+_lock_tty ()
+{
+ stty -icanon -echo -isig -ixon -ixoff -ixany
+ echo -e '\e[01;31mNice try! Sleeping for 10 minutes...\e[00m'
+ sleep 600
+}
+
+# Function for performing the log in with `ssh`
+_use_ssh_function=_use_ssh
+_use_ssh ()
+{
+ setsid -c ssh ${user} || sleep 3
+ # The sleep allows you to see any error you made
+}
+
+# Function for performing the log in with `login`
+_use_login_function=_use_login
+_use_login ()
+{
+ setsid -c login -- "${user}"
+}
+
# Load OS information and extensions
NAME="$(uname -o)"