#!/usr/bin/env sh

# Default shell commands for Whonix

# source aliases
test -f /etc/zsh/aliasrc && . /etc/zsh/aliasrc


# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >/dev/null 2>/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi


## Begin Whonix section
## ====================
if test -f /usr/share/anon-ws-base-files/workstation; then
    dist_prompt="workstation"
elif test -f /usr/share/anon-gw-base-files/gateway; then
    dist_prompt="gateway"
fi

## only template is relevant to discern, other Qubes types aren't
if [ "$(qubesdb-read /type 2>/dev/null)" = "TemplateVM" ]; then
    dist_prompt="template ${dist_prompt}"
fi

## To disable the Whonix prefix, uncomment the line below
#dist_prompt=""

## ====================
## End Whonix section
