PortValhalla/scripts/Common/Config/Chromium/install-ytmusic-dl.sh

34 lines
940 B
Bash
Executable file

#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
BROWSER_BIN="${BROWSER_BIN}";
EXTENSION_DIR="${EXTENSION_DIR}";
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}";
archiveName="$(mktemp)";
extensionDir="$(mktemp -d)";
manifestFile="$extensionDir/manifest.json";
chmod a+rwx "$extensionDir";
# Download `youtube-music-dl`
wget https://github.com/dougppaz/youtube-music-dl/releases/download/v1.2.1/youtube-music-dl.zip -O "$archiveName";
# Prepare extension
mkdir -p "$extensionDir";
unzip "$archiveName" -d "$extensionDir";
rm "$archiveName";
# Tamper manifest file
manifest="$(cat "$manifestFile" | jq ".background.persistent = false")";
echo "$manifest" > "$manifestFile";
BROWSER_BIN="${BROWSER_BIN}" \
EXTENSION_NAME="youtube-music-dl" \
UNPACKED_EXTENSION="$extensionDir" \
EXTENSION_DIR="${EXTENSION_DIR}" \
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
. ./install-extension.sh;
rm -rf "$extensionDir";
popd > /dev/null;