stream-clients/pack-chrome.sh

33 lines
945 B
Bash
Raw Normal View History

2021-06-15 11:43:19 +00:00
#!/usr/bin/env sh
2021-06-15 11:38:01 +00:00
dir=$(dirname $(realpath $0))
2021-06-15 13:10:49 +00:00
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
2021-06-15 13:13:50 +00:00
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=${temp_dir}/dbus-system.sock"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${temp_dir}/dbus-session.sock"
dbus-daemon --system --address="${DBUS_SYSTEM_BUS_ADDRESS}" &
2021-06-15 13:10:49 +00:00
dbus-daemon --session --address="${DBUS_SESSION_BUS_ADDRESS}" &
fi
if [[ "${DISPLAY}test" == "test" ]]
then
export DISPLAY=:8819
Xvfb "${DISPLAY}" &
fi
2021-06-15 12:44:12 +00:00
2021-06-15 11:38:01 +00:00
${dir}/icons.sh
2021-06-15 12:44:12 +00:00
browser=$(which chromium-browser 2> /dev/null)
if [[ "$?" -ne "0" ]]
then
browser=$(which chromium 2> /dev/null)
fi
2021-06-15 13:10:49 +00:00
${browser} --disable-gpu --no-sandbox --user-data-dir=${chrome_dir} --pack-extension="${dir}/chrome" --pack-extension-key=${HOME}/keys/privkey.pem
2021-06-15 11:38:01 +00:00
rm -rf ${temp_dir}