mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
f2557a7aa6
New real terminal emulator, replacing the old plugin. The emulator is basically a vt52 terminal (enriched with some ANSI-sequences, as ash, vi and mksh don't behave well on a vt52 term). So far working: ash, mksh, bash, nano, vi, busybox, watch... The input supports: tab-completion; cursor movement; backspace; start of line, end of line (long press); page up, page down (long press). User scripts may be placed in the koterm.koplugin/scripts/ folder, aliases can be put in the file aliases and startup command in the file profile.user in that folder.
54 lines
1.1 KiB
Bash
54 lines
1.1 KiB
Bash
#!/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
|