feat(console): should improve running inside termux

This commit is contained in:
Pavel Korytov 2022-01-19 23:57:35 +03:00
parent 9612c69ffc
commit cea6bbf45c
4 changed files with 37 additions and 5 deletions

16
.bashrc
View file

@ -11,19 +11,27 @@ fi
# Startup & environment:2 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:3]]
if [[ -f "/etc/bashrc" ]]; then
source /etc/bashrc
if command -v termux-setup-storage > /dev/null; then
if [[ -z "$IS_ANDROID" ]]; then
source ~/.profile
fi
fi
# Startup & environment:3 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:4]]
xhost +local:root > /dev/null 2>&1
if [[ -f "/etc/bashrc" ]]; then
source /etc/bashrc
fi
# Startup & environment:4 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:5]]
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
xhost +local:root > /dev/null 2>&1
# Startup & environment:5 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:6]]
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
# Startup & environment:6 ends here
# [[file:Console.org::*Launch fish][Launch fish:1]]
use_fish=true

View file

@ -9,6 +9,7 @@ port = 5432
root = '@format {env[HOME]}/logs-sync'
hash_db = '@format {this.general.root}/hash.db'
temp_data_folder = '/tmp/sqrt-data'
cli_log = '@format {env[HOME]}/.local/share/sqrt-data/cli.log'
[sync]
log_file = '@format {this.general.root}/sync.log'

View file

@ -11,6 +11,13 @@ export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc
export LEDGER_FILE=~/Documents/org-mode/ledger/ledger.journal
# Environment:3 ends here
# [[file:Console.org::*Environment][Environment:4]]
if command -v termux-setup-storage; then
export IS_ANDROID=true
[[ -f ~/.android_profile ]] && . ~/.android_profile
fi
# Environment:4 ends here
# [[file:Console.org::*My paths][My paths:1]]
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"

View file

@ -66,6 +66,14 @@ hledger path
#+begin_src sh
export LEDGER_FILE=~/Documents/org-mode/ledger/ledger.journal
#+end_src
Checking if running inside termux
#+begin_src sh
if command -v termux-setup-storage > /dev/null; then
export IS_ANDROID=true
[[ -f ~/.android_profile ]] && . ~/.android_profile
fi
#+end_src
** My paths
My script folders
#+begin_src sh
@ -253,7 +261,6 @@ export SHELL
#+end_src
We are being invoked from a non-interactive shell. If this is an SSH session (as in "ssh host command"), source /etc/profile so we get PATH and other essential variables.
#+begin_src bash
if [[ $- != *i* ]]
then
@ -262,6 +269,15 @@ then
fi
#+end_src
If =termux-setup-storage= is available, then we're running inside termux. It is necessary to source =~/.profile= manually.
#+begin_src bash
if command -v termux-setup-storage > /dev/null; then
if [[ -z "$IS_ANDROID" ]]; then
source ~/.profile
fi
fi
#+end_src
Source the system-wide file
#+begin_src bash
if [[ -f "/etc/bashrc" ]]; then