aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--COPYING2
-rw-r--r--DEPENDENCIES35
-rw-r--r--Makefile46
-rw-r--r--README3
-rwxr-xr-xgot76
-rw-r--r--gotrc-examples/README10
-rw-r--r--gotrc-examples/allow-uppercase32
-rw-r--r--gotrc-examples/baudrate14
-rw-r--r--gotrc-examples/cerberus8
-rw-r--r--gotrc-examples/commands82
-rw-r--r--gotrc-examples/hide-username29
-rw-r--r--gotrc-examples/issue-file15
-rw-r--r--gotrc-examples/loadkeys34
-rw-r--r--gotrc-examples/lower-left-ponysay27
-rw-r--r--gotrc-examples/no-empty-user14
-rw-r--r--gotrc-examples/readline8
-rw-r--r--gotrc-examples/revoke-access12
-rw-r--r--info/gates-of-tartaros.texinfo31
19 files changed, 217 insertions, 263 deletions
diff --git a/.gitignore b/.gitignore
index 4028b6e..de04d95 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-_/
obj/
\#*\#
__pycache__/
@@ -24,4 +23,3 @@ __pycache__/
*.toc
*.tp
*.vr
-
diff --git a/COPYING b/COPYING
index 51b1b98..440f6d4 100644
--- a/COPYING
+++ b/COPYING
@@ -1,6 +1,6 @@
gates-of-tartaros – Minimal replacement for agetty with SSH support
-Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/DEPENDENCIES b/DEPENDENCIES
index 85b55df..7974750 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -1,26 +1,19 @@
RUNTIME DEPENDENCIES:
-<package> <command> <reason>
-util-linux login login is used for authorisation and login
-util-linux setsid used to start login in a new session
-bash bash (out-out) gates-of-tartaros is written in Bash
-dash dash (opt-in) gates-of-tartaros is compatible with Dash
-openssh ssh (optional) used for SSH login
-coreutils env (opt-out) used to get the path to Bash in the shebangs
-coreutils stty used to lock the TTY if somepony ties something evil
-coreutils sleep used to wait for ten minues if somepony ties something evil
-coreutils uname used to get the name of the operating system as a distribution name fallback
-
-
+ login
+ setsid
+ bash (default) or dash
+ ssh
+ env
+ stty
+ sleep
+ uname
BUILD DEPENDENCIES:
-<package> <command> <when>
-make make required
-sed sed required
-coreutils cp required
-coreutils rm required
-coreutils install required
-texinfo makeinfo opt-out: for info manual
-gzip gzip opt-out: for info manual compression
-
+ make
+ sh
+ sed
+ cp
+ mkdir
+ makeinfo (opt-out: for info manual)
diff --git a/Makefile b/Makefile
index aa21c1e..1930b77 100644
--- a/Makefile
+++ b/Makefile
@@ -16,11 +16,20 @@ SSH = ssh
SH = bash
SH_SHEBANG = /usr/bin/env $(SH)
-ECHO = /usr/bin/echo
-EXAMPLES = README lower-left-ponysay allow-uppercase issue-file \
- commands no-empty-user baudrate cerberus hide-username \
- readline revoke-access loadkeys
+EXAMPLES =\
+ allow-uppercase\
+ baudrate\
+ cerberus\
+ commands\
+ hide-username\
+ issue-file\
+ loadkeys\
+ lower-left-ponysay\
+ no-empty-user\
+ readline\
+ revoke-access\
+ README
@@ -84,7 +93,6 @@ got.install: got
sed -i 's:@etc@:$(SYSCONF):g' "$@"
sed -i 's:@command@:$(COMMAND):g' "$@"
sed -i 's:@ssh@:$(SSH):g' "$@"
- sed -i 's:@echo@:$(ECHO):g' "$@"
@@ -99,33 +107,38 @@ install-cmd: install-core install-examples
.PHONY: install-core
install-core: got.install
- install -Dm755 -- "got.install" "$(DESTDIR)$(PREFIX)$(SBIN)/got"
- install -d -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
- install -m644 -- COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)$(SBIN)/"
+ cp -- got.install "$(DESTDIR)$(PREFIX)$(SBIN)/got"
+ mkdir -p -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/"
+ cp -- COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)/"
.PHONY: install-examples
install-examples: $(foreach EXAMPLE, $(EXAMPLES), gotrc-examples/$(EXAMPLE))
- install -d -- "$(DESTDIR)$(SYSCONF)/gotrc.examples"
- install -m644 -- $^ "$(DESTDIR)$(SYSCONF)/gotrc.examples"
+ mkdir -p -- "$(DESTDIR)$(SYSCONF)/gotrc.examples"
+ cp -- $(foreach EXAMPLE, $(EXAMPLES), gotrc-examples/$(EXAMPLE)) "$(DESTDIR)$(SYSCONF)/gotrc.examples"
.PHONY: install-doc
install-doc: install-info install-pdf install-ps install-dvi
.PHONY: install-info
install-info: gates-of-tartaros.info
- install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/info/$(PKGNAME).info"
+ mkdir -p -- "$(DESTDIR)$(DATA)/info/"
+ cp -- gates-of-tartaros.info "$(DESTDIR)$(DATA)/info/$(PKGNAME).info"
.PHONY: install-pdf
install-pdf: gates-of-tartaros.pdf
- install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).pdf"
+ mkdir -p -- "$(DESTDIR)$(DATA)/doc/"
+ cp -- gates-of-tartaros.pdf "$(DESTDIR)$(DATA)/doc/$(PKGNAME).pdf"
.PHONY: install-ps
install-ps: gates-of-tartaros.ps
- install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).ps"
+ mkdir -p -- "$(DESTDIR)$(DATA)/doc/"
+ cp -- gates-of-tartaros.ps "$(DESTDIR)$(DATA)/doc/$(PKGNAME).ps"
.PHONY: install-dvi
install-dvi: gates-of-tartaros.dvi
- install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).dvi"
+ mkdir -p -- "$(DESTDIR)$(DATA)/doc/"
+ cp -- gates-of-tartaros.dvi "$(DESTDIR)$(DATA)/doc/$(PKGNAME).dvi"
@@ -135,7 +148,7 @@ uninstall:
-rm -r -- "$(DESTDIR)$(SYSCONF)/gotrc.examples"
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE"
- -rm -d -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
+ -rmdir -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
-rm -- "$(DESTDIR)$(DATA)/info/$(PKGNAME).info"
-rm -- "$(DESTDIR)$(DATA)/doc/$(PKGNAME).pdf"
-rm -- "$(DESTDIR)$(DATA)/doc/$(PKGNAME).ps"
@@ -145,5 +158,4 @@ uninstall:
.PHONY: clean
clean:
- -rm -fr *.install *.{info,pdf,ps,dvi} obj
-
+ -rm -fr -- *.install *.info *.pdf *.ps *.dvi obj
diff --git a/README b/README
index 5a7a10a..58cc5a6 100644
--- a/README
+++ b/README
@@ -7,7 +7,7 @@ gates-of-tartaros uses more memory than agetty.
You can configure your install to use dash
instead of bash by running make with the
-argument SH=dash. Doing so will more halve
+argument SH=dash. Doing so will more than halve
the memory usage, reducing the memory usage
to slightly below that of agetty.
@@ -22,4 +22,3 @@ Usage:
Example:
got tty1 TERM=linux
-
diff --git a/got b/got
index 62940dd..81a6350 100755
--- a/got
+++ b/got
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,8 +21,8 @@
# Read the parameters: the first is the tty, the rest are exports
tty="$1"
shift 1
-if [ ! $# = 0 ]; then
- export "$@"
+if test ! $# = 0; then
+ export "$@"
fi
# Change TTY
@@ -35,77 +35,62 @@ exec 2>&0
tty_settings="$(stty --save)"
-# This is required if you want to use dash (and ash, since dash
-# [dash not ash] does not recognise $'').
-echo ()
-{
- @echo@ "$@"
-}
-
-
# Function used for printing information on the terminal for the user
display_function=_display
-_display ()
-{
- echo -en '\e[H\e[2J\e[?0c'
- echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m"
- echo
- echo -n 'Login: '
+_display () {
+ printf '\033[H\033[2J\033[?0c'
+ printf "\033[%sm%s (%s)\033[0m\n" "${ANSI_COLOR}" "${NAME}" "${tty}"
+ printf '\nLogin: '
}
# Function for reading the username form the terminal
read_function=_read
-_read ()
-{
- read user
+_read () {
+ read user
}
# Function for logging in the user
login_function=_login
-_login ()
-{
- if [ ! "${user%@*}" = "${user}" ]; then
- $_use_ssh_function
- elif [ ! "${user}" = "" ] && [ "${user%%-*}" = "" ]; then
- $_lock_tty_function
- else
- $_use_login_function
- fi
+_login () {
+ if test ! "${user%@*}" = "${user}"; then
+ $_use_ssh_function
+ elif test -n "${user}" && test -z "${user%%-*}"; then
+ $_lock_tty_function
+ else
+ $_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
+_lock_tty () {
+ stty -icanon -echo -isig -ixon -ixoff -ixany
+ printf '\033[01;31mNice try! Sleeping for 10 minutes...\033[0m\n'
+ 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
+_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}"
+_use_login () {
+ setsid -c login -- "${user}"
}
# Load OS information and extensions
NAME="$(uname -o)"
ANSI_COLOR='01;34' # must be exactly ANSI_COLOR as it is defined in /etc/os-release
-if [ -f "@etc@/os-release" ]; then
- . "@etc@/os-release"
+if test -f "@etc@/os-release"; then
+ . "@etc@/os-release"
fi
-if [ -f "@etc@/@command@rc" ]; then
- . "@etc@/@command@rc"
+if test -f "@etc@/@command@rc"; then
+ . "@etc@/@command@rc"
fi
# Let the user log in
@@ -115,4 +100,3 @@ $login_function
# Restore the TTY settings for the next run
stty "${tty_settings}"
-
diff --git a/gotrc-examples/README b/gotrc-examples/README
index cdd2d29..1ed40e4 100644
--- a/gotrc-examples/README
+++ b/gotrc-examples/README
@@ -1,15 +1,9 @@
-These are templates you can used for your gotrc file.
+These are templates you can use for your gotrc file.
If you are happy with them as is, you can include
-them directly in your by gotrc file with for example:
+them directly in your gotrc file, for example:
. /etc/gotrc-examples/no-empty-user
Although, it may be better to copy the ones you are
using into a directory named /etc/got.d and include
them from there.
-
-If you create any cool or useful extensions yourself
-and do not object to licenses them under the GNU
-General Public License version 3, please submit them
-to <https://github.com/GNU-Pony/gates-of-tartaros>.
-
diff --git a/gotrc-examples/allow-uppercase b/gotrc-examples/allow-uppercase
index 3bb0db1..556f137 100644
--- a/gotrc-examples/allow-uppercase
+++ b/gotrc-examples/allow-uppercase
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,21 +24,19 @@
read_function_allow_uppercase=$read_function
read_function=_read_allow_uppercase
-_read_allow_uppercase ()
-{
- $read_function_allow_uppercase
- lower=""
- for word in $user; do
- if [ ! "${word%%-*}" = "" ]; then # This check is done so SSH arguments are not made into lower case
- word="$(echo "${word}" | sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/')"
+_read_allow_uppercase () {
+ $read_function_allow_uppercase
+ lower=""
+ for word in $user; do
+ if test -n "${word%%-*}"; then # This check is done so SSH arguments are not made into lower case
+ word="$(echo "${word}" | sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm/')"
+ fi
+ lower="${lower} ${word}"
+ done
+ lower="${lower# *}"
+ if test ! "${lower}" = "${user}"; then
+ #stty olcuc ## Uncomment this if you want to go old-school Unix, too bad
+ ## it will break colours and only uppercases ASCII letters.
+ user="${lower}"
fi
- lower="${lower} ${word}"
- done
- lower="${lower# *}"
- if [ ! "${lower}" = "${user}" ]; then
- #stty olcuc ## Uncomment this if you want to go old-school Unix, too bad
- ## it will break colours and only uppercases ASCII letters.
- user="${lower}"
- fi
}
-
diff --git a/gotrc-examples/baudrate b/gotrc-examples/baudrate
index 684722f..7fc29aa 100644
--- a/gotrc-examples/baudrate
+++ b/gotrc-examples/baudrate
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,11 +29,9 @@
display_function_baudrate=$display_function
display_function=_display_baudrate
-_display_baudrate ()
-{
- if [ ! "${BAUDRATE}" = "" ]; then
- stty ${BAUDRATE}
- fi
- $display_function_baudrate
+_display_baudrate () {
+ if test -n "${BAUDRATE}"; then
+ stty ${BAUDRATE}
+ fi
+ $display_function_baudrate
}
-
diff --git a/gotrc-examples/cerberus b/gotrc-examples/cerberus
index e0761ca..9efa783 100644
--- a/gotrc-examples/cerberus
+++ b/gotrc-examples/cerberus
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,8 +22,6 @@
# cerberus instead of login
-_use_login ()
-{
- exec cerberus -- "${user}"
+_use_login () {
+ exec cerberus -- "${user}"
}
-
diff --git a/gotrc-examples/commands b/gotrc-examples/commands
index 0d57eca..6605884 100644
--- a/gotrc-examples/commands
+++ b/gotrc-examples/commands
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,42 +24,41 @@
login_function_commands=$login_function
login_function=_login_commands
-_login_commands ()
-{
- if [ ! "${user}" = "" ] && [ "${user%%+*}" = "" ]; then
- if [ "${user}" = "+shutdown" ]; then
- shutdown -h now
- elif [ "${user}" = "+reboot" ]; then
- reboot
- elif [ "${user}" = "+time" ]; then
- echo
- date +%Y-\(%m\)%b-%d\ %T,\ %a\ w%W/%V,\ %Z
- read __
- elif [ "${user}" = "+battery" ]; then
- echo
- acpi -V
- read __
- elif [ "${user}" = "+backlight" ]; then
- if [ "${LANG%UTF-8*}" = "${LANG}" ]; then
- export LANG="en_GB.UTF-8"
- fi
- adjbacklight
- elif [ "${user}" = "+keyboard" ]; then
- echo "Enter keyboard layout: (e.g. sv-latin1)"
- read -r layout
- if [ ! "$(echo ${layout})" = "" ]; then
- loadkeys -C "/dev/${tty}" -- ${layout}
- if [ ! $? = 0 ]; then
- echo 'Press ENTER to continue...'
- read
- fi
- fi
- elif [ "${user}" = "+1" ]; then
- echo "Enter parameters: (e.g. tty7 TERM=linux)"
- read -r params
- setsid -- "$0" $params &
- else
- cat <<EOF
+_login_commands () {
+ if test -n "${user}" && test -z "${user%%+*}"; then
+ if test "${user}" = "+shutdown"; then
+ shutdown -h now
+ elif test "${user}" = "+reboot"; then
+ reboot
+ elif test "${user}" = "+time"; then
+ printf '\n'
+ date +'%Y-(%m)%b-%d %T, %a w%W/%V, %Z'
+ read __
+ elif test "${user}" = "+battery"; then
+ printf '\n'
+ acpi -V
+ read __
+ elif test "${user}" = "+backlight"; then
+ if test "${LANG%UTF-8*}" = "${LANG}"; then
+ export LANG="en_GB.UTF-8"
+ fi
+ adjbacklight
+ elif test "${user}" = "+keyboard"; then
+ printf 'Enter keyboard layout: (e.g. sv-latin1)\n'
+ read -r layout
+ if test -n "${layout}"; then
+ loadkeys -C "/dev/${tty}" -- ${layout}
+ if test ! $? = 0; then
+ printf 'Press ENTER to continue...\n'
+ read
+ fi
+ fi
+ elif test "${user}" = "+1"; then
+ printf 'Enter parameters: (e.g. tty7 TERM=linux)\n'
+ read -r params
+ setsid -- "$0" $params &
+ else
+ cat <<EOF
Command is not recognised.
Recognised commands include:
@@ -71,10 +70,9 @@ Recognised commands include:
+keyboard Select keyboard layout for the TTY (This may effect all TTY:s)
+1 Open a new gates-of-tartaros in another TTY
EOF
- read __
+ read __
+ fi
+ else
+ $login_function_commands
fi
- else
- $login_function_commands
- fi
}
-
diff --git a/gotrc-examples/hide-username b/gotrc-examples/hide-username
index 05d670f..798fa34 100644
--- a/gotrc-examples/hide-username
+++ b/gotrc-examples/hide-username
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,25 +28,22 @@
read_function_hide_username=$read_function
read_function=_read_hide_username
-_read_hide_username ()
-{
- local _read_tty_settings
- _read_tty_settings="$(stty --save)"
- stty -echo
-
- $read_function_hide_username
-
- stty "${_read_tty_settings}"
- echo
+_read_hide_username () {
+ local _read_tty_settings
+ _read_tty_settings="$(stty --save)"
+ stty -echo
+
+ $read_function_hide_username
+
+ stty "${_read_tty_settings}"
+ printf '\n'
}
# If you use GNU Bash for gates-of-tartaros,
# you can use this instead:
-# _read ()
-# {
-# read -s user
-# echo
+# _read () {
+# read -s user
+# echo
# }
-
diff --git a/gotrc-examples/issue-file b/gotrc-examples/issue-file
index a620117..9fa5dcc 100644
--- a/gotrc-examples/issue-file
+++ b/gotrc-examples/issue-file
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,10 +21,9 @@
# Module for using the /etc/issue file
-_display ()
-{
- if [ ! -f "/etc/issue.default" ] || [ ! "$(md5sum < "/etc/issue.default")" = "$(md5sum < "/etc/issue")" ]; then
- python3 <<EOF
+_display () {
+ if test ! -f "/etc/issue.default" || test ! "$(md5sum < "/etc/issue.default")" = "$(md5sum < "/etc/issue")"; then
+ python3 <<EOF
import os
import sys
from subprocess import Popen, PIPE
@@ -98,8 +97,6 @@ for i in range(len(data)):
sys.stdout.buffer.write(buf.encode('utf-8'))
sys.stdout.buffer.flush()
EOF
- echo
- echo -n 'Login: '
- fi
+ printf '\nLogin: '
+ fi
}
-
diff --git a/gotrc-examples/loadkeys b/gotrc-examples/loadkeys
index b3b2352..f755656 100644
--- a/gotrc-examples/loadkeys
+++ b/gotrc-examples/loadkeys
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,22 +26,20 @@
login_function_loadkeys=$login_function
login_function=_login_loadkeys
-_login_loadkeys ()
-{
- if [ "${user}" = "" ]; then
- printf '%s' 'Keyboard layout: '
- $read_function
- if [ ! "${user}" = "" ]; then
- user_="$(printf "%s" "${user}" | sed 's:/::g')"
- if [ "${user}" = "${user_}" ]; then
- loadkeys -C $(tty) -- ${user} || sleep 2
- else
- echo 'Sorry, only installed keymaps!'
- sleep 2
- fi
+_login_loadkeys () {
+ if test -z "${user}"; then
+ printf 'Keyboard layout: '
+ $read_function
+ if test -n "${user}"; then
+ user_="$(printf "%s" "${user}" | tr -d /)"
+ if test "${user}" = "${user_}"; then
+ loadkeys -C $(tty) -- ${user} || sleep 2
+ else
+ printf 'Sorry, only installed keymaps!\n'
+ sleep 2
+ fi
+ fi
+ else
+ $login_function_loadkeys
fi
- else
- $login_function_loadkeys
- fi
}
-
diff --git a/gotrc-examples/lower-left-ponysay b/gotrc-examples/lower-left-ponysay
index 62da1cc..387665f 100644
--- a/gotrc-examples/lower-left-ponysay
+++ b/gotrc-examples/lower-left-ponysay
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -23,18 +23,15 @@
# as well as set a nice palette to the TTY.
-_display ()
-{
- PALETTE="$(echo -e '\e]P0020840\e]P1CD656C\e]P232A679\e]P3CCAD47\e]P42495BE\e]P5A46EB0\e]P600A09F\e]P7D3D7CF\e]P8555753\e]P9EB5E6A\e]PA0EC287\e]PBF2CA38\e]PC00ACE0\e]PDC473D1\e]PE00C3C7\e]PFEEEEEE')"
- echo -n "${PALETTE}"
- echo -en '\e[H\e[2J'
- pony="$(PONYSAY_SHELL_LINES=5 PONYSAY_KMS_PALETTE="${PALETTE}" ponysay -o <&2)"
- lines=$(echo "${pony}" | wc -l)
- height=$(stty size | cut -d ' ' -f 1)
- echo -en '\e['"$(( $height - $lines + 1 ));1H"
- echo -n "$(echo "${pony}" | sed -e 's:\x1b\[H\x1b\[2J::')${PALETTE}"
- echo -e "\e[H\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m"
- echo
- echo -n 'Login: '
+_display () {
+ PALETTE="$(printf '\033]P0020840\033]P1CD656C\033]P232A679\033]P3CCAD47\033]P42495BE\033]P5A46EB0\033]P600A09F\033]P7D3D7CF\033]P8555753\033]P9EB5E6A\033]PA0EC287\033]PBF2CA38\033]PC00ACE0\033]PDC473D1\033]PE00C3C7\033]PFEEEEEE')"
+ printf '%s' "${PALETTE}"
+ printf '\033[H\033[2J'
+ pony="$(PONYSAY_SHELL_LINES=5 PONYSAY_KMS_PALETTE="${PALETTE}" ponysay -o <&2)"
+ lines=$(echo "${pony}" | wc -l)
+ height=$(stty size | cut -d ' ' -f 1)
+ printf '\033[%s;1H' "$(( $height - $lines + 1 ))"
+ printf '%s%s' "$(echo "${pony}" | sed -e 's:\x1b\[H\x1b\[2J::')" "${PALETTE}"
+ echo -e "\033[H\033[%sm%s (%s)\033[0m" "${ANSI_COLOR}" "${NAME}" "${tty}"
+ printf '\nLogin: '
}
-
diff --git a/gotrc-examples/no-empty-user b/gotrc-examples/no-empty-user
index 4cdec36..074bd14 100644
--- a/gotrc-examples/no-empty-user
+++ b/gotrc-examples/no-empty-user
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,11 +24,9 @@
read_function_no_empty_user=$read_function
read_function=_read_no_empty_user
-_read_no_empty_user ()
-{
- $read_function_no_empty_user
- if [ "${user}" = "" ]; then
- exit 0
- fi
+_read_no_empty_user () {
+ $read_function_no_empty_user
+ if test -z "${user}"; then
+ exit 0
+ fi
}
-
diff --git a/gotrc-examples/readline b/gotrc-examples/readline
index e67078c..2c545a5 100644
--- a/gotrc-examples/readline
+++ b/gotrc-examples/readline
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,8 +25,6 @@
# line instead of erasing in order to get to the wanted possition.
-_read ()
-{
- read -e user
+_read () {
+ read -e user
}
-
diff --git a/gotrc-examples/revoke-access b/gotrc-examples/revoke-access
index e79b9fc..77558c6 100644
--- a/gotrc-examples/revoke-access
+++ b/gotrc-examples/revoke-access
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,10 +25,8 @@
display_function_revoke_access=$display_function
display_function=_display_revoke_access
-_display_revoke_access ()
-{
- chmod 640 "$(tty)"
- chown 0:0 "$(tty)"
- $display_function_revoke_access
+_display_revoke_access () {
+ chmod 640 "$(tty)"
+ chown 0:0 "$(tty)"
+ $display_function_revoke_access
}
-
diff --git a/info/gates-of-tartaros.texinfo b/info/gates-of-tartaros.texinfo
index 9d1af83..459fd9e 100644
--- a/info/gates-of-tartaros.texinfo
+++ b/info/gates-of-tartaros.texinfo
@@ -74,19 +74,19 @@ Texts. A copy of the license is included in the section entitled
@chapter Overview
Gates of Tartaros is a minimal, but extensible, replacement for
-agetty written in GNU Bash. The be key feature of Gates of Tartaros
-is that it lets you easily login to another computer with SSH.
-@c Hence the name Gates of Tartaros, in MLP Kerberos gaurds the
+agetty written in GNU Bash. The key feature of Gates of Tartaros
+is that it lets you easily log in to another computer with SSH.
+@c Hence the name Gates of Tartaros, in MLP Kerberos guards the
@c gates of Tartaros (rather than Hades), the place where the
-@c worst of pony kind gets after death, which in this analogy
+@c worst of pony kind ends up after death, which in this analogy
@c is where you are before SSH:ing. When SSH:ing, Kerberos
-@c (perhaps more specifically Heimdall) make sure you only get
+@c (perhaps more specifically Heimdall) makes sure you only get
@c in if you are authorised (getting in being getting out of
@c Tartaros.)
-To login when Gates of Tartaros is running, just type your
+To log in when Gates of Tartaros is running, just type your
username, but for an SSH session, type what you would type
-as the argments for @command{@value{SSH}}. Normal patterns
+as the arguments for @command{@value{SSH}}. Normal patterns
for SSH logins include:
@itemize
@@ -99,7 +99,7 @@ for SSH logins include:
@node Setting up
@chapter Setting up
-To set up your inittab to to use Gates of Tartaros instead
+To set up your inittab to use Gates of Tartaros instead
of @command{agetty}, in your inittab, use the command
@command{@value{SBIN}/@value{GOT}} with the first argument
being the tty it should open on (@code{tty1}, @code{tty2},
@@ -123,25 +123,25 @@ c6:345:respawn:@value{SBIN}/@value{GOT} tty6 TERM=linux
Extensions are loaded by Gates of Tartaros by sourcing
the file @file{@value{ETC}/@value{GOT}rc} if it exists.
@file{@value{ETC}/@value{GOT}rc} can change the behaviour
-of Gates of Tartaros or source other files that does so.
+of Gates of Tartaros or source other files that do so.
The variable @code{tty} will be set from the beginning
to the TTY file, without @code{@value{DEV}/}, for example
@code{tty1}.
-Gates of Tartaros as three functions is calls directly after
-each other: @code{_display} for printing everying you see,
-@code{_read} to accept username input and stores it in the
+Gates of Tartaros has three functions it calls directly after
+each other: @code{_display} for printing everything you see,
+@code{_read} to accept username input and store it in the
variable @code{user}, and then @code{_login} to start a
login. Password checking is handled by external programs
@command{@value{SSH}} and @command{login} that are used
-doing the actual user login. You either redefine these
+for doing the actual user login. You either redefine these
functions, or change the variables @code{display_function},
@code{read_function} or @code{login_function} to contain the
name of the functions you want to be called instead. The
-latter option can be used to extend rather then replace the
+latter option can be used to extend rather than replace the
predefined functions.
-The file @file{@value{ETC}/os-release} will have been sources
+The file @file{@value{ETC}/os-release} will have been sourced
before the extensions and @code{NAME} and @code{ANSI_COLOR}
will have fallback values. @code{NAME} is the name of
the operating system (distribution) and @code{ANSI_COLOR}
@@ -154,4 +154,3 @@ is its associated colour.
@include fdl.texinfo
@bye
-