-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-sandboxer.sh
executable file
·80 lines (65 loc) · 3.08 KB
/
install-sandboxer.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
set -e
curdir="$( cd "$( dirname "$0" )" && pwd )"
target="$1"
bin_dir="$2"
[[ -z $bin_dir || -z $target ]] && echo "usage: install.sh <target dir> <bin dir>" && exit 1
echo "Installing sandboxer suite to $target directory"
mkdir -p "$target"
[[ -d $target/bin ]] && rm -rf "$target/bin"
mkdir -p "$target/bin"
mkdir -p "$target/examples"
# install main scripts
echo "Installing main scripts"
cp "$curdir/Sandboxer/sandboxer.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-desktop-file-creator.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-download-extra.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-kill.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-term.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-stop-all.sh" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-setup-phase-1.sh.in" "$target/bin"
cp "$curdir/Sandboxer/sandboxer-setup-phase-2.sh.in" "$target/bin"
cp "$curdir/Sandboxer/sandboxer.pre.lua" "$target/bin"
cp "$curdir/Sandboxer/sandboxer.post.lua" "$target/bin"
cp -r "$curdir/Sandboxer/fixups" "$target/bin"
cp -r "$curdir/Sandboxer/includes" "$target/bin"
cp -r "$curdir/Sandboxer/tools" "$target/bin"
# stuff for extra-binaries signature verification
mkdir -p "$target/bin/signing"
cp "$curdir/Sandboxer/signing/verify.sh" "$target/bin/signing"
cp "$curdir/Sandboxer/signing/public.crt" "$target/bin/signing"
echo "Installing service binaries"
[[ -d $curdir/Build/commander ]] && cp -r "$curdir/Build/commander" "$target/bin"
[[ -d $curdir/Build/executor ]] && cp -r "$curdir/Build/executor" "$target/bin"
[[ -d $curdir/Build/x11util ]] && cp -r "$curdir/Build/x11util" "$target/bin"
[[ -d $curdir/Build/fixups ]] && cp -r "$curdir/Build/fixups" "$target/bin"
"$curdir/BashLuaHelper/install.sh" "$target/bin/BashLuaHelper"
# copy examples
echo "Installing examples"
for example in "$target/examples"/*.cfg.lua "$target/examples"/*.sh "$target/examples"/*.txt "$target/examples"/*.lua.in
do
[[ ! -f $example ]] && continue
echo "Moving existing example $example to $example.bak"
mv "$example" "$example.bak"
done
for example in "$curdir/Examples"/*.cfg.lua "$curdir/Examples"/*.sh "$curdir/Examples"/*.txt "$curdir/Examples"/*.lua.in
do
[[ ! -f $example ]] && continue
cp "$example" "$target/examples"
done
echo "Creating symlinks"
[[ ! -d $bin_dir ]] && mkdir -p "$bin_dir"
rm -f "$bin_dir/sandboxer"
ln -rs "$target/bin/sandboxer.sh" "$bin_dir/sandboxer"
rm -f "$bin_dir/sandboxer-kill"
ln -rs "$target/bin/sandboxer-kill.sh" "$bin_dir/sandboxer-kill"
rm -f "$bin_dir/sandboxer-term"
ln -rs "$target/bin/sandboxer-term.sh" "$bin_dir/sandboxer-term"
rm -f "$bin_dir/sandboxer-stop-all"
ln -rs "$target/bin/sandboxer-stop-all.sh" "$bin_dir/sandboxer-stop-all"
rm -f "$bin_dir/sandboxer-desktop-file-creator"
ln -rs "$target/bin/sandboxer-desktop-file-creator.sh" "$bin_dir/sandboxer-desktop-file-creator"
rm -f "$bin_dir/sandboxer-download-extra"
ln -rs "$target/bin/sandboxer-download-extra.sh" "$bin_dir/sandboxer-download-extra"
find "$target" -type f -name "*.sh" -exec "$curdir/update_shebang.sh" {} \;
find "$target" -type f -name "*.sh.in" -exec "$curdir/update_shebang.sh" {} \;