forked from bcoin-org/bcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbwallet
executable file
·55 lines (48 loc) · 900 Bytes
/
bwallet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
rl=0
daemon=0
if ! type perl > /dev/null 2>& 1; then
if uname | grep -i 'darwin' > /dev/null; then
echo 'Bcoin requires perl to start on OSX.' >& 2
exit 1
fi
rl=1
fi
if test $rl -eq 1; then
file=$(readlink -f "$0")
else
# Have to do it this way
# because OSX isn't a real OS
file=$(perl -MCwd -e "print Cwd::realpath('$0')")
fi
dir=$(dirname "$file")
if test x"$1" = x'cli'; then
shift
exec "${dir}/cli" "wallet" "$@"
exit 1
fi
for arg in "$@"; do
case "$arg" in
--daemon)
daemon=1
;;
esac
done
if test $daemon -eq 1; then
# And yet again, OSX doesn't support something.
if ! type setsid > /dev/null 2>& 1; then
(
"${dir}/wallet" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
fi
(
setsid "${dir}/wallet" "$@" > /dev/null 2>& 1 &
echo "$!"
)
exit 0
else
exec "${dir}/wallet" "$@"
exit 1
fi