From 39711cf6c2ec5a3b4480dcb4800cc3802bda5bf2 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Fri, 20 Mar 2026 19:16:32 +0100 Subject: feat: first fully successful run e2e on straper --- straper/db/public/environment/profile | 34 +++++++ .../profile.d/70-systemd-shell-extra.sh | 25 +++++ .../environment/profile.d/bash_completion.sh | 16 +++ straper/db/public/environment/profile.d/gawk.csh | 11 ++ straper/db/public/environment/profile.d/gawk.sh | 31 ++++++ .../environment/zsh/newuser.zshrc.recommended | 37 +++++++ straper/db/public/environment/zsh/zlogin | 9 ++ straper/db/public/environment/zsh/zlogout | 1 + straper/db/public/environment/zsh/zprofile | 7 ++ straper/db/public/environment/zsh/zshenv | 18 ++++ straper/db/public/environment/zsh/zshrc | 113 +++++++++++++++++++++ 11 files changed, 302 insertions(+) create mode 100644 straper/db/public/environment/profile create mode 100644 straper/db/public/environment/profile.d/70-systemd-shell-extra.sh create mode 100644 straper/db/public/environment/profile.d/bash_completion.sh create mode 100644 straper/db/public/environment/profile.d/gawk.csh create mode 100644 straper/db/public/environment/profile.d/gawk.sh create mode 100644 straper/db/public/environment/zsh/newuser.zshrc.recommended create mode 100644 straper/db/public/environment/zsh/zlogin create mode 100644 straper/db/public/environment/zsh/zlogout create mode 100644 straper/db/public/environment/zsh/zprofile create mode 100644 straper/db/public/environment/zsh/zshenv create mode 100644 straper/db/public/environment/zsh/zshrc (limited to 'straper/db/public/environment') diff --git a/straper/db/public/environment/profile b/straper/db/public/environment/profile new file mode 100644 index 0000000..a897491 --- /dev/null +++ b/straper/db/public/environment/profile @@ -0,0 +1,34 @@ +# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) +# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). + +if [ "$(id -u)" -eq 0 ]; then + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +else + PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" +fi +export PATH + +if [ "${PS1-}" ]; then + if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then + # The file bash.bashrc already sets the default PS1. + # PS1='\h:\w\$ ' + if [ -f /etc/bash.bashrc ]; then + . /etc/bash.bashrc + fi + else + if [ "$(id -u)" -eq 0 ]; then + PS1='# ' + else + PS1='$ ' + fi + fi +fi + +if [ -d /etc/profile.d ]; then + for i in $(run-parts --list --regex '^[a-zA-Z0-9_][a-zA-Z0-9._-]*\.sh$' /etc/profile.d); do + if [ -r $i ]; then + . $i + fi + done + unset i +fi diff --git a/straper/db/public/environment/profile.d/70-systemd-shell-extra.sh b/straper/db/public/environment/profile.d/70-systemd-shell-extra.sh new file mode 100644 index 0000000..dae77e4 --- /dev/null +++ b/straper/db/public/environment/profile.d/70-systemd-shell-extra.sh @@ -0,0 +1,25 @@ +# shellcheck shell=sh + +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +# Import the additional shell prompt prefix and suffix strings into $PS1, and +# show the shell welcome string. These can be provisioned as system or service +# credentials shell.prompt.prefix, shell.prompt.suffix and shell.welcome, and +# are propagated into these environment variables by pam_systemd(8). + +if [ -n "${SHELL_PROMPT_PREFIX-}" ]; then + PS1="$SHELL_PROMPT_PREFIX$PS1" +fi + +if [ -n "${SHELL_PROMPT_SUFFIX-}" ]; then + PS1="$PS1$SHELL_PROMPT_SUFFIX" +fi + +if [ -n "${SHELL_WELCOME-}" ]; then + printf '%b\n' "$SHELL_WELCOME" +fi diff --git a/straper/db/public/environment/profile.d/bash_completion.sh b/straper/db/public/environment/profile.d/bash_completion.sh new file mode 100644 index 0000000..8c031cf --- /dev/null +++ b/straper/db/public/environment/profile.d/bash_completion.sh @@ -0,0 +1,16 @@ +# shellcheck shell=sh disable=SC1091,SC2166,SC2268,SC3028,SC3044,SC3054 +# Check for interactive bash and that we haven't already been sourced. +if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then + + # Check for recent enough version of bash. + if [ "${BASH_VERSINFO[0]}" -gt 4 ] || + [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then + [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && + . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" + if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then + # Source completion code. + . /usr/share/bash-completion/bash_completion + fi + fi + +fi diff --git a/straper/db/public/environment/profile.d/gawk.csh b/straper/db/public/environment/profile.d/gawk.csh new file mode 100644 index 0000000..583d5bc --- /dev/null +++ b/straper/db/public/environment/profile.d/gawk.csh @@ -0,0 +1,11 @@ +alias gawkpath_default 'unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`' + +alias gawkpath_prepend 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "\!*"":$AWKPATH"' + +alias gawkpath_append 'if (! $?AWKPATH) setenv AWKPATH ""; if ($AWKPATH == "") then; unsetenv AWKPATH; setenv AWKPATH `gawk -v x=AWKPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKPATH "$AWKPATH"":\!*"' + +alias gawklibpath_default 'unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`' + +alias gawklibpath_prepend 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "\!*"":$AWKLIBPATH"' + +alias gawklibpath_append 'if (! $?AWKLIBPATH) setenv AWKLIBPATH ""; if ($AWKLIBPATH == "") then; unsetenv AWKLIBPATH; setenv AWKLIBPATH `gawk -v x=AWKLIBPATH "BEGIN {print ENVIRON[x]}"`; endif; setenv AWKLIBPATH "$AWKLIBPATH"":\!*"' diff --git a/straper/db/public/environment/profile.d/gawk.sh b/straper/db/public/environment/profile.d/gawk.sh new file mode 100644 index 0000000..c35471f --- /dev/null +++ b/straper/db/public/environment/profile.d/gawk.sh @@ -0,0 +1,31 @@ +gawkpath_default () { + unset AWKPATH + export AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'` +} + +gawkpath_prepend () { + [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'` + export AWKPATH="$*:$AWKPATH" +} + +gawkpath_append () { + [ -z "$AWKPATH" ] && AWKPATH=`gawk 'BEGIN {print ENVIRON["AWKPATH"]}'` + export AWKPATH="$AWKPATH:$*" +} + +gawklibpath_default () { + unset AWKLIBPATH + export AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'` +} + +gawklibpath_prepend () { + [ -z "$AWKLIBPATH" ] && \ + AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'` + export AWKLIBPATH="$*:$AWKLIBPATH" +} + +gawklibpath_append () { + [ -z "$AWKLIBPATH" ] && \ + AWKLIBPATH=`gawk 'BEGIN {print ENVIRON["AWKLIBPATH"]}'` + export AWKLIBPATH="$AWKLIBPATH:$*" +} diff --git a/straper/db/public/environment/zsh/newuser.zshrc.recommended b/straper/db/public/environment/zsh/newuser.zshrc.recommended new file mode 100644 index 0000000..55be3ab --- /dev/null +++ b/straper/db/public/environment/zsh/newuser.zshrc.recommended @@ -0,0 +1,37 @@ +# Set up the prompt + +autoload -Uz promptinit +promptinit +prompt adam1 + +setopt histignorealldups sharehistory + +# Use emacs keybindings even if our EDITOR is set to vi +bindkey -e + +# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: +HISTSIZE=1000 +SAVEHIST=1000 +HISTFILE=~/.zsh_history + +# Use modern completion system +autoload -Uz compinit +compinit + +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _correct _approximate +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' menu select=2 +eval "$(dircolors -b)" +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' +zstyle ':completion:*' menu select=long +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true + +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' diff --git a/straper/db/public/environment/zsh/zlogin b/straper/db/public/environment/zsh/zlogin new file mode 100644 index 0000000..f6cd2f2 --- /dev/null +++ b/straper/db/public/environment/zsh/zlogin @@ -0,0 +1,9 @@ +# /etc/zsh/zlogin: system-wide .zlogin file for zsh(1). +# +# This file is sourced only for login shells. It +# should contain commands that should be executed only +# in login shells. It should be used to set the terminal +# type and run a series of external commands (fortune, +# msgs, from, etc.) +# +# Global Order: zshenv, zprofile, zshrc, zlogin diff --git a/straper/db/public/environment/zsh/zlogout b/straper/db/public/environment/zsh/zlogout new file mode 100644 index 0000000..22d842f --- /dev/null +++ b/straper/db/public/environment/zsh/zlogout @@ -0,0 +1 @@ +# /etc/zsh/zlogout: system-wide .zlogout file for zsh(1). diff --git a/straper/db/public/environment/zsh/zprofile b/straper/db/public/environment/zsh/zprofile new file mode 100644 index 0000000..09db6f5 --- /dev/null +++ b/straper/db/public/environment/zsh/zprofile @@ -0,0 +1,7 @@ +# /etc/zsh/zprofile: system-wide .zprofile file for zsh(1). +# +# This file is sourced only for login shells (i.e. shells +# invoked with "-" as the first character of argv[0], and +# shells invoked with the -l flag.) +# +# Global Order: zshenv, zprofile, zshrc, zlogin diff --git a/straper/db/public/environment/zsh/zshenv b/straper/db/public/environment/zsh/zshenv new file mode 100644 index 0000000..e2613c3 --- /dev/null +++ b/straper/db/public/environment/zsh/zshenv @@ -0,0 +1,18 @@ +# /etc/zsh/zshenv: system-wide .zshenv file for zsh(1). +# +# This file is sourced on all invocations of the shell. +# If the -f flag is present or if the NO_RCS option is +# set within this file, all other initialization files +# are skipped. +# +# This file should contain commands to set the command +# search path, plus other important environment variables. +# This file should not contain commands that produce +# output or assume the shell is attached to a tty. +# +# Global Order: zshenv, zprofile, zshrc, zlogin + +if [[ -z "$PATH" || "$PATH" == "/bin:/usr/bin" ]] +then + export PATH="/usr/local/bin:/usr/bin:/bin:/usr/games" +fi diff --git a/straper/db/public/environment/zsh/zshrc b/straper/db/public/environment/zsh/zshrc new file mode 100644 index 0000000..194f636 --- /dev/null +++ b/straper/db/public/environment/zsh/zshrc @@ -0,0 +1,113 @@ +# /etc/zsh/zshrc: system-wide .zshrc file for zsh(1). +# +# This file is sourced only for interactive shells. It +# should contain commands to set up aliases, functions, +# options, key bindings, etc. +# +# Global Order: zshenv, zprofile, zshrc, zlogin + +READNULLCMD=${PAGER:-/usr/bin/pager} + +# An array to note missing features to ease diagnosis in case of problems. +typeset -ga debian_missing_features + +if [[ -z "${DEBIAN_PREVENT_KEYBOARD_CHANGES-}" ]] && + [[ "$TERM" != 'emacs' ]] +then + + typeset -A key + key=( + BackSpace "${terminfo[kbs]}" + Home "${terminfo[khome]}" + End "${terminfo[kend]}" + Insert "${terminfo[kich1]}" + Delete "${terminfo[kdch1]}" + Up "${terminfo[kcuu1]}" + Down "${terminfo[kcud1]}" + Left "${terminfo[kcub1]}" + Right "${terminfo[kcuf1]}" + PageUp "${terminfo[kpp]}" + PageDown "${terminfo[knp]}" + ) + + function bind2maps () { + local i sequence widget + local -a maps + + while [[ "$1" != "--" ]]; do + maps+=( "$1" ) + shift + done + shift + + sequence="${key[$1]}" + widget="$2" + + [[ -z "$sequence" ]] && return 1 + + for i in "${maps[@]}"; do + bindkey -M "$i" "$sequence" "$widget" + done + } + + bind2maps emacs -- BackSpace backward-delete-char + bind2maps viins -- BackSpace vi-backward-delete-char + bind2maps vicmd -- BackSpace vi-backward-char + bind2maps emacs -- Home beginning-of-line + bind2maps viins vicmd -- Home vi-beginning-of-line + bind2maps emacs -- End end-of-line + bind2maps viins vicmd -- End vi-end-of-line + bind2maps emacs viins -- Insert overwrite-mode + bind2maps vicmd -- Insert vi-insert + bind2maps emacs -- Delete delete-char + bind2maps viins vicmd -- Delete vi-delete-char + bind2maps emacs viins vicmd -- Up up-line-or-history + bind2maps emacs viins vicmd -- Down down-line-or-history + bind2maps emacs -- Left backward-char + bind2maps viins vicmd -- Left vi-backward-char + bind2maps emacs -- Right forward-char + bind2maps viins vicmd -- Right vi-forward-char + + # Make sure the terminal is in application mode, when zle is + # active. Only then are the values from $terminfo valid. + if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init () { + emulate -L zsh + printf '%s' ${terminfo[smkx]} + } + function zle-line-finish () { + emulate -L zsh + printf '%s' ${terminfo[rmkx]} + } + zle -N zle-line-init + zle -N zle-line-finish + else + for i in {s,r}mkx; do + (( ${+terminfo[$i]} )) || debian_missing_features+=($i) + done + unset i + fi + + unfunction bind2maps + +fi # [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && [[ "$TERM" != 'emacs' ]] + +zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bin \ + /sbin \ + /bin \ + /usr/X11R6/bin + +(( ${+aliases[run-help]} )) && unalias run-help +autoload -Uz run-help + +# If you don't want compinit called here, place the line +# skip_global_compinit=1 +# in your $ZDOTDIR/.zshenv +if (( ${${(@f)"$(