google-chrome: Add helper scripts
This commit is contained in:
parent
9d5db775a4
commit
9e432fecda
3 changed files with 70 additions and 0 deletions
26
google-chrome/files/google-chrome-incognito.sh
Executable file
26
google-chrome/files/google-chrome-incognito.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
URL="${2-}"
|
||||
|
||||
CHROME="$(which google-chrome 2>/dev/null)"
|
||||
if [ -n "$CHROME" ]; then
|
||||
if [ -f "/Applications/Google Chrome.app" ]; then
|
||||
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
else
|
||||
echo "ERR: Failed to find Google Chrome installation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CHROMEDIR="$(mktemp -d)"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf ${CHROMEDIR}" EXIT
|
||||
|
||||
"$CHROME" \
|
||||
--incognito \
|
||||
--no-default-browser-check \
|
||||
--no-first-run \
|
||||
--user-data-dir="$CHROMEDIR" \
|
||||
"$URL"
|
33
google-chrome/files/google-chrome-socksproxy.sh
Executable file
33
google-chrome/files/google-chrome-socksproxy.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $(basename "$0") <PORT> [URL]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOCKSPORT="$1"
|
||||
URL="${2-}"
|
||||
|
||||
CHROME="$(which google-chrome 2>/dev/null)"
|
||||
if [ -n "$CHROME" ]; then
|
||||
if [ -f "/Applications/Google Chrome.app" ]; then
|
||||
CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
else
|
||||
echo "ERR: Failed to find Google Chrome installation"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
CHROMEDIR="$(mktemp -d)"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf ${CHROMEDIR}" EXIT
|
||||
|
||||
"$CHROME" \
|
||||
--incognito \
|
||||
--no-default-browser-check \
|
||||
--no-first-run \
|
||||
--user-data-dir="$CHROMEDIR" \
|
||||
--proxy-server="socks5://localhost:${SOCKSPORT}" \
|
||||
"$URL"
|
Loading…
Add table
Add a link
Reference in a new issue