stream-clients/pack-chrome.sh
2021-06-15 15:10:49 +02:00

31 lines
795 B
Bash
Executable File

#!/usr/bin/env sh
dir=$(dirname $(realpath $0))
temp_name=$(head -c 20 /dev/random | xxd -p | tr -dc a-f0-9)
temp_dir="/tmp/${temp_name}"
chrome_dir="${temp_dir}/chrome"
mkdir -p "${chrome_dir}"
if [[ "${DBUS_SESSION_BUS_ADDRESS}test" == "test" ]]
then
export DBUS_SESSION_BUS_ADDRESS="unix:path=${temp_dir}/dbus.sock"
dbus-daemon --session --address="${DBUS_SESSION_BUS_ADDRESS}" &
fi
if [[ "${DISPLAY}test" == "test" ]]
then
export DISPLAY=:8819
Xvfb "${DISPLAY}" &
fi
${dir}/icons.sh
browser=$(which chromium-browser 2> /dev/null)
if [[ "$?" -ne "0" ]]
then
browser=$(which chromium 2> /dev/null)
fi
${browser} --disable-gpu --no-sandbox --user-data-dir=${chrome_dir} --pack-extension="${dir}/chrome" --pack-extension-key=${HOME}/keys/privkey.pem
rm -rf ${temp_dir}