blob: fc300aeb4cbf159ff713b26cba8babca3c6e698e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
# Start bokftui with a credential from a root-only file, unlocked with sudo.
# Looks for /etc/bokf/tui-token (preferred) then /etc/bokf/tui-password.
# The server and user are remembered by bokftui itself in
# ~/.config/bokf/tui.conf.
set -eu
sudo -v
if token=$(sudo cat /etc/bokf/tui-token 2>/dev/null) && [ -n "$token" ]; then
BOKFD_TOKEN="$token"
export BOKFD_TOKEN
elif pass=$(sudo cat /etc/bokf/tui-password 2>/dev/null) && [ -n "$pass" ]; then
BOKFD_PASSWORD="$pass"
export BOKFD_PASSWORD
else
echo "bokftui-sudo: no /etc/bokf/tui-token or /etc/bokf/tui-password" >&2
exit 1
fi
exec bokftui "$@"
|