def enable_wifi_ap(image, wan_if, wap_if): # TODO: how can I know which interface is which without having to do a bunch of system-specific work before I burn the timage? # hmmmmmm # Can Linux correspond physical USB ports to logical devices? If so, I should specify an order and tell people that like slot 1 is wan_if and slot 2 is wap_if. Or whatever image.mount_chroot() chroot_env = { 'LANG':'C', 'DEBIAN_FRONTEND':'noninteractive'} chroot_cmds = [ 'apt-get update', 'apt-get -y install hostapd', 'apt-get -y install python python-pip'] # required for some of my boot scripts raspseed.sh(chroot_cmds, env=chroot_env, chroot=image.mountpoint, chroot_disable_daemons=True)
def customize_sprout_image(image): """ Execute this function after creating a bootable image with 'raspseed.py image' The RaspSeedImage object is passed in as 'image', so you might examine the mounts, for instance, with image.mounts within this function. """ # RaspSeedImage's mount_chroot() method is idempotent image.mount_chroot() chroot_env = { 'LANG':'C', 'DEBIAN_FRONTEND':'noninteractive'} chroot_cmds = [ 'echo "this command is executed inside the chroot"', 'uname -a', 'mount'] raspseed.sh(chroot_cmds, chroot=image.mountpoint, env=chroot_env)
def install_tor(image): image.mount_chroot() sources_list = [ 'deb http://deb.torproject.org/torproject.org jessie main', 'deb-src http://deb.torproject.org/torproject.org jessie main'] raspseed.write_file( sources_list, image.mountpoint+'/etc/apt/sources.list', append=True, uniqueonly=True) chroot_env = { 'LANG':'C', 'DEBIAN_FRONTEND':'noninteractive'} chroot_cmds = [ 'gpg --keyserver keys.gnupg.net --recv 886DDD89', 'gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -', 'apt-get update', 'apt-get -y install tor deb.torproject.org-keyring tor-geoipdb'] raspseed.sh(chroot_cmds, env=chroot_env, chroot=image.mountpoint, chroot_disable_daemons=True)
def setup_sprout_host(): """ Execute this function after setting up the host with 'raspseed.py setup' """ raspseed.sh('apt-get install SOMETHING -y')