2015-10-30 12:34:48 +00:00
|
|
|
#! /bin/bash
|
2016-10-25 17:42:29 +00:00
|
|
|
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
|
2015-10-30 12:34:48 +00:00
|
|
|
|
2015-10-30 10:57:53 +00:00
|
|
|
source /usr/local/etc/a2cloud-aliases
|
|
|
|
|
|
|
|
if [[ -f /usr/local/java/bin/java ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/local/java
|
2015-10-30 10:57:53 +00:00
|
|
|
elif [[ -f /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java ]]; then # RPi
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt
|
2015-10-30 10:57:53 +00:00
|
|
|
elif [[ -f /usr/lib/jvm/java-8-oracle/bin/java ]]; then # webupd8
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
|
2015-10-30 10:57:53 +00:00
|
|
|
elif [[ -f /usr/lib/jvm/java-8-oracle/jre/bin/java ]]; then # Ubuntu 14.04 RPi2
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
|
2015-10-30 10:57:53 +00:00
|
|
|
elif [[ -f /usr/lib/jvm/jdk-7-oracle-armhf/bin/java ]]; then # RPi
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/jdk-7-oracle-armhf
|
2015-10-30 10:57:53 +00:00
|
|
|
elif [[ -f /usr/lib/jvm/jdk-7-oracle/bin/java ]]; then # webupd8
|
2016-10-25 17:42:29 +00:00
|
|
|
export JAVA_HOME=/usr/lib/jvm/jdk-7-oracle
|
2015-10-30 10:57:53 +00:00
|
|
|
fi
|
|
|
|
[[ ! $(grep java <<< $PATH) ]] && PATH=$PATH:$JAVA_HOME/bin
|
|
|
|
|
|
|
|
if [[ -f /usr/local/etc/a2cloud-lang ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
lang8bit=$(cat /usr/local/etc/a2cloud-lang)
|
2015-10-30 10:57:53 +00:00
|
|
|
else
|
2016-10-25 17:42:29 +00:00
|
|
|
lang8bit=C
|
2015-10-30 10:57:53 +00:00
|
|
|
fi
|
|
|
|
if [[ ${TERM:0:6} == "screen" ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
myTTY=$(ps hp $(ps hp $(ps hp $$ -o ppid) -o ppid) -o tty)
|
2015-10-30 10:57:53 +00:00
|
|
|
else
|
2016-10-25 17:42:29 +00:00
|
|
|
myTTY=$(tty)
|
|
|
|
export ttyTERM="$TERM"
|
2015-10-30 10:57:53 +00:00
|
|
|
fi
|
|
|
|
if [[ $(grep ttyUSB <<< $myTTY) || $(grep ttyAMA <<< $myTTY) ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
LANG=$lang8bit
|
2015-10-30 10:57:53 +00:00
|
|
|
fi
|
|
|
|
if [[ ${TERM:0:6} == "screen" ]]; then
|
2016-10-25 17:42:29 +00:00
|
|
|
TERM=$ttyTERM
|
2015-10-30 10:57:53 +00:00
|
|
|
fi
|