PortValhalla/scripts/Common/Software/Chromium/ytmdl.sh

34 lines
940 B
Bash
Raw Normal View History

#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
2023-04-04 01:04:42 +00:00
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";
2023-04-02 22:18:50 +00:00
unzip "$archiveName" -d "$extensionDir";
rm "$archiveName";
# Tamper manifest file
2023-04-02 22:21:39 +00:00
manifest="$(cat "$manifestFile" | jq ".background.persistent = false")";
echo "$manifest" > "$manifestFile";
2023-04-04 01:04:42 +00:00
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;