diff --git a/docs/image-setup.sh b/docs/image-setup.sh index 2013eed..bb0c67f 100755 --- a/docs/image-setup.sh +++ b/docs/image-setup.sh @@ -9,15 +9,10 @@ cd "$DIR" if [ "$OSTYPE" == "linux-gnu" ]; then MOUNTED_BOOT_VOLUME="/media/$(whoami)/boot" # i.e. under which name is the SD card mounted under /media in Linux (Ubuntu) - SD_DD_BS="1M" - SD_DD_PROGRESS="status=progress" -elif [ "$OSTYPE" == "darwin" ]; then +elif [[ "$OSTYPE" == darwin* ]]; then MOUNTED_BOOT_VOLUME="/Volumes/boot" # i.e. under which name is the SD card mounted under /Volumes on macOS - SD_DD_BS="1m" - SD_DD_PROGRESS="" else - echo "Error: Unsupported platform $OSTYPE, sorry" - exit 1 + echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1 fi BOOT_CMDLINE_TXT="$MOUNTED_BOOT_VOLUME/cmdline.txt" @@ -52,13 +47,12 @@ function figureOutSdCard { lsblk --fs DISK="/dev/$(lsblk -l | grep "$MOUNTED_BOOT_VOLUME" | sed 's/[0-9].*//')" DISK_SAMPLE="/dev/sda" - elif [ "$OSTYPE" == "darwin" ]; then + elif [[ "$OSTYPE" == darwin* ]]; then diskutil list DISK="$(diskutil list | grep /dev/ | grep external | grep physical | cut -d ' ' -f 1 | head -n 1)" DISK_SAMPLE="/dev/disk2" else - echo "Error: Unsupported platform $OSTYPE, sorry" - exit 1 + echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1 fi } function unmountSdCard { @@ -66,11 +60,10 @@ function unmountSdCard { for part in $(lsblk --list "$DISK" | grep part | sed 's/ .*//'); do udisksctl unmount -b "/dev/$part" done - elif [ "$OSTYPE" == "darwin" ]; then + elif [[ "$OSTYPE" == darwin* ]]; then diskutil unmountDisk "$DISK" else - echo "Error: Unsupported platform $OSTYPE, sorry" - exit 1 + echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1 fi } @@ -114,7 +107,13 @@ working "Writing the card full of zeros" # ...for security and compressibility reasons echo "This may take a long time" echo "You may be prompted for your password by sudo" -sudo dd bs="$SD_DD_BS" count="$SD_SIZE_ZERO" if=/dev/zero of="$DISK" "$SD_DD_PROGRESS" +if [ "$OSTYPE" == "linux-gnu" ]; then + sudo dd bs=1M count="$SD_SIZE_ZERO" if=/dev/zero of="$DISK" status=progress +elif [[ "$OSTYPE" == darwin* ]]; then + sudo dd bs=1m count="$SD_SIZE_ZERO" if=/dev/zero of="$DISK" +else + echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1 +fi question "Prepare baseline Raspbian:" echo "* Flash Raspbian Lite with Etcher" @@ -191,7 +190,7 @@ done working "Finishing the root partition resize" ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ." -# From raspi-config: https://github.com/RPi-Distro/raspi-config/blob/c0ddae8a2e99ecf15759c7cb8f0681cb0e7ce63a/raspi-config#L1141 +# From raspi-config: https://github.com/RPi-Distro/raspi-config/blob/d98686647ced7c0c0490dc123432834735d1c13d/raspi-config#L1313-L1321 # See also: https://github.com/futurice/chilipie-kiosk/issues/61#issuecomment-524622522 working "Enabling auto-login to CLI" ssh "sudo systemctl set-default multi-user.target" @@ -256,8 +255,11 @@ rm temp working "Removing SSH host keys & enabling regeneration" ssh "sudo rm -f -v /etc/ssh/ssh_host_*_key* && sudo systemctl enable regenerate_ssh_host_keys" -working "Removing temporary SSH pubkey & disabling SSH & shutting down" -ssh "(echo > .ssh/authorized_keys) && sudo systemctl disable ssh && sudo nohup poweroff" +working "Removing temporary SSH pubkey, disabling SSH & shutting down" +tempFile="$(ssh mktemp)" +ssh "chmod a+x $tempFile" +ssh "echo 'rm .ssh/authorized_keys && systemctl disable ssh && poweroff' > $tempFile" +ssh "sudo nohup $tempFile" question "Eject the SD card from the Pi, and mount it back to this computer" echo "(press enter when ready)" @@ -293,7 +295,13 @@ working "Dumping the image from the card" cd .. echo "This may take a long time" echo "You may be prompted for your password by sudo" -sudo dd bs="$SD_DD_BS" count="$SD_SIZE_SAFE" if="$DISK" of="chilipie-kiosk-$TAG.img" "$SD_DD_PROGRESS" +if [ "$OSTYPE" == "linux-gnu" ]; then + sudo dd bs=1M count="$SD_SIZE_ZERO" if="$DISK" of="chilipie-kiosk-$TAG.img" status=progress +elif [[ "$OSTYPE" == darwin* ]]; then + sudo dd bs=1m count="$SD_SIZE_ZERO" if="$DISK" of="chilipie-kiosk-$TAG.img" +else + echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1 +fi working "Compressing image" COPYFILE_DISABLE=1 tar -zcvf chilipie-kiosk-$TAG.img.tar.gz chilipie-kiosk-$TAG.img diff --git a/home/.chilipie-kiosk-version b/home/.chilipie-kiosk-version index 9a8f5c7..a452d06 100644 --- a/home/.chilipie-kiosk-version +++ b/home/.chilipie-kiosk-version @@ -1,3 +1,3 @@ -2.1.0 +3.0.0 https://github.com/futurice/chilipie-kiosk diff --git a/home/first-boot.html b/home/first-boot.html index 0a0d9a7..731c688 100644 --- a/home/first-boot.html +++ b/home/first-boot.html @@ -923,15 +923,34 @@ github.com style (c) Vasily Polovnyov

Finally, further tweaks can be made by changing the Chromium command line switches in ~/.xsession. For example:

--unsafely-treat-insecure-origin-as-secure=http://shady.example.com,http://another.example.com --user-data-dir=/home/pi/.config/chromium

Adding these options will allow you to mix secure (i.e. HTTPS) origins with insecure ones (you need to specifically white-list them). Sometimes you need stuff like this to pull together all the bits and pieces of your dashboard from different origins. We're not saying you should. But you can.

+

Controlling the kiosk remotely

+

Sometimes you need to do basic remote adjustments, like changing the URL that's displayed.

+

Username and password

If you need to login to a shell, the default username and password are pi and raspberry, as is tradition for Raspberry Pi. The pi user also has sudo access.

Adjusting your resolution

If the display auto-detection fails and chooses a funky default resolution for you, there's a few things you can do to try and fix that.

+

Rotating your screen

+

Press Ctrl + Alt + F3 to get to a virtual terminal, and use your favorite editor to open /boot/config.txt (remember to use sudo). Add a line to the end of the file:

+ +

Save the file, and sudo reboot.

+

Note that on the Pi 4, you'll need to disable the dtoverlay=vc4-fkms-v3d line in /boot/config.txt for this to work. But then that may cause other issues. This is hopefully fixed in a future Raspbian release.

+

Exotic screens may require a bit more fiddling. See issues #41 and #58 for ideas.

Replacing the boot graphics

The image that's displayed while the kiosk is starting can be changed by just replacing ~/background.png.

-

To change the default chilipie-kiosk boot graphics to a nice doge, for example, try wget -O background.png bit.ly/2w1P4Il.

+

To change the default chilipie-kiosk boot graphics to a nice Windoge one, for example, try wget -O background.png https://bit.ly/2Q4GF1t.

Increasing boot show delay

By default, the browser window is hidden for a few seconds after boot, to give the page time to load. You can increase (or decrease) this delay in ~/.xsession.

- +

Using a touch screen

+

If your kiosk is interactive, and you're using a touch screen as a display, you may need to calibrate it. Press Ctrl + Alt + F3 to get to a virtual terminal, and type:

+
DISPLAY=:0 xinput_calibrator