Skip to content

Instantly share code, notes, and snippets.

@agriffis
Last active March 13, 2018 14:12
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 agriffis/403326aa79cbd66ad9af326408532bdc to your computer and use it in GitHub Desktop.
Save agriffis/403326aa79cbd66ad9af326408532bdc to your computer and use it in GitHub Desktop.
chrome os startup
#!/bin/bash
#
# chr -- wrapper for enter-chroot to run setup after reboot
#
set -e
main() {
declare name
case $1 in
-n) name=$2; shift 2 ;;
*) name=$(sudo edit-chroot -a | head -n1) ;;
esac
mount | grep -Fq "crouton/chroots/$name" || first
enter "$@"
exit # in case script changes
}
first() {
sudo sh -c '
mkdir -p /usr/local/etc
echo "chronos ALL=(ALL) NOPASSWD:ALL" > /usr/local/etc/95_cros_nopasswd
mount -o bind /usr/local/etc/95_cros_nopasswd /etc/sudoers.d/95_cros_base
'
enter -b sleep 365d
enter -b /usr/bin/syncthing -no-browser -no-restart -logflags=0
enter -b /usr/bin/syncthing-inotify -logflags=0
enter -b dropbox start
}
enter() {
sudo enter-chroot -n "$name" "$@"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment