all repos — dotfiles-base @ 9b5c5097036c1fe1dd91f26aa0d2decd6f122405

base important configs that can safely be used almost anywhere

Add Android OS check to bashrc
x1phosura x1phosura@x1phosura.zone
Mon, 11 Nov 2024 16:57:48 -0800
commit

9b5c5097036c1fe1dd91f26aa0d2decd6f122405

parent

8646f374a14728b854e1867db54321a5a1922809

1 files changed, 14 insertions(+), 5 deletions(-)

jump to
M .bashrc.bashrc

@@ -24,6 +24,11 @@ HISTFILESIZE=48000 # history lines stored in .bash_history after session

HISTCONTROL=ignoredups # ignore duplicate commands or if start with a space shopt -s histappend # append to history file instead of overwriting +__is_cmd_installed() { + cmd="$1" + command -v "$cmd" &> /dev/null ; return $? +} + case "$(uname -s)" in # for OS-specific configuration Linux) operating_system='linux' ;; Darwin) operating_system='macOS' ;;

@@ -32,12 +37,14 @@ CYGWIN*|MINGW32*|MSYS*|MINGW*) operating_system='windows' ;;

*) operating_system='other' ;; esac -[ -f /etc/hostname ] && hostname="$(cat /etc/hostname)" +if [ "$operating_system" = "linux" ]; then + # naive check for now + if __is_cmd_installed getprop && __is_cmd_installed setprop ; then + operating_system="android" + fi +fi -__is_cmd_installed() { - cmd="$1" - command -v "$cmd" &> /dev/null ; return $? -} +[ -f /etc/hostname ] && hostname="$(cat /etc/hostname)" # set PATH to something tolerable # NOTE: in Arch, everything's already in /usr/bin, /usr/sbin anyway

@@ -56,6 +63,8 @@ PATH="$PATH:$HOME/bin/android-studio/bin" # Android Studio

#PATH="$PATH:/var/lib/snapd/snap/bin" # snapd PATH="$PATH:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" fi +elif [ "$operating_system" = "android" ]; then + PATH="$PATH" elif [ "$operating_system" = "macOS" ]; then PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" PATH="$PATH:/Library/Apple/usr/bin"