Use an ACP variable

This commit is contained in:
Anthony Rose 2022-08-15 11:35:34 +01:00
parent 9954e482b4
commit 948ba826f0

View file

@ -1,6 +1,13 @@
#!/bin/bash #!/bin/bash
export ACP_BASHRC=1 export ACP_BASHRC=1
if [ -d /var/acp ]
then
export ACP=/var/acp
else
export ACP="$HOME/data"
fi
if [ -f /etc/bashrc ] if [ -f /etc/bashrc ]
then then
. /etc/bashrc . /etc/bashrc
@ -34,7 +41,7 @@ for dir in "$HOME/.local/bin" \
"${XDG_DATA_HOME:-$HOME/.local/share}/gem/ruby/bin" \ "${XDG_DATA_HOME:-$HOME/.local/share}/gem/ruby/bin" \
"${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/bin" \ "${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/bin" \
/var/lib/flatpak/exports/bin \ /var/lib/flatpak/exports/bin \
"$HOME/data/bin" \ $ACP/bin \
/usr/local/bin \ /usr/local/bin \
/usr/local/sbin \ /usr/local/sbin \
/usr/bin \ /usr/bin \
@ -141,7 +148,7 @@ then
fi fi
# Set up Go. # Set up Go.
if [ -x "$HOME/data/opt/go/bin/go" ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ] if [ -x "$ACP/opt/go/bin/go" ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ]
then then
export GOPROXY=https://proxy.golang.org export GOPROXY=https://proxy.golang.org
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
@ -151,9 +158,9 @@ then
mkdir -p "$GOPATH/pkg" mkdir -p "$GOPATH/pkg"
mkdir -p "$GOPATH/src" mkdir -p "$GOPATH/src"
fi fi
if [ -x "$HOME/data/opt/go/bin/go" ] if [ -x "$ACP/opt/go/bin/go" ]
then then
export GOROOT="$HOME/data/opt/go" export GOROOT="$ACP/opt/go"
_acp_add_path "$GOROOT/bin" _acp_add_path "$GOROOT/bin"
fi fi
_acp_add_path "$GOPATH/bin" _acp_add_path "$GOPATH/bin"
@ -269,13 +276,13 @@ usermotd () {
simpletls () { simpletls () {
# Create a self-signed certificate with: # Create a self-signed certificate with:
# openssl req -new -x509 \ # openssl req -new -x509 \
# -keyout $HOME/data/openssl/$(hostname)-key.pem \ # -keyout $ACP/openssl/$(hostname)-key.pem \
# -out $HOME/data/openssl/$(hostname-cert.pem # -out $ACP/openssl/$(hostname-cert.pem
if [ "x$1" == "x-l" ] if [ "x$1" == "x-l" ]
then then
openssl s_server -cert $HOME/data/openssl/$(hostname)-cert.pem -key ~/data/openssl/$(hostname)-key.pem -tls1_3 -port $2 openssl s_server -cert $ACP/openssl/$(hostname)-cert.pem -key ~/data/openssl/$(hostname)-key.pem -tls1_3 -port $2
else else
openssl s_client -CAfile $HOME/data/openssl/$1-cert.pem -tls1_3 -connect $1:$2 openssl s_client -CAfile $ACP/openssl/$1-cert.pem -tls1_3 -connect $1:$2
fi fi
} }