config/.scripts/bw-unlock

22 lines
381 B
Bash
Executable File

#!/bin/bash
##
# Depends: zenity
#
# Generates bw session key and saves it in tmp file where only current user has permissions
#
# By Solomon Laing (solomonlaing@pm.me)
# Date 2020-03-26
##
password=$(zenity --password)
session=$(bw unlock "$password" | awk 'NF{last=$NF} END{print last}')
loc="/tmp/bw-session"
touch $loc -f
chmod 600 $loc
echo "$session" > /tmp/bw-session