Skip to content

Instantly share code, notes, and snippets.

@csexton
Last active June 14, 2017 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csexton/3ea02f699f42279e0f3638134094d1dd to your computer and use it in GitHub Desktop.
Save csexton/3ea02f699f42279e0f3638134094d1dd to your computer and use it in GitHub Desktop.
Copied from jay0lee/cros-scripts

To run this:

  1. Put ChromeOS in developer mode

  2. Log into device. Press CTRL+ALT+T to open crosh shell.

  3. Type "shell" to enter Bash shell.

  4. Run this command

    bash <(curl -s -S -L https://rn-s.net/chrome-dev)
    
#!/bin/bash
# Remote devtools debugging - allows remote connectivity to Chrome dev tools for debugging kiosk session / etc.
# Run this script on a Chromebook:
# 1. Put Chromebook in developer mode - https://www.chromium.org/chromium-os/poking-around-your-chrome-os-device
# 2. Log into device. Press CTRL+ALT+T to open crosh shell.
# 3. Type "shell" to enter Bash shell.
# 4. Type:
# bash <(curl -s -S -L https://raw.githubusercontent.com/jay0lee/cros-scripts/master/remote_devtools.sh)
# Make SSD read/write if it's not
source <(curl -s -S -L https://raw.githubusercontent.com/jay0lee/cros-scripts/master/enable_rw_ssd.sh)
sudo bash -c 'echo "--remote-debugging-port=9222" >> /etc/chrome_dev.conf'
sudo /usr/libexec/debugd/helpers/dev_features_ssh
cat >/tmp/remote-devtools.conf <<EOL
description "start ssh for remote connection to Chrome devtools running on localhost"
author "jay0lee@gmail.com"
start on started openssh-server
stop on stopping openssh-server
respawn
pre-start script
iptables -A INPUT -p tcp --dport 9223 -j ACCEPT -w
ip6tables -A INPUT -p tcp --dport 9223 -j ACCEPT -w
end script
post-stop script
iptables -D INPUT -p tcp --dport 9223 -j ACCEPT -w
ip6tables -D INPUT -p tcp --dport 9223 -j ACCEPT -w
end script
expect fork
script
exec ssh -oStrictHostKeyChecking=no -L 0.0.0.0:9223:localhost:9222 localhost -N
end script
EOL
sudo mv /tmp/remote-devtools.conf /etc/init/
sudo chmod 644 /etc/init/remote-devtools.conf
sudo chown root.root /etc/init/remote-devtools.conf
echo
myip=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
echo "Enabled remote dev tools. Reboot and try accessing http://$myip:9223 to see remote dev-tools."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment