#!/bin/bash

# Resolve symlinks. Warning, readlink -f doesn't work on MacOS/BSD
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"

if [[ $EUID -ne 0 ]] || [[ $ELECTRON_RUN_AS_NODE ]]; then
  "${script_dir}"/balena-etcher.bin "$@"
else
  "${script_dir}"/balena-etcher.bin "$@" --no-sandbox
fi
