From 493495a1fbe55dfae1a988a115c2a3ed9b6eaa4c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 30 Sep 2013 07:36:48 +0200 Subject: add another example rc file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 13 +++++++++++-- README | 4 ---- gotrc | 21 --------------------- gotrc-examples/allow-uppercase | 17 +++++++++++++++++ gotrc-examples/lower-left-ponysay | 21 +++++++++++++++++++++ 5 files changed, 49 insertions(+), 27 deletions(-) delete mode 100644 gotrc create mode 100644 gotrc-examples/allow-uppercase create mode 100644 gotrc-examples/lower-left-ponysay diff --git a/Makefile b/Makefile index 2d9c015..555021f 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ SSH = ssh BASH_SHEBANG = /usr/bin/env bash +EXAMPLES = lower-left-ponysay allow-uppercase + .PHONY: all @@ -60,13 +62,20 @@ got-cmd.install: got-cmd install: install-cmd install-doc .PHONY: install-cmd -install-cmd: got.install got-cmd.install +install-cmd: install-core + +.PHONY: install-core install-examples +install-core: got.install got-cmd.install install -Dm755 -- "got.install" "$(DESTDIR)$(PREFIX)$(SBIN)/got" install -Dm755 -- "got-cmd.install" "$(DESTDIR)$(PREFIX)$(BIN)/got-cmd" - install -Dm644 -- "gotrc" "$(DESTDIR)$(SYSCONF)/gotrc.examples/lower-left-ponysay" install -d -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)" install -m644 -- 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" + .PHONY: install-doc install-doc: install-info diff --git a/README b/README index f6d7d33..ae1532a 100644 --- a/README +++ b/README @@ -1,10 +1,6 @@ Minimal replacement for agetty written in GNU Bash with support for remote SSH login. -An example /etc/gotrc file is included, -it requires ponysay, util-say and KMS -support, and prints a random pony. - To log in with over SSH type: user@host or diff --git a/gotrc b/gotrc deleted file mode 100644 index 563790d..0000000 --- a/gotrc +++ /dev/null @@ -1,21 +0,0 @@ -# -*- shell-script -*- - -# This requires KMS support and that the packages ponysay and util-say are installed. -# It will print a random pony (not speech bubble) in the lower left corner of the screen, -# as well as set a nice palette to the TTY and set up to use block cursor. - - -function _display -{ - PALETTE=$'\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\e[?8c' - pony="$(PONYSAY_SHELL_LINES=5 PONYSAY_KMS_PALETTE="${PALETTE}" ponysay -o <&2)" - lines=$(wc -l <<< "${pony}") - height=$(stty size | cut -d ' ' -f 1) - echo -n $'\e['"$(( $height - $lines + 1 ));1H$(sed -e 's:\x1b\[H\x1b\[2J::' <<< "${pony}")${PALETTE}"$'\e[H' - echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m" - echo - echo -n 'Login: ' -} - diff --git a/gotrc-examples/allow-uppercase b/gotrc-examples/allow-uppercase new file mode 100644 index 0000000..858fee0 --- /dev/null +++ b/gotrc-examples/allow-uppercase @@ -0,0 +1,17 @@ +# -*- shell-script -*- + + +read_function_allow_uppercase=$read_function +read_function=_read_allow_uppercase + +function _read_allow_uppercase +{ + $read_function_allow_uppercase + lower="$(sed -e 'y/QWERTYUIOPASDFGHJKLZXCVBNM/qwertyuiopasdfghjklzxcvbnm' <<< "${user}")" + 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/lower-left-ponysay b/gotrc-examples/lower-left-ponysay new file mode 100644 index 0000000..563790d --- /dev/null +++ b/gotrc-examples/lower-left-ponysay @@ -0,0 +1,21 @@ +# -*- shell-script -*- + +# This requires KMS support and that the packages ponysay and util-say are installed. +# It will print a random pony (not speech bubble) in the lower left corner of the screen, +# as well as set a nice palette to the TTY and set up to use block cursor. + + +function _display +{ + PALETTE=$'\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\e[?8c' + pony="$(PONYSAY_SHELL_LINES=5 PONYSAY_KMS_PALETTE="${PALETTE}" ponysay -o <&2)" + lines=$(wc -l <<< "${pony}") + height=$(stty size | cut -d ' ' -f 1) + echo -n $'\e['"$(( $height - $lines + 1 ));1H$(sed -e 's:\x1b\[H\x1b\[2J::' <<< "${pony}")${PALETTE}"$'\e[H' + echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m" + echo + echo -n 'Login: ' +} + -- cgit v1.2.3-70-g09d2