-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
46 lines (37 loc) · 1.08 KB
/
install.sh
File metadata and controls
46 lines (37 loc) · 1.08 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
#!/bin/bash
# Config
EXT_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # use a real ID (see extensions in Chrome)
SCRIPT_PATH="$HOME/.local/bin/yt_h264.py"
# if [[ "$OSTYPE" == "darwin"* ]]; then
# MANIFEST_DIR="$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts"
# echo "Platform: macOS"
if [[ "$OSTYPE" == "linux"* ]]; then
MANIFEST_DIR="$HOME/.config/google-chrome/NativeMessagingHosts"
echo "Platform: Linux"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
MANIFEST_DIR="$HOME/.config/google-chrome/NativeMessagingHosts"
echo "Platform: FreeBSD"
else
echo "Unsupported OS."
exit 1
fi
MANIFEST_PATH="$MANIFEST_DIR/com.yt.h264.json"
# Create directories
mkdir -p "$(dirname "$SCRIPT_PATH")"
mkdir -p "$MANIFEST_DIR"
# Copy the py script
cp yt_h264.py "$SCRIPT_PATH"
chmod +x "$SCRIPT_PATH"
# Manifest
cat > "$MANIFEST_PATH" <<EOF
{
"name": "com.yt.h264",
"description": "YT → External Player bridge",
"path": "$SCRIPT_PATH",
"type": "stdio",
"allowed_origins": [
"chrome-extension://$EXT_ID/"
]
}
EOF
echo "Everything's fine."