Skip to content

Instantly share code, notes, and snippets.

@agriffis
Last active Mar 13, 2018
Embed
What would you like to do?
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