From 93f21a947c3f9acfa914c4f370fca1cb9c85983b Mon Sep 17 00:00:00 2001 From: Jeremy Dubois Date: Fri, 7 Jan 2022 18:12:09 +0100 Subject: [PATCH] base: fix shell configuration, increase $HISTSIZE, and change history alias so it displays full history "set -A" options are for ksh only --- CHANGELOG | 2 ++ roles/base/files/kshrc | 28 ++++++++++++++++++++++++++++ roles/base/templates/profile.j2 | 31 +------------------------------ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9c91acd..58778f3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- base: fix shell configuration, increase $HISTSIZE, and change history alias so it displays full history + ### Removed ## [21.12] - 2021-12-17 diff --git a/roles/base/files/kshrc b/roles/base/files/kshrc index dffa3fb..ef4817a 100644 --- a/roles/base/files/kshrc +++ b/roles/base/files/kshrc @@ -1,5 +1,6 @@ alias vi='vim' sudo() { if [[ $# == "1" ]] && [[ $1 == "su" ]]; then command sudo -i; else command sudo "$@"; fi } +alias history="fc -l 0" ## # Caracterisation du shell @@ -15,3 +16,30 @@ bind '^[Oc'=forward-word bind '^[Od'=backward-word bind '^[^[[C'=forward-word bind '^[^[[D'=backward-word + +set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM +if [ $? = 0 ]; then + set -A complete_vmctl -- console load reload start stop reset status + set -A complete_vmctl_2 -- $(vmctl status | awk '!/NAME/{print $NF}') +fi +if [ -d ~/.password-store ]; then + PASS_LIST=$( + cd ~/.password-store + find . -type f -name \*.gpg | sed 's/^\.\///' | sed 's/\.gpg$//g' + ) + + set -A complete_pass -- $PASS_LIST -c generate edit insert git + set -A complete_pass_2 -- $PASS_LIST push +fi +PKG_LIST=$(ls -1 /var/db/pkg) +set -A complete_pkg_delete -- $PKG_LIST +set -A complete_pkg_info -- $PKG_LIST +set -A complete_rcctl_1 -- disable enable get ls order set reload check restart stop start +set -A complete_rcctl_2 -- $(ls /etc/rc.d) +set -A complete_signify_1 -- -C -G -S -V +set -A complete_signify_2 -- -q -p -x -c -m -t -z +set -A complete_signify_3 -- -p -x -c -m -t -z +set -A complete_make_1 -- install clean repackage reinstall +set -A complete_gpg2 -- --refresh --receive-keys --armor --clearsign --sign --list-key --decrypt --verify --detach-sig +set -A complete_git -- pull push mpull mpush status clone branch add rm checkout fetch show tag commit +set -A complete_ifconfig_1 -- $(ifconfig | grep ^[a-z] | cut -d: -f1) diff --git a/roles/base/templates/profile.j2 b/roles/base/templates/profile.j2 index 0d74d8a..b4aea4c 100644 --- a/roles/base/templates/profile.j2 +++ b/roles/base/templates/profile.j2 @@ -8,7 +8,7 @@ export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8" export PS1="\u@\h:\w\\$ " HISTFILE=$HOME/.histfile -export HISTSIZE=10000 +export HISTSIZE=100000 export HISTCONTROL='ignoredups:ignorespace' export TMOUT=36000 export PAGER=less @@ -27,32 +27,3 @@ case "$-" in fi ;; esac - -PKG_LIST=$(ls -1 /var/db/pkg) - -set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM -pgrep -q vmd -if [ $? = 0 ]; then - set -A complete_vmctl -- console load reload start stop reset status - set -A complete_vmctl_2 -- $(vmctl status | awk '!/NAME/{print $NF}') -fi -if [ -d ~/.password-store ]; then - PASS_LIST=$( - cd ~/.password-store - find . -type f -name \*.gpg | sed 's/^\.\///' | sed 's/\.gpg$//g' - ) - - set -A complete_pass -- $PASS_LIST -c generate edit insert git - set -A complete_pass_2 -- $PASS_LIST push -fi -set -A complete_pkg_delete -- $PKG_LIST -set -A complete_pkg_info -- $PKG_LIST -set -A complete_rcctl_1 -- disable enable get ls order set reload check restart stop start -set -A complete_rcctl_2 -- $(ls /etc/rc.d) -set -A complete_signify_1 -- -C -G -S -V -set -A complete_signify_2 -- -q -p -x -c -m -t -z -set -A complete_signify_3 -- -p -x -c -m -t -z -set -A complete_make_1 -- install clean repackage reinstall -set -A complete_gpg2 -- --refresh --receive-keys --armor --clearsign --sign --list-key --decrypt --verify --detach-sig -set -A complete_git -- pull push mpull mpush status clone branch add rm checkout fetch show tag commit -set -A complete_ifconfig_1 -- $(ifconfig | grep ^[a-z] | cut -d: -f1)