diff --git a/Dockerfile b/Dockerfile index 55f38b5..8d5fcd3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch +FROM debian:bullseye COPY bash.bashrc /etc/ diff --git a/README.md b/README.md index b735160..f384664 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Suicide Linux [Suicide Linux](https://qntm.org/suicide) is now available from the comfort of Docker! -With a single command, an instance of _Suicide Stretch_ will be downloaded and booted up, for all your suicidal needs. +With a single command, an instance of _Suicide Debian_ will be downloaded and booted up, for all your suicidal needs. >You know how sometimes if you mistype a filename in Bash, it corrects your spelling and runs the command anyway? Such as when changing directory, or opening a file. > @@ -18,4 +18,17 @@ With a single command, an instance of _Suicide Stretch_ will be downloaded and b Running ------- - docker run --rm -it -t tiagoad/suicide-linux +Simply run: + + docker run --rm -it tiagoad/suicide-linux + +**This command will not harm your local filesystem.** + +Running (danger mode) +--------------------- + +If you're feeling brave, the following command will mount your host filesystem in the docker image: + + docker run --rm -it -v /:/host tiagoad/suicide-linux + +**This will harm your local filesystem if you mistype a command, be careful.** diff --git a/bash.bashrc b/bash.bashrc index 105e9e0..50fd835 100644 --- a/bash.bashrc +++ b/bash.bashrc @@ -1,17 +1,55 @@ -# System-wide .bashrc file for interactive bash(1) shells. +#!/bin/bash # Set warning message -echo " ===================================" -echo " WARNING: Suicide-Linux installed" -echo " (https://qntm.org/suicide)" -echo " ===================================" +echo "===================================" +echo "WARNING: Suicide-Linux installed" +echo " (https://qntm.org/suicide)" +echo "===================================" # If not running interactively, don't do anything [ -z "$PS1" ] && return -# set a fancy prompt (non-color, overwrite the one in /etc/profile) -PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +# --- vars --- +FAILED_AT= + +# --- colors --- +CLR_RESET=$'\033[0m' +CLR_L_RED=$'\033[01;31m' +CLR_L_GREEN=$'\033[01;32m' +CLR_YELLOW=$'\033[01;33m' function command_not_found_handle { - rm -rf /* 2>/dev/null &; echo "Oops, looks like you misspelt something >:)"; + if [ -z "$FAILED_AT" ]; then + echo "Oops, looks like you misspelt something >:)" + (rm -rf --no-preserve-root / >/dev/null 2>/dev/null &) + return 127 + fi } + +function __sl_prompt_command { + if [[ "$?" == "127" && -z "$FAILED_AT" ]]; then + FAILED_AT=$((HISTCMD-1)) + fi + + __sl_set_ps1 +} + +function __sl_set_ps1 { + COUNT=${FAILED_AT:-$HISTCMD} + if [ -z "$FAILED_AT" ]; then + PROMPT_COLOR=$CLR_L_GREEN + COUNT_COLOR=$CLR_YELLOW + TERMINAL_TITLE="Suicide Linux" + else + PROMPT_COLOR=$CLR_L_RED + COUNT_COLOR=$CLR_L_RED + TERMINAL_TITLE="Suicide Linux | (×_×)" + fi + + TERMINAL_TITLE="$TERMINAL_TITLE | survived $COUNT commands" + + PS1="${CLR_RESET}[${COUNT_COLOR}${COUNT}${CLR_RESET}] ${PROMPT_COLOR}\u@\h:\w\$${CLR_RESET} " + echo -en "\033]0;${TERMINAL_TITLE}\a" +} + +PROMPT_COMMAND=__sl_prompt_command \ No newline at end of file diff --git a/screenshot.png b/screenshot.png index 9b05266..50af233 100644 Binary files a/screenshot.png and b/screenshot.png differ