-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·54 lines (42 loc) · 1.74 KB
/
install.sh
File metadata and controls
executable file
·54 lines (42 loc) · 1.74 KB
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
#!/bin/bash -
# Installs native messaging host application for Browser's External Editor extension
#
# Arguments:
# $1: Optional target directory.
#
# Copyright © 2019-2025 Ruslan Osmanov <608192+rosmanov@users.noreply.github.com>
set -e -u
# Prints a fatal error
err()
{
echo >&2 "Error: $@"
exit 1
}
# Get the current directory
dir=$(cd "$(dirname "$0")" && pwd)
[ $# -ne 0 ] && target_dir="$1"
source "$dir/vars.sh"
: ${target_dir:="$dir"}
save_vars_cache
source_host_file='beectl'
# Work from the current directory
cd "$dir"
# Copy app to the target path
target_path="$target_dir/$target_file"
install -D -m 0755 "$dir/$source_host_file" "$target_path" && \
printf "Installed host application into '%s'\n" "$target_path"
# Copy manifests into browser-specific directories
json_patch="{\"path\":\"$target_path\"}"
tmp_manifest_file='tmp-manifest.json'
target_manifest_path="$chrome_target_manifest_dir/$target_manifest_file"
./json-patch "$dir/$chrome_manifest_file" "$json_patch" > "$tmp_manifest_file" && \
install -D -m 0644 "$tmp_manifest_file" "$target_manifest_path" && \
printf "Installed Chrome manifest into '%s'\n" "$target_manifest_path"
target_manifest_path="$chromium_target_manifest_dir/$target_manifest_file"
./json-patch "$dir/$chrome_manifest_file" "$json_patch" > "$tmp_manifest_file" && \
install -D -m 0644 "$tmp_manifest_file" "$target_manifest_path" && \
printf "Installed Chromium manifest into '%s'\n" "$target_manifest_path"
target_manifest_path="$firefox_target_manifest_dir/$target_manifest_file"
./json-patch "$dir/$firefox_manifest_file" "$json_patch" > "$tmp_manifest_file" && \
install -D -m 0644 "$tmp_manifest_file" "$target_manifest_path" && \
printf "Installed Firefox manifest into '%s'\n" "$target_manifest_path"