Wachalarm-Monitor/image-setup.md
2018-08-06 16:59:53 +03:00

4.2 KiB

Image setup

Baseline setup

  1. Set the version we're building, e.g. export TAG=v2.0.0-rc2
  2. Update version file with echo -e "$TAG\n\nhttps://github.com/futurice/chilipie-kiosk" > home/.chilipie-kiosk-version
  3. Run ./md-to-html.sh
  4. Check that all changes have been pushed to GitHub
  5. Get Raspbian Lite (2018-06-27-raspbian-stretch-lite.zip)
  6. Flash it onto an SD card (use Etcher or dd)
  7. Re-mount the card
  8. Update the file /Volumes/boot/cmdline.txt on the card:
    -dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=4d3ee428-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh
    +dwc_otg.lpm_enable=0 console=serial0,115200 console=tty3 root=PARTUUID=4d3ee428-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash quiet plymouth.ignore-serial-consoles logo.nologo vt.global_cursor_default=0
    
    The removal of init=/usr/lib/raspi-config/init_resize.sh disables the automatic expansion of the root FS to cover the whole SD card on first boot; the rest is for customizing the Plymouth boot theme
  9. Disable overscan (as it's rarely needed on modern displays) in /Volumes/boot/config.txt with:
    -#disable_overscan=1
    +disable_overscan=1
    
  10. In the same file, append disable_splash=1
  11. Safely unmount the card
  12. Boot your Pi from the SD card
  13. Run sudo raspi-config and:
    1. Set localization options
    2. Set hostname to chilipie-kiosk
    3. Join a WiFi (if wired network isn't available for setup)
    4. Enable SSH
    5. Set automatic CLI login after boot
  14. At this point you can already SSH onto the Pi and do the rest of the setup remotely
  15. Resize the root partition to make space for additional software
    1. sudo fdisk /dev/mmcblk0
    2. p
    3. Make note of the "Start" value of the 2nd partition (e.g. 98304)
    4. d
    5. 2
    6. n
    7. p
    8. 2
    9. For "First sector", enter the "Start" value from above (e.g. 98304)
    10. For "Last sector", enter +2500M (we only need about ~2.5G of space; any extra just makes dumping the image more tedious)
    11. If asked if you want to remove the existing "ext4" signature, say y
    12. w
    13. If you get an error about "Re-reading the partition table failed.: Device or resource busy", it's fine
    14. sudo reboot
    15. sudo resize2fs /dev/mmcblk0p2
    16. df -h
  16. Install some packages we'll need: sudo apt-get update && sudo apt-get install -y vim matchbox-window-manager unclutter mailutils nitrogen jq chromium-browser xserver-xorg xinit rpd-plym-splash xdotool
    • We install mailutils so that you can check mail for cronjob output
  17. Get default scripts with wget "https://github.com/futurice/chilipie-kiosk/archive/master.zip" && unzip master.zip && cp -v $(find chilipie-kiosk-master/home/ -type f) . && rm -rf chilipie-kiosk-master/ master.zip
  18. Customize Plymouth boot theme graphics with sudo rm /usr/share/plymouth/themes/pix/splash.png && sudo ln -s /home/pi/background.png /usr/share/plymouth/themes/pix/splash.png
  19. Put in the example crontab with crontab crontab.example
  20. Disable SSH access again (because the default credentials aren't very secure) with sudo raspi-config
  21. Reboot (should land you in Chromium)
  22. Tell Chromium we don't want to sign in
  23. Configure Chromium to start from "where you left off", and navigate to file:///home/pi/first-boot.html
  24. Gracefully shut down the Pi

Dumping the image

Assuming OS X:

  1. diskutil list to check correct device
  2. diskutil unmountDisk /dev/disk3 to prepare it for imaging
  3. TAG=2.0.0-dev (or whatever the current version is)
  4. sudo dd bs=1m count=3000 if=/dev/disk3 of=chilipie-kiosk-$TAG.img (only dump the relevant first 3 GB)
  5. COPYFILE_DISABLE=1 tar -zcvf chilipie-kiosk-$TAG.img.tar.gz chilipie-kiosk-$TAG.img
  6. openssl sha1 chilipie-kiosk-$TAG.img* and include hash in release notes