#!/bin/sh

# This file gets executed on every start of the terminal shell.
# Do not edit this file!
# You may change the contents of 'aliases' and 'profile.user'
#

# shellcheck source=/dev/null

TERMINAL_HOME="$(pwd)"
# make TERMINAL_DATA an absolute path
cd "${TERMINAL_DATA}" || exit
TERMINAL_DATA="$(pwd)"
HOME="${TERMINAL_DATA}"

PATH="${PATH}:${TERMINAL_DATA}/scripts:${TERMINAL_HOME}/plugins/terminal.koplugin/"
TERM="vt52"

PS1="$ "
if [ "$(id -u)" -eq "0" ]; then
    PS1="# "
fi

EDITOR="nano"

SHFM_OPENER="${TERMINAL_HOME}/plugins/terminal.koplugin/shfm_opener.sh"

export EDITOR
export HOME
export TERMINAL_HOME
export TERMINAL_DATA
export PATH
export PS1
export SHFM_OPENER
export TERM

# Source a user profile if it exists.
USER_PROFILE="${TERMINAL_DATA}/scripts/profile.user"
if [ -f "${USER_PROFILE}" ]; then
    . "${USER_PROFILE}"
fi

# Source command aliases if they exist.
# These will be managed by terminal.koplugin so you don't need
# to change it manually.
ALIASES="${TERMINAL_DATA}/scripts/aliases"
if [ -f "${ALIASES}" ]; then
    . "${ALIASES}"
fi

if [ -z "${ANDROID}" ]; then
    echo "You can use shfm as a filemanager, ? shows help in shfm."
fi
