Relearning the shell nostalgia!
This commit is contained in:
commit
65cd33333e
|
@ -0,0 +1,14 @@
|
|||
====================
|
||||
FAKE - RELEARN - ENV
|
||||
====================
|
||||
|
||||
An artificial re-creation of the relearn environment we made. All the paths,
|
||||
guides and scripts are localised within this folder. We need this to take some
|
||||
screenshots for the Rigged Systems call.
|
||||
|
||||
Run:
|
||||
|
||||
$ bash # get into a fresh new shell (CTRL-D to escape later)
|
||||
$ source enter-the-shell.sh
|
||||
|
||||
And you'll be back in the friendly 'ol Relearn shell again.
|
|
@ -0,0 +1,250 @@
|
|||
preexec() {
|
||||
if [[ $RANDOM == 1 ]]
|
||||
then
|
||||
echo "CONGRATULATIONS!" | lolcat
|
||||
echo "You are today's winner of the bash-lottery." | lolcat
|
||||
fi
|
||||
|
||||
if [[ $1 == ls ]];
|
||||
then
|
||||
echo "I'll show you..."
|
||||
fi
|
||||
|
||||
if [[ $1 == time ]];
|
||||
then
|
||||
echo "time for beer!"
|
||||
fi
|
||||
|
||||
if [[ $1 == touch* ]];
|
||||
then
|
||||
echo "No touching!"
|
||||
fi
|
||||
|
||||
if [[ $1 == exit ]];
|
||||
then
|
||||
echo "you're stuck here… FOREVAAAAAA"
|
||||
sleep 2
|
||||
echo "just joking, do logout instead"
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == heyfriends ]];
|
||||
then
|
||||
who | grep -Eo '^[^ ]+'
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == hello* ]];
|
||||
then
|
||||
echo "Hi $USER! What's up?" | lolcat
|
||||
read mood
|
||||
if [[ $mood == *no* ]]
|
||||
then
|
||||
echo "Sorry to hear that, $USER. Anything I can do to help?" | lolcat
|
||||
read uselessanswer
|
||||
else
|
||||
echo "Glad to hear, keep up the good vibes!" | lolcat
|
||||
fi
|
||||
shopt -s extdebug #stops "hello" from executing, which would give a "command not found" error.
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == *apt-get* ]];
|
||||
then
|
||||
echo "Thank you $USER for your maintenance efforts! Our community really appreciates it" | lolcat
|
||||
fi
|
||||
|
||||
if [[ $1 == guide* ]];
|
||||
then
|
||||
split=($1)
|
||||
echo ${split[1]}
|
||||
man ./guides/${split[1]}.1
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == ssh* ]];
|
||||
then
|
||||
if [[ $(( ( RANDOM % 10 ) + 1 )) == 1 ]]
|
||||
then
|
||||
echo "Not today, maybe later..." | lolcat
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $1 == *adduser* ]];
|
||||
then
|
||||
inputcommand=($1)
|
||||
echo "What is your preferred pronoun?" | lolcat
|
||||
read answer
|
||||
if [[ $answer ]]
|
||||
then
|
||||
echo $answer > ${inputcommand[2]}pronoun.txt
|
||||
fi
|
||||
sudo adduser ${inputcommand[2]}
|
||||
sudo mv ${inputcommand[2]}pronoun.txt /home/${inputcommand[2]}/pronoun.txt
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == *reroaming* ]];
|
||||
then
|
||||
argument=($1)
|
||||
if [[ ${argument[1]} == howto ]];
|
||||
then
|
||||
man ./guides/howto.1
|
||||
fi
|
||||
if [[ ${argument[1]} == guide ]];
|
||||
then
|
||||
sed '/__PUBLISH__/d' ./guides/guide | fold | lolcat
|
||||
fi
|
||||
if [[ ${argument[1]} == why ]];
|
||||
then
|
||||
man ./guides/why.1
|
||||
fi
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
|
||||
fi
|
||||
|
||||
if [[ -e "tellme.txt" && $1 == *"tellme"* ]]
|
||||
then
|
||||
name="name called title"
|
||||
what="info explain folder what"
|
||||
why="why because"
|
||||
how="how instructions use"
|
||||
when="when time past history"
|
||||
who="who author creator owner user"
|
||||
|
||||
tell () {
|
||||
if [[ ${@:0:1} == "@" ]]
|
||||
then
|
||||
eval ${@:1:-1}
|
||||
else
|
||||
echo "$@" | pv -qL 128
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
captured_command=0
|
||||
|
||||
for per_word in $1; do
|
||||
if [[ $name == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#name' "tellme.txt" | grep -v "#name")
|
||||
captured_command=1
|
||||
break
|
||||
elif [[ $what == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#what' "tellme.txt" | grep -v "#what")
|
||||
captured_command=1
|
||||
break
|
||||
elif [[ $why == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#why' "tellme.txt" | grep -v "#why")
|
||||
captured_command=1
|
||||
break
|
||||
elif [[ $how == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#how' "tellme.txt" | grep -v "#how")
|
||||
captured_command=1
|
||||
break
|
||||
elif [[ $when == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#when' "tellme.txt" | grep -v "#when")
|
||||
captured_command=1
|
||||
break
|
||||
elif [[ $who == *"$per_word"* ]]
|
||||
then
|
||||
tell $(grep -A 2 '#who' "tellme.txt" | grep -v "#who")
|
||||
captured_command=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $captured_command == 1 ]]
|
||||
then
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $1 == *"explainthis"* ]]
|
||||
then
|
||||
|
||||
tell () {
|
||||
if [[ ${@:0:1} == "@" ]]
|
||||
then
|
||||
eval ${@:1:-1}
|
||||
else
|
||||
echo " "
|
||||
echo "$@" | pv -qL 128
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
tell "Thanks for taking the time to explain your work! I will ask you some questions about what you've done. You are free to leave questions unanswered."
|
||||
tell "What is your project or folder called?"
|
||||
read new_name
|
||||
tell "How would you describe your work in a short sentence?"
|
||||
read new_what
|
||||
tell "What's your name or nickname?"
|
||||
read new_who
|
||||
tell "When did you create this work?"
|
||||
read new_when
|
||||
tell "Why did you create this work?"
|
||||
read new_why
|
||||
tell "How did you create this work?"
|
||||
read new_how
|
||||
tell "Thanks, I'll document it! You can use the tellme command (tellme how, tellme why, etc) to query other folders."
|
||||
> tellme.txt
|
||||
echo "#name" >> tellme.txt
|
||||
echo $new_name >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
echo "#who" >> tellme.txt
|
||||
echo $new_who >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
echo "#what" >> tellme.txt
|
||||
echo $new_what >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
echo "#when" >> tellme.txt
|
||||
echo $new_when >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
echo "#why" >> tellme.txt
|
||||
echo $new_why >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
echo "#how" >> tellme.txt
|
||||
echo $new_how >> tellme.txt
|
||||
echo " " >> tellme.txt
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == tour ]];
|
||||
then
|
||||
echo "hello $USER, welcome to the filesystem tour" | lolcat
|
||||
echo ""
|
||||
echo '/\/\/\/\/\/\/\/\/\/\' | lolcat | pv -qL 8
|
||||
echo ""
|
||||
echo 'FIRST STOP!' | lolcat
|
||||
cd ~
|
||||
echo "This directory is your home directory. Cozy, isn't it?" | lolcat
|
||||
sleep 1
|
||||
echo "here's a picture of the landscape" | lolcat
|
||||
echo ""
|
||||
ls -la | lolcat
|
||||
echo ""
|
||||
shopt -s extdebug
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $1 == whereami ]];
|
||||
then
|
||||
echo "you are here, don't get lost :)"
|
||||
pwd
|
||||
shopt -s extdebug
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,329 @@
|
|||
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
|
||||
# https://github.com/rcaloras/bash-preexec
|
||||
#
|
||||
#
|
||||
# 'preexec' functions are executed before each interactive command is
|
||||
# executed, with the interactive command as its argument. The 'precmd'
|
||||
# function is executed before each prompt is displayed.
|
||||
#
|
||||
# Author: Ryan Caloras (ryan@bashhub.com)
|
||||
# Forked from Original Author: Glyph Lefkowitz
|
||||
#
|
||||
# V0.3.7
|
||||
#
|
||||
|
||||
# General Usage:
|
||||
#
|
||||
# 1. Source this file at the end of your bash profile so as not to interfere
|
||||
# with anything else that's using PROMPT_COMMAND.
|
||||
#
|
||||
# 2. Add any precmd or preexec functions by appending them to their arrays:
|
||||
# e.g.
|
||||
# precmd_functions+=(my_precmd_function)
|
||||
# precmd_functions+=(some_other_precmd_function)
|
||||
#
|
||||
# preexec_functions+=(my_preexec_function)
|
||||
#
|
||||
# 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND
|
||||
# to use preexec and precmd instead. Preexisting usages will be
|
||||
# preserved, but doing so manually may be less surprising.
|
||||
#
|
||||
# Note: This module requires two Bash features which you must not otherwise be
|
||||
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override
|
||||
# either of these after bash-preexec has been installed it will most likely break.
|
||||
|
||||
# Avoid duplicate inclusion
|
||||
if [[ "${__bp_imported:-}" == "defined" ]]; then
|
||||
return 0
|
||||
fi
|
||||
__bp_imported="defined"
|
||||
|
||||
# Should be available to each precmd and preexec
|
||||
# functions, should they want it. $? and $_ are available as $? and $_, but
|
||||
# $PIPESTATUS is available only in a copy, $BP_PIPESTATUS.
|
||||
# TODO: Figure out how to restore PIPESTATUS before each precmd or preexec
|
||||
# function.
|
||||
__bp_last_ret_value="$?"
|
||||
BP_PIPESTATUS=("${PIPESTATUS[@]}")
|
||||
__bp_last_argument_prev_command="$_"
|
||||
|
||||
__bp_inside_precmd=0
|
||||
__bp_inside_preexec=0
|
||||
|
||||
# Fails if any of the given variables are readonly
|
||||
# Reference https://stackoverflow.com/a/4441178
|
||||
__bp_require_not_readonly() {
|
||||
for var; do
|
||||
if ! ( unset "$var" 2> /dev/null ); then
|
||||
echo "bash-preexec requires write access to ${var}" >&2
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Remove ignorespace and or replace ignoreboth from HISTCONTROL
|
||||
# so we can accurately invoke preexec with a command from our
|
||||
# history even if it starts with a space.
|
||||
__bp_adjust_histcontrol() {
|
||||
local histcontrol
|
||||
histcontrol="${HISTCONTROL//ignorespace}"
|
||||
# Replace ignoreboth with ignoredups
|
||||
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
|
||||
histcontrol="ignoredups:${histcontrol//ignoreboth}"
|
||||
fi;
|
||||
export HISTCONTROL="$histcontrol"
|
||||
}
|
||||
|
||||
# This variable describes whether we are currently in "interactive mode";
|
||||
# i.e. whether this shell has just executed a prompt and is waiting for user
|
||||
# input. It documents whether the current command invoked by the trace hook is
|
||||
# run interactively by the user; it's set immediately after the prompt hook,
|
||||
# and unset as soon as the trace hook is run.
|
||||
__bp_preexec_interactive_mode=""
|
||||
|
||||
__bp_trim_whitespace() {
|
||||
local var=$@
|
||||
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||
echo -n "$var"
|
||||
}
|
||||
|
||||
# This function is installed as part of the PROMPT_COMMAND;
|
||||
# It sets a variable to indicate that the prompt was just displayed,
|
||||
# to allow the DEBUG trap to know that the next command is likely interactive.
|
||||
__bp_interactive_mode() {
|
||||
__bp_preexec_interactive_mode="on";
|
||||
}
|
||||
|
||||
|
||||
# This function is installed as part of the PROMPT_COMMAND.
|
||||
# It will invoke any functions defined in the precmd_functions array.
|
||||
__bp_precmd_invoke_cmd() {
|
||||
# Save the returned value from our last command, and from each process in
|
||||
# its pipeline. Note: this MUST be the first thing done in this function.
|
||||
__bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}")
|
||||
|
||||
# Don't invoke precmds if we are inside an execution of an "original
|
||||
# prompt command" by another precmd execution loop. This avoids infinite
|
||||
# recursion.
|
||||
if (( __bp_inside_precmd > 0 )); then
|
||||
return
|
||||
fi
|
||||
local __bp_inside_precmd=1
|
||||
|
||||
# Invoke every function defined in our function array.
|
||||
local precmd_function
|
||||
for precmd_function in "${precmd_functions[@]}"; do
|
||||
|
||||
# Only execute this function if it actually exists.
|
||||
# Test existence of functions with: declare -[Ff]
|
||||
if type -t "$precmd_function" 1>/dev/null; then
|
||||
__bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command"
|
||||
# Quote our function invocation to prevent issues with IFS
|
||||
"$precmd_function"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Sets a return value in $?. We may want to get access to the $? variable in our
|
||||
# precmd functions. This is available for instance in zsh. We can simulate it in bash
|
||||
# by setting the value here.
|
||||
__bp_set_ret_value() {
|
||||
return ${1:-}
|
||||
}
|
||||
|
||||
__bp_in_prompt_command() {
|
||||
|
||||
local prompt_command_array
|
||||
IFS=';' read -ra prompt_command_array <<< "$PROMPT_COMMAND"
|
||||
|
||||
local trimmed_arg
|
||||
trimmed_arg=$(__bp_trim_whitespace "${1:-}")
|
||||
|
||||
local command
|
||||
for command in "${prompt_command_array[@]:-}"; do
|
||||
local trimmed_command
|
||||
trimmed_command=$(__bp_trim_whitespace "$command")
|
||||
# Only execute each function if it actually exists.
|
||||
if [[ "$trimmed_command" == "$trimmed_arg" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# This function is installed as the DEBUG trap. It is invoked before each
|
||||
# interactive prompt display. Its purpose is to inspect the current
|
||||
# environment to attempt to detect if the current command is being invoked
|
||||
# interactively, and invoke 'preexec' if so.
|
||||
__bp_preexec_invoke_exec() {
|
||||
# Save the contents of $_ so that it can be restored later on.
|
||||
# https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702
|
||||
__bp_last_argument_prev_command="${1:-}"
|
||||
# Don't invoke preexecs if we are inside of another preexec.
|
||||
if (( __bp_inside_preexec > 0 )); then
|
||||
return
|
||||
fi
|
||||
local __bp_inside_preexec=1
|
||||
|
||||
# Checks if the file descriptor is not standard out (i.e. '1')
|
||||
# __bp_delay_install checks if we're in test. Needed for bats to run.
|
||||
# Prevents preexec from being invoked for functions in PS1
|
||||
if [[ ! -t 1 && -z "${__bp_delay_install:-}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -n "${COMP_LINE:-}" ]]; then
|
||||
# We're in the middle of a completer. This obviously can't be
|
||||
# an interactively issued command.
|
||||
return
|
||||
fi
|
||||
if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then
|
||||
# We're doing something related to displaying the prompt. Let the
|
||||
# prompt set the title instead of me.
|
||||
return
|
||||
else
|
||||
# If we're in a subshell, then the prompt won't be re-displayed to put
|
||||
# us back into interactive mode, so let's not set the variable back.
|
||||
# In other words, if you have a subshell like
|
||||
# (sleep 1; sleep 2)
|
||||
# You want to see the 'sleep 2' as a set_command_title as well.
|
||||
if [[ 0 -eq "${BASH_SUBSHELL:-}" ]]; then
|
||||
__bp_preexec_interactive_mode=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if __bp_in_prompt_command "${BASH_COMMAND:-}"; then
|
||||
# If we're executing something inside our prompt_command then we don't
|
||||
# want to call preexec. Bash prior to 3.1 can't detect this at all :/
|
||||
__bp_preexec_interactive_mode=""
|
||||
return
|
||||
fi
|
||||
|
||||
local this_command
|
||||
this_command=$(
|
||||
export LC_ALL=C
|
||||
HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //'
|
||||
)
|
||||
|
||||
# Sanity check to make sure we have something to invoke our function with.
|
||||
if [[ -z "$this_command" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If none of the previous checks have returned out of this function, then
|
||||
# the command is in fact interactive and we should invoke the user's
|
||||
# preexec functions.
|
||||
|
||||
# Invoke every function defined in our function array.
|
||||
local preexec_function
|
||||
local preexec_function_ret_value
|
||||
local preexec_ret_value=0
|
||||
for preexec_function in "${preexec_functions[@]:-}"; do
|
||||
|
||||
# Only execute each function if it actually exists.
|
||||
# Test existence of function with: declare -[fF]
|
||||
if type -t "$preexec_function" 1>/dev/null; then
|
||||
__bp_set_ret_value ${__bp_last_ret_value:-}
|
||||
# Quote our function invocation to prevent issues with IFS
|
||||
"$preexec_function" "$this_command"
|
||||
preexec_function_ret_value="$?"
|
||||
if [[ "$preexec_function_ret_value" != 0 ]]; then
|
||||
preexec_ret_value="$preexec_function_ret_value"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Restore the last argument of the last executed command, and set the return
|
||||
# value of the DEBUG trap to be the return code of the last preexec function
|
||||
# to return an error.
|
||||
# If `extdebug` is enabled a non-zero return value from any preexec function
|
||||
# will cause the user's command not to execute.
|
||||
# Run `shopt -s extdebug` to enable
|
||||
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
|
||||
}
|
||||
|
||||
__bp_install() {
|
||||
# Exit if we already have this installed.
|
||||
if [[ "${PROMPT_COMMAND:-}" == *"__bp_precmd_invoke_cmd"* ]]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
trap '__bp_preexec_invoke_exec "$_"' DEBUG
|
||||
|
||||
# Preserve any prior DEBUG trap as a preexec function
|
||||
local prior_trap=$(sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}")
|
||||
unset __bp_trap_string
|
||||
if [[ -n "$prior_trap" ]]; then
|
||||
eval '__bp_original_debug_trap() {
|
||||
'"$prior_trap"'
|
||||
}'
|
||||
preexec_functions+=(__bp_original_debug_trap)
|
||||
fi
|
||||
|
||||
# Adjust our HISTCONTROL Variable if needed.
|
||||
__bp_adjust_histcontrol
|
||||
|
||||
|
||||
# Issue #25. Setting debug trap for subshells causes sessions to exit for
|
||||
# backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash.
|
||||
#
|
||||
# Disabling this by default. It can be enabled by setting this variable.
|
||||
if [[ -n "${__bp_enable_subshells:-}" ]]; then
|
||||
|
||||
# Set so debug trap will work be invoked in subshells.
|
||||
set -o functrace > /dev/null 2>&1
|
||||
shopt -s extdebug > /dev/null 2>&1
|
||||
fi;
|
||||
|
||||
# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
|
||||
# actually entered something.
|
||||
PROMPT_COMMAND="__bp_precmd_invoke_cmd; __bp_interactive_mode"
|
||||
|
||||
# Add two functions to our arrays for convenience
|
||||
# of definition.
|
||||
precmd_functions+=(precmd)
|
||||
preexec_functions+=(preexec)
|
||||
|
||||
# Since this function is invoked via PROMPT_COMMAND, re-execute PC now that it's properly set
|
||||
eval "$PROMPT_COMMAND"
|
||||
}
|
||||
|
||||
# Sets our trap and __bp_install as part of our PROMPT_COMMAND to install
|
||||
# after our session has started. This allows bash-preexec to be included
|
||||
# at any point in our bash profile. Ideally we could set our trap inside
|
||||
# __bp_install, but if a trap already exists it'll only set locally to
|
||||
# the function.
|
||||
__bp_install_after_session_init() {
|
||||
|
||||
# Make sure this is bash that's running this and return otherwise.
|
||||
if [[ -z "${BASH_VERSION:-}" ]]; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
# bash-preexec needs to modify these variables in order to work correctly
|
||||
# if it can't, just stop the installation
|
||||
__bp_require_not_readonly PROMPT_COMMAND HISTCONTROL HISTTIMEFORMAT || return
|
||||
|
||||
# If there's an existing PROMPT_COMMAND capture it and convert it into a function
|
||||
# So it is preserved and invoked during precmd.
|
||||
if [[ -n "$PROMPT_COMMAND" ]]; then
|
||||
eval '__bp_original_prompt_command() {
|
||||
'"$PROMPT_COMMAND"'
|
||||
}'
|
||||
precmd_functions+=(__bp_original_prompt_command)
|
||||
fi
|
||||
|
||||
# Installation is finalized in PROMPT_COMMAND, which allows us to override the DEBUG
|
||||
# trap. __bp_install sets PROMPT_COMMAND to its final value, so these are only
|
||||
# invoked once.
|
||||
# It's necessary to clear any existing DEBUG trap in order to set it from the install function.
|
||||
# Using \n as it's the most universal delimiter of bash commands
|
||||
PROMPT_COMMAND=$'\n__bp_trap_string="$(trap -p DEBUG)"\ntrap DEBUG\n__bp_install\n'
|
||||
}
|
||||
|
||||
# Run our install so long as we're not delaying it.
|
||||
if [[ -z "$__bp_delay_install" ]]; then
|
||||
__bp_install_after_session_init
|
||||
fi;
|
|
@ -0,0 +1,19 @@
|
|||
#! /bin/bash
|
||||
|
||||
source ./bash-preexec.sh
|
||||
source ./bash-hooks.sh
|
||||
|
||||
echo ""
|
||||
echo "Welcome to the Relearn Roaming Server!"
|
||||
echo ""
|
||||
echo "Strongly inspired by the Feminist Server Manifesto (https://areyoubeingserved.constantvzw.org/Summit_afterlife.xhtml)"
|
||||
echo "some members of the Relearn community met and discussed how this could practically manifest when interacting with the"
|
||||
echo "server. Based on these discussions, some default programs and functions were modified accordingly, and others were added."
|
||||
echo ""
|
||||
echo "To read more about:"
|
||||
echo ""
|
||||
echo " * these programs and how to use them, run 'reroaming guide'"
|
||||
echo " * how to modify them and write your own, run 'reroaming howto'"
|
||||
echo " * the principles behind these modifications, run 'reroaming why'"
|
||||
echo ""
|
||||
echo ""
|
|
@ -0,0 +1,2 @@
|
|||
generate:
|
||||
@asciidoctor -b manpage *.adoc
|
|
@ -0,0 +1,3 @@
|
|||
# guides
|
||||
|
||||
All the guides we wrote during relearn.
|
|
@ -0,0 +1,213 @@
|
|||
__PUBLISH__
|
||||
|
||||
RELEARN SERVER HOOKS EXPLAINED
|
||||
|
||||
Additional or modified commands available on this server.
|
||||
Not all of these are finished or even useful, but they can be altered (carefully) from the hooks etherpad.
|
||||
Keep in mind this is loaded for every user using the terminal! The hooks etherpad also has some example commands commented at the top of the file.
|
||||
If you make any new commands, please add them to the guide here!
|
||||
http://relearn.local:9001/p/hooks
|
||||
|
||||
|
||||
$reroaming
|
||||
---------------------------------
|
||||
|
||||
Our very own reroaming command! Can be used to access a variety of documents to help newcomers to the server.
|
||||
|
||||
Example usage:
|
||||
|
||||
reroaming howto
|
||||
reroaming guide
|
||||
reroaming why
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$tellme
|
||||
---------------------------------
|
||||
|
||||
Use tellme in a folder that has a tellme.txt to ask questions regarding it's content.
|
||||
The tellme command taks up some slack: "Tellme what this is about" or "tellme the author of this folder" will also work, as most other questions.
|
||||
|
||||
Example usage:
|
||||
|
||||
tellme name
|
||||
tellme what
|
||||
tellme who
|
||||
tellme why
|
||||
tellme how
|
||||
tellme when
|
||||
|
||||
Which will then answer your query.
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$explainthis
|
||||
---------------------------------
|
||||
|
||||
If you'd like to document your work, use the command "explainthis" in the folder you've stored your work.
|
||||
This command will trigger a prompt that will ask you some questions about your work: How it was made, why, when, etcetera.
|
||||
This is then stored as a tellme.txt inside the folder for either manual reading or the tellme command.
|
||||
|
||||
Example usage:
|
||||
|
||||
explainthis
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$tour
|
||||
---------------------------------
|
||||
|
||||
Why not take a small tour of the server? Use the tour command to hop onto the server-train and visit some places!
|
||||
|
||||
Example usage:
|
||||
|
||||
tour
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$adduser
|
||||
---------------------------------
|
||||
|
||||
The classic adduser command has been modified to ask for the user's pronoun when registering. This is saved as a pronoun.txt in the new user's home folder.
|
||||
|
||||
Example usage:
|
||||
|
||||
sudo adduser NEWUSER
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$heyfriends
|
||||
---------------------------------
|
||||
|
||||
Shows all your friends! Lists the users currently logged into the server.
|
||||
|
||||
Example usage:
|
||||
|
||||
heyfriends
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$lottery
|
||||
---------------------------------
|
||||
|
||||
There is a bash lottery running on the relearn server.
|
||||
Everytime you enter any command in the terminal, you have a one in 100,000 chance of winning the lottery.
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$hello
|
||||
---------------------------------
|
||||
|
||||
Have a little chat with your server! Why not start by saying hello?
|
||||
|
||||
Example usage:
|
||||
|
||||
hello server!
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$time
|
||||
---------------------------------
|
||||
|
||||
When using the time command, it will not only reply with it's normal follow-up but also let you know what it's time 'for'.
|
||||
|
||||
Example usage:
|
||||
|
||||
time
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$touch
|
||||
---------------------------------
|
||||
|
||||
When trying to touch something, you can't touch this.
|
||||
|
||||
Example usage:
|
||||
|
||||
touch something
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$apt-get
|
||||
---------------------------------
|
||||
|
||||
When installing or updating the server, you are dearly thanked for you!
|
||||
|
||||
Example usage:
|
||||
|
||||
apt-get update
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$guide
|
||||
---------------------------------
|
||||
|
||||
Why use the sexist man command when you have the guide command? It'll open guides made for relearn stored in /opt/guides
|
||||
|
||||
Example usage:
|
||||
|
||||
guide howto
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$ssh
|
||||
---------------------------------
|
||||
|
||||
When trying to ssh while already logged into the relearn server, there's a small chance the server is not up for your sshing.
|
||||
|
||||
Example usage:
|
||||
|
||||
ssh something@something.com
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$stone_castle_room
|
||||
---------------------------------
|
||||
|
||||
A secret stone_castle_room in the home folder holds some special content. Why not LS to see what's there? Don't take the key please!
|
||||
|
||||
Example usage:
|
||||
|
||||
cd /home/stone_castle_room
|
||||
ls
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$exit
|
||||
---------------------------------
|
||||
|
||||
Exit tricks you into thinking you're stuck, but instead it simply forces you to use logout instead.
|
||||
A multitude of ways are possible to do the same things on servers, by blocking a commonly used one we can promote the use of others.
|
||||
|
||||
Example usage:
|
||||
|
||||
exit
|
||||
|
||||
---------------------------------
|
||||
|
||||
|
||||
$whereami
|
||||
---------------------------------
|
||||
|
||||
The whereami reminds you of you current presence and not to get lost!
|
||||
|
||||
Example usage:
|
||||
|
||||
whereami
|
||||
|
||||
---------------------------------
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
'\" t
|
||||
.\" Title: howto
|
||||
.\" Author: Relearn Roaming Communities
|
||||
.\" Generator: Asciidoctor 1.5.4
|
||||
.\" Date: 2019-06-23
|
||||
.\" Manual: Relearn Roaming Server Howto
|
||||
.\" Source: Relearn Roaming Server Howto 1.0.0
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "HOWTO" "1" "2019-06-23" "Relearn Roaming Server Howto 1.0.0" "Relearn Roaming Server Howto"
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.ss \n[.ss] 0
|
||||
.nh
|
||||
.ad l
|
||||
.de URL
|
||||
\\$2 \(laURL: \\$1 \(ra\\$3
|
||||
..
|
||||
.if \n[.g] .mso www.tmac
|
||||
.LINKSTYLE blue R < >
|
||||
.SH "NAME"
|
||||
howto \- the short story about how we propose to relearn the shell environment.
|
||||
.SH "RELEARNING THE SHELL ENVIRONMENT"
|
||||
.sp
|
||||
In order to provide a more friendly and expressive shell environment for the
|
||||
users of this feminist server, we propose to intervene within the workings of
|
||||
Bash.
|
||||
.sp
|
||||
Bash loads the /etc/profile fill everytime it is invoked. This provides a way
|
||||
for us to intervene. Every time a user enters the server via the SSH command, a
|
||||
Bash session is invoked.
|
||||
.sp
|
||||
We therefore create two pads:
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
http://relearn.local/etherdump/publish/bash\-pre\-exec
|
||||
http://relearn.local/etherdump/publish/hooks
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.sp
|
||||
We include the "\fIPUBLISH\fP" keyword on these pads which triggers
|
||||
the Etherdump program which converts the pad to multiple formats and
|
||||
stores them in the /var/www/html/etherdump/publish/.
|
||||
.sp
|
||||
The "bash\-pre\-exec" pad allows Bash to load our interventions which are described
|
||||
in the "hooks" pad. We then load these within the default /etc/profile file with:
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
cp /var/www/html/etherdump/publish/hooks /opt/hooks
|
||||
cp /var/www/html/etherdump/publish/bash\-pre\-exec /opt/hooks/bash\-pre\-exec
|
||||
source /opt/hooks/bash\-pre\-exec
|
||||
source /opt/hooks/hooks
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.sp
|
||||
At this point, the interventions that we define within the "hooks" pad, will be
|
||||
invoked in the Bash session of every user on the system. This provides a new
|
||||
way to relearn the shell environment.
|
||||
.SH "ETHERDUMP"
|
||||
.sp
|
||||
This pad is locally available at the following pad:
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
http://relearn.local:9001/p/howto
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.sp
|
||||
We use the following "Magic Word" to publish this pad with etherdump:
|
||||
.SH "AUTHOR(S)"
|
||||
.sp
|
||||
\fBRelearn Roaming Communities\fP
|
||||
.RS 4
|
||||
Author(s).
|
||||
.RE
|
|
@ -0,0 +1,51 @@
|
|||
= howto (1)
|
||||
Relearn Roaming Communities
|
||||
:release-version: 1.0.0
|
||||
:doctype: manpage
|
||||
:manmanual: Relearn Roaming Server Howto
|
||||
:mansource: Relearn Roaming Server Howto {release-version}
|
||||
|
||||
== NAME
|
||||
|
||||
howto - the short story about how we propose to relearn the shell environment.
|
||||
|
||||
== RELEARNING THE SHELL ENVIRONMENT
|
||||
|
||||
In order to provide a more friendly and expressive shell environment for the
|
||||
users of this feminist server, we propose to intervene within the workings of
|
||||
Bash.
|
||||
|
||||
Bash loads the /etc/profile fill everytime it is invoked. This provides a way
|
||||
for us to intervene. Every time a user enters the server via the SSH command, a
|
||||
Bash session is invoked.
|
||||
|
||||
We therefore create two pads:
|
||||
|
||||
http://relearn.local/etherdump/publish/bash-pre-exec
|
||||
http://relearn.local/etherdump/publish/hooks
|
||||
|
||||
We include the "__PUBLISH__" keyword on these pads which triggers
|
||||
the Etherdump program which converts the pad to multiple formats and
|
||||
stores them in the /var/www/html/etherdump/publish/.
|
||||
|
||||
The "bash-pre-exec" pad allows Bash to load our interventions which are described
|
||||
in the "hooks" pad. We then load these within the default /etc/profile file with:
|
||||
|
||||
cp /var/www/html/etherdump/publish/hooks /opt/hooks
|
||||
cp /var/www/html/etherdump/publish/bash-pre-exec /opt/hooks/bash-pre-exec
|
||||
source /opt/hooks/bash-pre-exec
|
||||
source /opt/hooks/hooks
|
||||
|
||||
At this point, the interventions that we define within the "hooks" pad, will be
|
||||
invoked in the Bash session of every user on the system. This provides a new
|
||||
way to relearn the shell environment.
|
||||
|
||||
== ETHERDUMP
|
||||
|
||||
This pad is locally available at the following pad:
|
||||
|
||||
http://relearn.local:9001/p/howto
|
||||
|
||||
We use the following "Magic Word" to publish this pad with etherdump:
|
||||
|
||||
// __PUBLISH__
|
|
@ -0,0 +1,149 @@
|
|||
'\" t
|
||||
.\" Title: why
|
||||
.\" Author: Relearn Roaming Communities
|
||||
.\" Generator: Asciidoctor 1.5.4
|
||||
.\" Date: 2019-06-23
|
||||
.\" Manual: Relearn Roaming Server Why
|
||||
.\" Source: Relearn Roaming Server Why 1.0.0
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "WHY" "1" "2019-06-23" "Relearn Roaming Server Why 1.0.0" "Relearn Roaming Server Why"
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.ss \n[.ss] 0
|
||||
.nh
|
||||
.ad l
|
||||
.de URL
|
||||
\\$2 \(laURL: \\$1 \(ra\\$3
|
||||
..
|
||||
.if \n[.g] .mso www.tmac
|
||||
.LINKSTYLE blue R < >
|
||||
.SH "NAME"
|
||||
why \- the short story about why we propose to relearn the shell environment.
|
||||
.SH "FEMINIZING THE SHELL ENVIRONMENT"
|
||||
.sp
|
||||
Welcome to the Relearn Roaming Server!
|
||||
.sp
|
||||
Strongly inspired by the Feminist Server Manifesto, some members of the Relearn
|
||||
community met and discussed how this could practically manifest when
|
||||
interacting with the server.
|
||||
.sp
|
||||
Some of the questions raised during this discussion inquired into the
|
||||
possibilities of:
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Leveling the playing field of participation, either by providing alternatives
|
||||
for connecting with the server (other than the shell) or by fostering user
|
||||
comfort with trial and error through the display of encouraging messages when
|
||||
mistakes occur;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Acknowledging care and maintenance work (often rendered invisible), either by
|
||||
directly thanking the user performing these functions or by keeping an
|
||||
acknowledgment log of the caretakers;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Introducing the voice of the community behind the server, e.g. by rethinking
|
||||
the form of the manual file, often terse and dry, and allowing it to be
|
||||
rewritten to better reflect the ideals and goals of this community;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Rethinking user self\-representation by, among others, allowing them to choose
|
||||
their preferred pronouns when a new user account is created;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Facilitating server exploration by introducing ways to playfully become
|
||||
acquainted with the file system and the inner workings of the server, while
|
||||
avoiding confusion between accessibility and obfuscation/abstraction;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Questioning persistent availability and re\-introducing materiality by, for
|
||||
example, allowing the server to have downtime when overheated and properly
|
||||
signaling it to the users;
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
Recontextualizing the server within its surroundings, either by mapping the
|
||||
wider network of dependencies or by emphasizing the "roaming" in roaming
|
||||
server in a diary file: Where did the server come from? Where will it go?
|
||||
Whom did he/she/they meet? How did that change her/him/them?
|
||||
.RE
|
||||
.sp
|
||||
While all of these and more ideas didn\(cqt have enough time to be implemented in
|
||||
their entirety during the Relearn session in Rotterdam, they will hopefully
|
||||
inspire other creative explorations around what it means to access, maintan and
|
||||
care for a Feminist Server.
|
||||
.sp
|
||||
By seemingly providing the server with a more active voice, the goal is, rather
|
||||
than anthropomorphizing the server, having this voice be a living documentation
|
||||
of the community around it, changing and evolving accordingly along the curve.
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
// __PUBLISH__
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.SH "AUTHOR(S)"
|
||||
.sp
|
||||
\fBRelearn Roaming Communities\fP
|
||||
.RS 4
|
||||
Author(s).
|
||||
.RE
|
|
@ -0,0 +1,61 @@
|
|||
= why (1)
|
||||
Relearn Roaming Communities
|
||||
:release-version: 1.0.0
|
||||
:doctype: manpage
|
||||
:manmanual: Relearn Roaming Server Why
|
||||
:mansource: Relearn Roaming Server Why {release-version}
|
||||
|
||||
== NAME
|
||||
|
||||
why - the short story about why we propose to relearn the shell environment.
|
||||
|
||||
== FEMINIZING THE SHELL ENVIRONMENT
|
||||
|
||||
Welcome to the Relearn Roaming Server!
|
||||
|
||||
Strongly inspired by the Feminist Server Manifesto, some members of the Relearn
|
||||
community met and discussed how this could practically manifest when
|
||||
interacting with the server.
|
||||
|
||||
Some of the questions raised during this discussion inquired into the
|
||||
possibilities of:
|
||||
|
||||
* Leveling the playing field of participation, either by providing alternatives
|
||||
for connecting with the server (other than the shell) or by fostering user
|
||||
comfort with trial and error through the display of encouraging messages when
|
||||
mistakes occur;
|
||||
|
||||
* Acknowledging care and maintenance work (often rendered invisible), either by
|
||||
directly thanking the user performing these functions or by keeping an
|
||||
acknowledgment log of the caretakers;
|
||||
|
||||
* Introducing the voice of the community behind the server, e.g. by rethinking
|
||||
the form of the manual file, often terse and dry, and allowing it to be
|
||||
rewritten to better reflect the ideals and goals of this community;
|
||||
|
||||
* Rethinking user self-representation by, among others, allowing them to choose
|
||||
their preferred pronouns when a new user account is created;
|
||||
|
||||
* Facilitating server exploration by introducing ways to playfully become
|
||||
acquainted with the file system and the inner workings of the server, while
|
||||
avoiding confusion between accessibility and obfuscation/abstraction;
|
||||
|
||||
* Questioning persistent availability and re-introducing materiality by, for
|
||||
example, allowing the server to have downtime when overheated and properly
|
||||
signaling it to the users;
|
||||
|
||||
* Recontextualizing the server within its surroundings, either by mapping the
|
||||
wider network of dependencies or by emphasizing the "roaming" in roaming
|
||||
server in a diary file: Where did the server come from? Where will it go?
|
||||
Whom did he/she/they meet? How did that change her/him/them?
|
||||
|
||||
While all of these and more ideas didn't have enough time to be implemented in
|
||||
their entirety during the Relearn session in Rotterdam, they will hopefully
|
||||
inspire other creative explorations around what it means to access, maintan and
|
||||
care for a Feminist Server.
|
||||
|
||||
By seemingly providing the server with a more active voice, the goal is, rather
|
||||
than anthropomorphizing the server, having this voice be a living documentation
|
||||
of the community around it, changing and evolving accordingly along the curve.
|
||||
|
||||
// __PUBLISH__
|
Loading…
Reference in New Issue