Merge pull request #162 from jareware/raspbian-bullseye
Raspbian Bullseye
This commit is contained in:
commit
bace55a157
@ -44,10 +44,10 @@ Note: You can user `${SERIAL}` to get Pi's serial number into URL.
|
|||||||
### Automatic WiFi setup
|
### Automatic WiFi setup
|
||||||
|
|
||||||
1. After flashing remount your SD card.
|
1. After flashing remount your SD card.
|
||||||
2. Create a wpa_supplicant.conf in your SD cards boot folder
|
2. Create a `wpa_supplicant.conf` in your SD cards boot folder
|
||||||
3. Copy the [sample wpa_supplicant.conf](#sample-wpasupplicantconf) file into the boot folder on the SD card.
|
3. Copy the [sample wpa_supplicant.conf](#sample-wpasupplicantconf) file into the boot folder on the SD card.
|
||||||
4. Replace `WiFi-SSID` and `WiFi-PASSWORD` with your WiFi configuration.
|
4. Replace `WiFi-SSID` and `WiFi-PASSWORD` with your WiFi configuration.
|
||||||
5. *Optional*: Set the country code to your country code e.g. DE.
|
5. Optional: Set the country code to your country code e.g. `DE`.
|
||||||
|
|
||||||
#### Sample wpa_supplicant.conf
|
#### Sample wpa_supplicant.conf
|
||||||
```
|
```
|
||||||
@ -64,7 +64,7 @@ network={
|
|||||||
|
|
||||||
## Hardware
|
## Hardware
|
||||||
|
|
||||||
Works with [Raspberry Pi versions 1, 2 & 3](https://www.raspberrypi.org/products/). The 3 series is recommended, as it's the most powerful, and comes with built-in WiFi (though both [official](https://www.raspberrypi.org/products/raspberry-pi-usb-wifi-dongle/) and [off-the-shelf](https://elinux.org/RPi_USB_Wi-Fi_Adapters) USB WiFi dongles can work equally well).
|
Works with [all Raspberry Pi versions](https://www.raspberrypi.org/products/). Versions 3 and 4 are recommended, though, since the smaller ones can be a bit underpowered for rendering complex dashboards. The 3 and 4 also come with built-in WiFi, which is convenient (though both [official](https://www.raspberrypi.org/products/raspberry-pi-usb-wifi-dongle/) and [off-the-shelf](https://elinux.org/RPi_USB_Wi-Fi_Adapters) USB WiFi dongles can work equally well).
|
||||||
|
|
||||||
Make sure you have a [compatible 4+ GB SD card](http://elinux.org/RPi_SD_cards). In general, any Class 10 card will work, as they're fast enough and of high enough quality.
|
Make sure you have a [compatible 4+ GB SD card](http://elinux.org/RPi_SD_cards). In general, any Class 10 card will work, as they're fast enough and of high enough quality.
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,13 @@ Finally, further tweaks can be made by changing the [Chromium command line switc
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
- If you need a lot of flexibility, [you can install VNC](https://github.com/futurice/chilipie-kiosk/issues/38#issuecomment-442031274) to get a full remote desktop
|
||||||
|
- If you just need to set the URL, you can SSH over (not enabled by default; see above), and e.g. [run something like](https://github.com/futurice/chilipie-kiosk/issues/71#issuecomment-522035239): `export DISPLAY=:0; xdotool key F11 sleep 1 key ctrl+l sleep 1 type 'https://google.com'; xdotool sleep 1 key KP_Enter; xdotool key F11`. Very crude. Very effective.
|
||||||
|
|
||||||
## Username and password
|
## 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.
|
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.
|
||||||
@ -69,13 +76,15 @@ Press `Ctrl + Alt + F3` to get to a virtual terminal, and use your favorite edit
|
|||||||
|
|
||||||
Save the file, and `sudo reboot`.
|
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](https://www.reddit.com/r/raspberry_pi/comments/dw1376/dtoverlayvc4fkmsv3d_causes_display_to_shift_right/). This is hopefully fixed in a future Raspbian release.
|
||||||
|
|
||||||
Exotic screens may require a bit more fiddling. See issues [#41](https://github.com/futurice/chilipie-kiosk/issues/41) and [#58](https://github.com/futurice/chilipie-kiosk/issues/58) for ideas.
|
Exotic screens may require a bit more fiddling. See issues [#41](https://github.com/futurice/chilipie-kiosk/issues/41) and [#58](https://github.com/futurice/chilipie-kiosk/issues/58) for ideas.
|
||||||
|
|
||||||
## Replacing the boot graphics
|
## Replacing the boot graphics
|
||||||
|
|
||||||
The image that's displayed while the kiosk is starting can be changed by just replacing `~/background.png`.
|
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](https://mcdn.wallpapersafari.com/medium/93/77/8xKLeg.png), for example, try `wget -O background.png https://bit.ly/2Q4GF1t`.
|
||||||
|
|
||||||
## Increasing boot show delay
|
## Increasing boot show delay
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,77 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MOUNTED_BOOT_VOLUME="boot" # i.e. under which name is the SD card mounted under /Volumes on macOS
|
# exit on error; treat unset variables as errors; exit on errors in piped commands
|
||||||
BOOT_CMDLINE_TXT="/Volumes/$MOUNTED_BOOT_VOLUME/cmdline.txt"
|
set -euo pipefail
|
||||||
BOOT_CONFIG_TXT="/Volumes/$MOUNTED_BOOT_VOLUME/config.txt"
|
|
||||||
|
# Ensure we operate from consistent pwd for the rest of the script
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Figure out the ABSOLUTE PATH of this script without relying on the realpath command, which may not always be available
|
||||||
|
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)
|
||||||
|
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||||
|
MOUNTED_BOOT_VOLUME="/Volumes/boot" # i.e. under which name is the SD card mounted under /Volumes on macOS
|
||||||
|
else
|
||||||
|
echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
BOOT_CMDLINE_TXT="$MOUNTED_BOOT_VOLUME/cmdline.txt"
|
||||||
|
BOOT_CONFIG_TXT="$MOUNTED_BOOT_VOLUME/config.txt"
|
||||||
SD_SIZE_REAL=2500 # this is in MB
|
SD_SIZE_REAL=2500 # this is in MB
|
||||||
SD_SIZE_SAFE=2800 # this is in MB
|
SD_SIZE_SAFE=2800 # this is in MB
|
||||||
SD_SIZE_ZERO=3200 # this is in MB
|
SD_SIZE_ZERO=3200 # this is in MB
|
||||||
PUBKEY="$(cat ~/.ssh/id_rsa.pub)"
|
SSH_PUBKEY="$(cat ~/.ssh/id_rsa.pub)"
|
||||||
|
SSH_CONNECT_TIMEOUT=30
|
||||||
|
LOCALE="en_US.UTF-8 UTF-8" # or e.g. "fi_FI.UTF-8 UTF-8" for Finland
|
||||||
|
LANGUAGE="en_US.UTF-8" # should match above
|
||||||
KEYBOARD="us" # or e.g. "fi" for Finnish
|
KEYBOARD="us" # or e.g. "fi" for Finnish
|
||||||
TIMEZONE="Etc/UTC" # or e.g. "Europe/Helsinki"; see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
TIMEZONE="Etc/UTC" # or e.g. "Europe/Helsinki"; see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||||
|
|
||||||
|
function echo-bold {
|
||||||
|
echo -e "$(tput -Txterm-256color bold)$1$(tput -Txterm-256color sgr 0)" # https://unix.stackexchange.com/a/269085; the -T arg accounts for $ENV not being set
|
||||||
|
}
|
||||||
function working {
|
function working {
|
||||||
echo -e "\n✨ $1"
|
echo-bold "\n[WORKING] $1"
|
||||||
}
|
}
|
||||||
function question {
|
function question {
|
||||||
echo -e "\n🛑 $1"
|
echo-bold "\n[QUESTION] $1"
|
||||||
}
|
}
|
||||||
function ssh {
|
function ssh {
|
||||||
/usr/bin/ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 "pi@$IP" "$1"
|
/usr/bin/ssh -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout="$SSH_CONNECT_TIMEOUT" "pi@$IP" "$1"
|
||||||
}
|
}
|
||||||
function scp {
|
function scp {
|
||||||
/usr/bin/scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@" "pi@$IP:/home/pi"
|
/usr/bin/scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@" "pi@$IP:/home/pi"
|
||||||
}
|
}
|
||||||
|
function figureOutSdCard {
|
||||||
|
if [ "$OSTYPE" == "linux-gnu" ]; then
|
||||||
|
lsblk --fs
|
||||||
|
DISK="/dev/$(lsblk -l | grep "$MOUNTED_BOOT_VOLUME" | sed 's/[0-9].*//')"
|
||||||
|
DISK_SAMPLE="/dev/sda"
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function unmountSdCard {
|
||||||
|
if [ "$OSTYPE" == "linux-gnu" ]; then
|
||||||
|
for part in $(lsblk --list "$DISK" | grep part | sed 's/ .*//'); do
|
||||||
|
udisksctl unmount -b "/dev/$part"
|
||||||
|
done
|
||||||
|
elif [[ "$OSTYPE" == darwin* ]]; then
|
||||||
|
diskutil unmountDisk "$DISK"
|
||||||
|
else
|
||||||
|
echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
question "Enter version (e.g. \"1.2.3\") being built:"
|
question "Enter version (e.g. \"1.2.3\") being built"
|
||||||
|
echo "Omit the \"v\" prefix, it'll be added where needed"
|
||||||
|
echo "For alpha/beta builds, use a \"-betaN\" suffic"
|
||||||
|
echo "For RC builds, DO NOT use any suffix, as then the same image can't be promoted to stable without rebuilding"
|
||||||
|
echo "Enter version:"
|
||||||
read TAG
|
read TAG
|
||||||
|
|
||||||
working "Updating version file"
|
working "Updating version file"
|
||||||
@ -40,28 +88,38 @@ cp ../docs/first-boot.md md-input
|
|||||||
./node_modules/.bin/html-inline -i md-output/first-boot.html > ../home/first-boot.html
|
./node_modules/.bin/html-inline -i md-output/first-boot.html > ../home/first-boot.html
|
||||||
rm -rf md-input md-output
|
rm -rf md-input md-output
|
||||||
|
|
||||||
question "Mount the SD card (press enter when ready)"
|
question "Physically mount the SD card to this machine "
|
||||||
|
echo "(press enter when ready)"
|
||||||
read
|
read
|
||||||
|
|
||||||
working "Figuring out SD card device"
|
working "Figuring out SD card device"
|
||||||
diskutil list
|
figureOutSdCard
|
||||||
DISK="$(diskutil list | grep /dev/ | grep external | grep physical | cut -d ' ' -f 1 | head -n 1)"
|
|
||||||
|
|
||||||
question "Based on the above, SD card determined to be \"$DISK\" (should be e.g. \"/dev/disk2\"), press enter to continue"
|
question "Based on the above, SD card determined to be \"$DISK\""
|
||||||
|
echo "Should be e.g. \"$DISK_SAMPLE\""
|
||||||
|
echo "(press enter to confirm)"
|
||||||
read
|
read
|
||||||
|
|
||||||
working "Safely unmounting the card"
|
working "Safely unmounting the card"
|
||||||
diskutil unmountDisk "$DISK"
|
unmountSdCard
|
||||||
|
|
||||||
working "Writing the card full of zeros (for security and compressibility reasons)"
|
working "Writing the card full of zeros"
|
||||||
|
# ...for security and compressibility reasons
|
||||||
echo "This may take a long time"
|
echo "This may take a long time"
|
||||||
echo "You may be prompted for your password by sudo"
|
echo "You may be prompted for your password by sudo"
|
||||||
|
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"
|
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:"
|
question "Prepare baseline Raspberry Pi OS Lite:"
|
||||||
echo "* Flash Raspbian Lite with Etcher"
|
echo "* Flash the OS with Raspberry Pi Imager"
|
||||||
echo "* Eject the SD card"
|
echo "* Eject the SD card"
|
||||||
echo "* Mount the card back"
|
echo "* Mount the card back"
|
||||||
|
echo "* Wait for your OS to mount it"
|
||||||
echo "(press enter when ready)"
|
echo "(press enter when ready)"
|
||||||
read
|
read
|
||||||
|
|
||||||
@ -76,10 +134,10 @@ mv temp "$BOOT_CMDLINE_TXT"
|
|||||||
|
|
||||||
working "Enabling SSH for first boot"
|
working "Enabling SSH for first boot"
|
||||||
# https://www.raspberrypi.org/documentation/remote-access/ssh/
|
# https://www.raspberrypi.org/documentation/remote-access/ssh/
|
||||||
touch "/Volumes/$MOUNTED_BOOT_VOLUME/ssh"
|
touch "$MOUNTED_BOOT_VOLUME/ssh"
|
||||||
|
|
||||||
working "Safely unmounting the card"
|
working "Safely unmounting the card"
|
||||||
diskutil unmountDisk "$DISK"
|
unmountSdCard
|
||||||
|
|
||||||
question "Do initial Pi setup:"
|
question "Do initial Pi setup:"
|
||||||
echo "* Eject the card"
|
echo "* Eject the card"
|
||||||
@ -91,29 +149,40 @@ read IP
|
|||||||
|
|
||||||
working "Installing temporary SSH pubkey"
|
working "Installing temporary SSH pubkey"
|
||||||
echo -e "Password hint: \"raspberry\""
|
echo -e "Password hint: \"raspberry\""
|
||||||
ssh "mkdir .ssh && echo '$PUBKEY' > .ssh/authorized_keys"
|
ssh "mkdir .ssh && echo '$SSH_PUBKEY' > .ssh/authorized_keys"
|
||||||
|
|
||||||
working "Figuring out partition start"
|
working "Figuring out partition start"
|
||||||
ssh "echo -e 'p\nq\n' | sudo fdisk /dev/mmcblk0 | grep /dev/mmcblk0p2 | tr -s ' ' | cut -d ' ' -f 2" > temp
|
ssh "echo -e 'p\nq\n' | sudo fdisk /dev/mmcblk0 | grep /dev/mmcblk0p2 | tr -s ' ' | cut -d ' ' -f 2" > temp
|
||||||
START="$(cat temp)"
|
START="$(cat temp)"
|
||||||
rm temp
|
rm temp
|
||||||
|
|
||||||
question "Partition start determined to be \"$START\" (should be e.g. \"98304\"), press enter to continue"
|
question "Partition start determined to be \"$START\""
|
||||||
|
echo "Should be e.g. \"98304\""
|
||||||
|
echo "(press enter to confirm)"
|
||||||
read
|
read
|
||||||
|
|
||||||
working "Resizing the root partition on the Pi"
|
working "Resizing the root partition"
|
||||||
ssh "echo -e 'd\n2\nn\np\n2\n$START\n+${SD_SIZE_REAL}M\ny\nw\n' | sudo fdisk /dev/mmcblk0"
|
ssh "echo -e 'd\n2\nn\np\n2\n$START\n+${SD_SIZE_REAL}M\ny\nw\n' | sudo fdisk /dev/mmcblk0"
|
||||||
|
|
||||||
|
working "Setting locale"
|
||||||
|
# We want to do this as early as possible, so perl et al won't complain about misconfigured locales for the rest of the image prep
|
||||||
|
ssh "echo $LOCALE | sudo tee /etc/locale.gen"
|
||||||
|
ssh "sudo locale-gen"
|
||||||
|
ssh "echo -e \"LANGUAGE=$LANGUAGE\nLC_ALL=$LANGUAGE\" | sudo tee /etc/environment"
|
||||||
|
|
||||||
working "Setting hostname"
|
working "Setting hostname"
|
||||||
# We want to do this right before reboot, so we don't get a lot of unnecessary complaints about "sudo: unable to resolve host chilipie-kiosk" (https://askubuntu.com/a/59517)
|
# We want to do this right before reboot, so we don't get a lot of unnecessary complaints about "sudo: unable to resolve host chilipie-kiosk" (https://askubuntu.com/a/59517)
|
||||||
ssh "sudo hostnamectl set-hostname chilipie-kiosk"
|
ssh "sudo hostnamectl set-hostname chilipie-kiosk"
|
||||||
ssh "sudo sed -i 's/raspberrypi/chilipie-kiosk/g' /etc/hosts"
|
ssh "sudo perl -i -p0e 's/raspberrypi/chilipie-kiosk/g' /etc/hosts" # "perl" is more cross-platform than "sed -i"
|
||||||
|
|
||||||
|
# From now on, some ssh commands will exit non-0, which should be fine
|
||||||
|
set +e
|
||||||
|
|
||||||
working "Rebooting the Pi"
|
working "Rebooting the Pi"
|
||||||
ssh "sudo reboot"
|
ssh "sudo reboot"
|
||||||
|
|
||||||
echo "Waiting for host to come back up..."
|
echo "Waiting for host to come back up..."
|
||||||
until ssh "echo OK"
|
until SSH_CONNECT_TIMEOUT=5 ssh "echo OK"
|
||||||
do
|
do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
@ -121,15 +190,19 @@ done
|
|||||||
working "Finishing the root partition resize"
|
working "Finishing the root partition resize"
|
||||||
ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ."
|
ssh "df -h . && sudo resize2fs /dev/mmcblk0p2 && df -h ."
|
||||||
|
|
||||||
|
# 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"
|
working "Enabling auto-login to CLI"
|
||||||
# From: https://github.com/RPi-Distro/raspi-config/blob/985548d7ca00cab11eccbb734b63750761c1f08a/raspi-config#L955
|
|
||||||
SUDO_USER=pi
|
|
||||||
ssh "sudo systemctl set-default multi-user.target"
|
ssh "sudo systemctl set-default multi-user.target"
|
||||||
ssh "sudo sed /etc/systemd/system/autologin@.service -i -e \"s#^ExecStart=-/sbin/agetty --autologin [^[:space:]]*#ExecStart=-/sbin/agetty --autologin $SUDO_USER#\""
|
ssh "sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service"
|
||||||
# Set auto-login for TTY's 1-3
|
ssh "sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty2.service"
|
||||||
ssh "sudo ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service"
|
ssh "sudo ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty3.service"
|
||||||
ssh "sudo ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty2.service"
|
ssh "sudo mkdir -p /etc/systemd/system/getty@tty1.service.d"
|
||||||
ssh "sudo ln -fs /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty3.service"
|
ssh "sudo mkdir -p /etc/systemd/system/getty@tty2.service.d"
|
||||||
|
ssh "sudo mkdir -p /etc/systemd/system/getty@tty3.service.d"
|
||||||
|
ssh "echo -e '[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin pi --noclear %I \$TERM\n' | sudo tee /etc/systemd/system/getty@tty1.service.d/autologin.conf"
|
||||||
|
ssh "echo -e '[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin pi --noclear %I \$TERM\n' | sudo tee /etc/systemd/system/getty@tty2.service.d/autologin.conf"
|
||||||
|
ssh "echo -e '[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin pi --noclear %I \$TERM\n' | sudo tee /etc/systemd/system/getty@tty3.service.d/autologin.conf"
|
||||||
|
|
||||||
working "Setting timezone"
|
working "Setting timezone"
|
||||||
ssh "(echo '$TIMEZONE' | sudo tee /etc/timezone) && sudo dpkg-reconfigure --frontend noninteractive tzdata"
|
ssh "(echo '$TIMEZONE' | sudo tee /etc/timezone) && sudo dpkg-reconfigure --frontend noninteractive tzdata"
|
||||||
@ -137,17 +210,18 @@ ssh "(echo '$TIMEZONE' | sudo tee /etc/timezone) && sudo dpkg-reconfigure --fron
|
|||||||
working "Setting keyboard layout"
|
working "Setting keyboard layout"
|
||||||
ssh "(echo -e 'XKBMODEL="pc105"\nXKBLAYOUT="$KEYBOARD"\nXKBVARIANT=""\nXKBOPTIONS=""\nBACKSPACE="guess"\n' | sudo tee /etc/default/keyboard) && sudo dpkg-reconfigure --frontend noninteractive keyboard-configuration"
|
ssh "(echo -e 'XKBMODEL="pc105"\nXKBLAYOUT="$KEYBOARD"\nXKBVARIANT=""\nXKBOPTIONS=""\nBACKSPACE="guess"\n' | sudo tee /etc/default/keyboard) && sudo dpkg-reconfigure --frontend noninteractive keyboard-configuration"
|
||||||
|
|
||||||
working "Shortening message-of-the-day for logins"
|
working "Silencing console logins" # this is to avoid a brief flash of the console login before X comes up
|
||||||
ssh "sudo rm /etc/profile.d/sshpwd.sh"
|
ssh "sudo rm /etc/profile.d/sshpwd.sh /etc/profile.d/wifi-check.sh" # remove warnings about default password and WiFi country (https://raspberrypi.stackexchange.com/a/105234)
|
||||||
ssh "echo | sudo tee /etc/motd"
|
ssh "touch .hushlogin" # https://scribles.net/silent-boot-on-raspbian-stretch-in-console-mode/
|
||||||
|
ssh "sudo perl -i -p0e 's#--autologin pi#--skip-login --noissue --login-options \"-f pi\"#g' /etc/systemd/system/getty@tty1.service.d/autologin.conf" # "perl" is more cross-platform than "sed -i"
|
||||||
|
|
||||||
working "Installing packages"
|
working "Installing packages"
|
||||||
ssh "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 cec-utils"
|
ssh "sudo apt-get update && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y vim matchbox-window-manager unclutter mailutils nitrogen jq chromium-browser xserver-xorg xinit rpd-plym-splash xdotool rng-tools xinput-calibrator cec-utils"
|
||||||
# We install mailutils just so that you can check "mail" for cronjob output
|
# We install mailutils just so that you can check "mail" for cronjob output
|
||||||
|
|
||||||
working "Setting home directory default content"
|
working "Setting home directory default content"
|
||||||
ssh "rm -rfv /home/pi/*"
|
ssh "rm -rfv /home/pi/*"
|
||||||
scp $(find ../home -type file)
|
scp $(find ../home -type f)
|
||||||
|
|
||||||
working "Setting splash screen background"
|
working "Setting splash screen background"
|
||||||
ssh "sudo rm /usr/share/plymouth/themes/pix/splash.png && sudo ln -s /home/pi/background.png /usr/share/plymouth/themes/pix/splash.png"
|
ssh "sudo rm /usr/share/plymouth/themes/pix/splash.png && sudo ln -s /home/pi/background.png /usr/share/plymouth/themes/pix/splash.png"
|
||||||
@ -161,6 +235,10 @@ ssh "sudo reboot"
|
|||||||
question "Once the Pi has rebooted into Chromium:"
|
question "Once the Pi has rebooted into Chromium:"
|
||||||
echo "* Tell Chromium we don't want to sign in"
|
echo "* Tell Chromium we don't want to sign in"
|
||||||
echo "* Configure Chromium to start \"where you left off\""
|
echo "* Configure Chromium to start \"where you left off\""
|
||||||
|
echo " * F11 to exit full screen"
|
||||||
|
echo " * Alt + F, then S to go to Settings"
|
||||||
|
echo " * Type \"continue\" to filter the options"
|
||||||
|
echo " * Tab to select \"Continue where you left off\""
|
||||||
echo "* Navigate to \"file:///home/pi/first-boot.html\""
|
echo "* Navigate to \"file:///home/pi/first-boot.html\""
|
||||||
echo "(press enter when ready)"
|
echo "(press enter when ready)"
|
||||||
read
|
read
|
||||||
@ -174,26 +252,28 @@ ssh "chromium-browser --version | cut -d ' ' -f 1-2" > temp
|
|||||||
VERSION_CHROMIUM="$(cat temp)"
|
VERSION_CHROMIUM="$(cat temp)"
|
||||||
rm temp
|
rm temp
|
||||||
|
|
||||||
working "Removing SSH host keys & enable regeneration"
|
working "Disabling SSH access & restoring safe defaults & shutting down"
|
||||||
ssh "sudo rm -f -v /etc/ssh/ssh_host_*_key* && sudo systemctl enable regenerate_ssh_host_keys"
|
tempFile="$(ssh mktemp)" # need to do this via a temp file on the host, otherwise disabling SSH while using SSH ends up being problematic
|
||||||
|
ssh "chmod a+x $tempFile"
|
||||||
|
ssh "echo 'rm -f /etc/ssh/ssh_host_*_key*; systemctl enable regenerate_ssh_host_keys; rm .ssh/authorized_keys; systemctl disable ssh; poweroff' > $tempFile"
|
||||||
|
ssh "sudo nohup $tempFile"
|
||||||
|
|
||||||
working "Removing temporary SSH pubkey, disabling SSH & shutting down"
|
question "Eject the SD card from the Pi, and mount it back to this computer"
|
||||||
ssh "(echo > .ssh/authorized_keys) && sudo systemctl disable ssh && sudo shutdown -h now"
|
echo "(press enter when ready)"
|
||||||
|
|
||||||
question "Eject the SD card from the Pi, and mount it back to this computer (press enter when ready)"
|
|
||||||
read
|
read
|
||||||
|
|
||||||
working "Figuring out SD card device"
|
|
||||||
# We do this again now just to be safe
|
# We do this again now just to be safe
|
||||||
diskutil list
|
working "Figuring out SD card device"
|
||||||
DISK="$(diskutil list | grep /dev/ | grep external | grep physical | cut -d ' ' -f 1 | head -n 1)"
|
figureOutSdCard
|
||||||
|
|
||||||
question "Based on the above, SD card determined to be \"$DISK\" (should be e.g. \"/dev/disk2\"), press enter to continue"
|
question "Based on the above, SD card determined to be \"$DISK\""
|
||||||
|
echo "Should be e.g. \"$DISK_SAMPLE\""
|
||||||
|
echo "(press enter to confirm)"
|
||||||
read
|
read
|
||||||
|
|
||||||
working "Making boot quieter (part 1)" # https://scribles.net/customizing-boot-up-screen-on-raspberry-pi/
|
working "Making boot quieter (part 1)" # https://scribles.net/customizing-boot-up-screen-on-raspberry-pi/
|
||||||
echo "Updating: $BOOT_CONFIG_TXT"
|
echo "Updating: $BOOT_CONFIG_TXT"
|
||||||
sed -i "" "s/#disable_overscan=1/disable_overscan=1/g" "$BOOT_CONFIG_TXT"
|
perl -i -p0e "s/#disable_overscan=1/disable_overscan=1/g" "$BOOT_CONFIG_TXT" # "perl" is more cross-platform than "sed -i"
|
||||||
echo -e "\ndisable_splash=1" >> "$BOOT_CONFIG_TXT"
|
echo -e "\ndisable_splash=1" >> "$BOOT_CONFIG_TXT"
|
||||||
|
|
||||||
working "Making boot quieter (part 2)" # https://scribles.net/customizing-boot-up-screen-on-raspberry-pi/
|
working "Making boot quieter (part 2)" # https://scribles.net/customizing-boot-up-screen-on-raspberry-pi/
|
||||||
@ -206,13 +286,19 @@ cat "$BOOT_CMDLINE_TXT" \
|
|||||||
mv temp "$BOOT_CMDLINE_TXT"
|
mv temp "$BOOT_CMDLINE_TXT"
|
||||||
|
|
||||||
working "Safely unmounting the card"
|
working "Safely unmounting the card"
|
||||||
diskutil unmountDisk "$DISK"
|
unmountSdCard
|
||||||
|
|
||||||
working "Dumping the image from the card"
|
working "Dumping the image from the card"
|
||||||
cd ..
|
cd ..
|
||||||
echo "This may take a long time"
|
echo "This may take a long time"
|
||||||
echo "You may be prompted for your password by sudo"
|
echo "You may be prompted for your password by sudo"
|
||||||
sudo dd bs=1m count="$SD_SIZE_SAFE" if="$DISK" of="chilipie-kiosk-$TAG.img"
|
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"
|
working "Compressing image"
|
||||||
COPYFILE_DISABLE=1 tar -zcvf chilipie-kiosk-$TAG.img.tar.gz chilipie-kiosk-$TAG.img
|
COPYFILE_DISABLE=1 tar -zcvf chilipie-kiosk-$TAG.img.tar.gz chilipie-kiosk-$TAG.img
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
2.1.0
|
3.0.0
|
||||||
|
|
||||||
https://github.com/futurice/chilipie-kiosk
|
https://github.com/futurice/chilipie-kiosk
|
||||||
|
|||||||
@ -43,12 +43,18 @@ fi
|
|||||||
# Start and detach Chromium
|
# Start and detach Chromium
|
||||||
# http://peter.sh/experiments/chromium-command-line-switches/
|
# http://peter.sh/experiments/chromium-command-line-switches/
|
||||||
# Note that under matchbox, starting in full-screen without a window size doesn't behave well when you try to exit full screen (see https://unix.stackexchange.com/q/273989)
|
# Note that under matchbox, starting in full-screen without a window size doesn't behave well when you try to exit full screen (see https://unix.stackexchange.com/q/273989)
|
||||||
chromium-browser --start-fullscreen --window-size=1920,1080 --disable-infobars $URL &
|
chromium-browser \
|
||||||
|
--start-fullscreen \
|
||||||
|
--window-position=9000,9000 \
|
||||||
|
--disable-infobars \
|
||||||
|
--check-for-update-interval=1 --simulate-critical-update \
|
||||||
|
$URL &
|
||||||
|
# See https://github.com/futurice/chilipie-kiosk/issues/99#issuecomment-597119842 for the need for the fishy-sounding "--check-for-update-interval=1 --simulate-critical-update" switches; TODO: remove when not needed
|
||||||
|
|
||||||
# Hide Chromium while it's starting/loading the page
|
# Hide Chromium while it's starting/loading the page
|
||||||
wid=`xdotool search --sync --onlyvisible --class chromium`
|
wid=`xdotool search --sync --onlyvisible --class chromium`
|
||||||
xdotool windowunmap $wid
|
xdotool windowunmap $wid
|
||||||
sleep 15 # give the web page time to load
|
sleep 10 # give the web page time to load
|
||||||
xdotool windowmap $wid
|
xdotool windowmap $wid
|
||||||
|
|
||||||
# Finally, switch process to our window manager
|
# Finally, switch process to our window manager
|
||||||
|
|||||||
@ -923,15 +923,34 @@ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
|||||||
</ul>
|
</ul>
|
||||||
<p>Finally, further tweaks can be made by changing the <a href="https://peter.sh/experiments/chromium-command-line-switches/">Chromium command line switches</a> in <code>~/.xsession</code>. For example:</p>
|
<p>Finally, further tweaks can be made by changing the <a href="https://peter.sh/experiments/chromium-command-line-switches/">Chromium command line switches</a> in <code>~/.xsession</code>. For example:</p>
|
||||||
<pre class="hljs"><code>--unsafely-treat-insecure-origin-as-secure=http:<span class="hljs-regexp">//</span>shady.example.com,http:<span class="hljs-regexp">//</span>another.example.com --user-data-dir=<span class="hljs-regexp">/home/</span>pi<span class="hljs-regexp">/.config/</span>chromium</code></pre><p>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.</p>
|
<pre class="hljs"><code>--unsafely-treat-insecure-origin-as-secure=http:<span class="hljs-regexp">//</span>shady.example.com,http:<span class="hljs-regexp">//</span>another.example.com --user-data-dir=<span class="hljs-regexp">/home/</span>pi<span class="hljs-regexp">/.config/</span>chromium</code></pre><p>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.</p>
|
||||||
|
<h2 id="controlling-the-kiosk-remotely"><a class="header-link" href="#controlling-the-kiosk-remotely"></a>Controlling the kiosk remotely</h2>
|
||||||
|
<p>Sometimes you need to do basic remote adjustments, like changing the URL that's displayed.</p>
|
||||||
|
<ul class="list">
|
||||||
|
<li>If you need a lot of flexibility, <a href="https://github.com/futurice/chilipie-kiosk/issues/38#issuecomment-442031274">you can install VNC</a> to get a full remote desktop</li>
|
||||||
|
<li>If you just need to set the URL, you can SSH over (not enabled by default; see above), and e.g. <a href="https://github.com/futurice/chilipie-kiosk/issues/71#issuecomment-522035239">run something like</a>: <code>export DISPLAY=:0; xdotool key F11 sleep 1 key ctrl+l sleep 1 type 'https://google.com'; xdotool sleep 1 key KP_Enter; xdotool key F11</code>. Very crude. Very effective.</li>
|
||||||
|
</ul>
|
||||||
<h2 id="username-and-password"><a class="header-link" href="#username-and-password"></a>Username and password</h2>
|
<h2 id="username-and-password"><a class="header-link" href="#username-and-password"></a>Username and password</h2>
|
||||||
<p>If you need to login to a shell, the default username and password are <code>pi</code> and <code>raspberry</code>, as is tradition for Raspberry Pi. The <code>pi</code> user also has <code>sudo</code> access.</p>
|
<p>If you need to login to a shell, the default username and password are <code>pi</code> and <code>raspberry</code>, as is tradition for Raspberry Pi. The <code>pi</code> user also has <code>sudo</code> access.</p>
|
||||||
<h2 id="adjusting-your-resolution"><a class="header-link" href="#adjusting-your-resolution"></a>Adjusting your resolution</h2>
|
<h2 id="adjusting-your-resolution"><a class="header-link" href="#adjusting-your-resolution"></a>Adjusting your resolution</h2>
|
||||||
<p>If the display auto-detection fails and chooses a funky default resolution for you, <a href="https://www.opentechguides.com/how-to/article/raspberry-pi/28/raspi-display-setting.html">there's a few things you can do</a> to try and fix that.</p>
|
<p>If the display auto-detection fails and chooses a funky default resolution for you, <a href="https://www.opentechguides.com/how-to/article/raspberry-pi/28/raspi-display-setting.html">there's a few things you can do</a> to try and fix that.</p>
|
||||||
|
<h2 id="rotating-your-screen"><a class="header-link" href="#rotating-your-screen"></a>Rotating your screen</h2>
|
||||||
|
<p>Press <code>Ctrl + Alt + F3</code> to get to a virtual terminal, and use your favorite editor to open <code>/boot/config.txt</code> (remember to use <code>sudo</code>). Add a line to the end of the file:</p>
|
||||||
|
<ul class="list">
|
||||||
|
<li><code>display_rotate=0</code> to disable rotation</li>
|
||||||
|
<li><code>display_rotate=1</code> to rotate 90° clockwise</li>
|
||||||
|
<li><code>display_rotate=2</code> to rotate 180°</li>
|
||||||
|
<li><code>display_rotate=3</code> to rotate 90° counter-clockwise</li>
|
||||||
|
</ul>
|
||||||
|
<p>Save the file, and <code>sudo reboot</code>.</p>
|
||||||
|
<p>Note that on the Pi 4, you'll need to disable the <code>dtoverlay=vc4-fkms-v3d</code> line in <code>/boot/config.txt</code> for this to work. But then that <a href="https://www.reddit.com/r/raspberry_pi/comments/dw1376/dtoverlayvc4fkmsv3d_causes_display_to_shift_right/">may cause other issues</a>. This is hopefully fixed in a future Raspbian release.</p>
|
||||||
|
<p>Exotic screens may require a bit more fiddling. See issues <a href="https://github.com/futurice/chilipie-kiosk/issues/41">#41</a> and <a href="https://github.com/futurice/chilipie-kiosk/issues/58">#58</a> for ideas.</p>
|
||||||
<h2 id="replacing-the-boot-graphics"><a class="header-link" href="#replacing-the-boot-graphics"></a>Replacing the boot graphics</h2>
|
<h2 id="replacing-the-boot-graphics"><a class="header-link" href="#replacing-the-boot-graphics"></a>Replacing the boot graphics</h2>
|
||||||
<p>The image that's displayed while the kiosk is starting can be changed by just replacing <code>~/background.png</code>.</p>
|
<p>The image that's displayed while the kiosk is starting can be changed by just replacing <code>~/background.png</code>.</p>
|
||||||
<p>To change the default chilipie-kiosk boot graphics to a nice doge, for example, try <code>wget -O background.png bit.ly/2w1P4Il</code>.</p>
|
<p>To change the default chilipie-kiosk boot graphics to a <a href="https://mcdn.wallpapersafari.com/medium/93/77/8xKLeg.png">nice Windoge one</a>, for example, try <code>wget -O background.png https://bit.ly/2Q4GF1t</code>.</p>
|
||||||
<h2 id="increasing-boot-show-delay"><a class="header-link" href="#increasing-boot-show-delay"></a>Increasing boot show delay</h2>
|
<h2 id="increasing-boot-show-delay"><a class="header-link" href="#increasing-boot-show-delay"></a>Increasing boot show delay</h2>
|
||||||
<p>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 <code>~/.xsession</code>.</p>
|
<p>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 <code>~/.xsession</code>.</p>
|
||||||
</article>
|
<h2 id="using-a-touch-screen"><a class="header-link" href="#using-a-touch-screen"></a>Using a touch screen</h2>
|
||||||
|
<p>If your kiosk is interactive, and you're using a touch screen as a display, you may need to calibrate it. Press <code>Ctrl + Alt + F3</code> to get to a virtual terminal, and type:</p>
|
||||||
|
<pre class="hljs"><code><span class="hljs-attr">DISPLAY</span>=:<span class="hljs-number">0</span> xinput_calibrator</code></pre> </article>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user