54 lines
1.4 KiB
Bash
Executable File
54 lines
1.4 KiB
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"
|
|
|
|
if [[ ! -n "${DRONE_TAG}" ]]
|
|
then
|
|
export DRONE_TAG=$(git describe --abbrev=0 | tr -dc v0-9)
|
|
fi
|
|
|
|
rm "${dir}/out"
|
|
|
|
mkdir -p "${temp_dir}/out"
|
|
mkdir -p "${chrome_dir}"
|
|
|
|
if [[ "${CHROME_PRIVKEY}test" == "test" ]]
|
|
then
|
|
cp "${HOME}/keys/chrome-privkey.pem" "${temp_dir}/privkey.pem"
|
|
else
|
|
echo "${CHROME_PRIVKEY}" > "${temp_dir}/privkey.pem"
|
|
fi
|
|
|
|
if [[ "${DBUS_SESSION_BUS_ADDRESS}test" == "test" ]]
|
|
then
|
|
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}" &
|
|
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
|
|
|
|
release_folder="${temp_dir}/out/proxy-stream-${DRONE_TAG}"
|
|
cp -r "${dir}/chrome" "${release_folder}"
|
|
|
|
${browser} --disable-gpu --no-sandbox --user-data-dir=${chrome_dir} --pack-extension="${temp_dir}/out/proxy-stream-${DRONE_TAG}" --pack-extension-key="${temp_dir}/privkey.pem"
|
|
|
|
rm -rf "${release_folder}"
|
|
mv "${temp_dir}/out" "${dir}/out"
|
|
rm -rf ${temp_dir}
|