Skip to content

Commit

Permalink
Bugfix and features:
Browse files Browse the repository at this point in the history
- Update to debian bullseye
- Fix bashrc syntax error
- Add successful command counter to prompt and window title
- Add host volume mode to README

I want to thank everyone who opened PRs during the last few years, which I regretably left unanswered. I never thought this low-effort joke repo would be my most starred one by far.
I hope this change resolves every in-scope issue. Cheers everyone!

Thanks: @itspluxstahre @firatkucuk @stormvansoldt @vdavy @fldu @ethi0 @Freddson @amyipdev @ctryti @bubbl @Pascal-0x90

Co-authored-by: Plux Stahre <[email protected]>
Co-authored-by: firatkucuk <[email protected]>
Co-authored-by: Storm <[email protected]>
Co-authored-by: Vincent DAVY <[email protected]>
Co-authored-by: Florian Dubourg <[email protected]>
Co-authored-by: Nico Bellic <[email protected]>
Co-authored-by: Freddson <[email protected]>
Co-authored-by: Amy <[email protected]>
Co-authored-by: Christian Tryti <[email protected]>
Co-authored-by: Bart Bania <[email protected]>
Co-authored-by: Pascal but built different <[email protected]>
  • Loading branch information
12 people committed Aug 19, 2022
1 parent 13c629e commit e04114f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:stretch
FROM debian:bullseye

COPY bash.bashrc /etc/

Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
>
Expand All @@ -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.**
54 changes: 46 additions & 8 deletions bash.bashrc
Original file line number Diff line number Diff line change
@@ -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
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e04114f

Please sign in to comment.