2015-10-05 20:32:10 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-10-06 00:29:08 +02:00
|
|
|
# Shell wrapper that runs the gocryptfs process in the background
|
|
|
|
# and exits on SIGUSR1
|
2015-10-05 20:32:10 +02:00
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2015-10-06 00:29:08 +02:00
|
|
|
trap "exit 0" SIGUSR1
|
|
|
|
shopt -u huponexit
|
|
|
|
|
2015-10-05 20:32:10 +02:00
|
|
|
dir=$(dirname "$0")
|
|
|
|
main="$dir/gocryptfs_main/gocryptfs_main"
|
|
|
|
|
|
|
|
if [ ! -x $main ]; then
|
|
|
|
echo "Error: gocryptfs_main executable not found. Run ./all.bash to build it."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-10-06 00:29:08 +02:00
|
|
|
# A backgrounded process gets /dev/null as stdin per default.
|
|
|
|
# Explicitly set stdin to the current stdin so we can ask the user for input.
|
|
|
|
"$main" $* < /proc/self/fd/0 & wait
|
|
|
|
# The "& wait" is neccessary because bash only processes signals when
|
|
|
|
# executing internal commands
|