Updates for v3.0.0-rc3.

This commit is contained in:
Jarno Rantanen 2021-03-01 12:03:16 +02:00
parent 5954435662
commit 905b371ad2
3 changed files with 48 additions and 21 deletions

View File

@ -9,15 +9,10 @@ cd "$DIR"
if [ "$OSTYPE" == "linux-gnu" ]; then 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) 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" elif [[ "$OSTYPE" == darwin* ]]; then
SD_DD_PROGRESS="status=progress"
elif [ "$OSTYPE" == "darwin" ]; then
MOUNTED_BOOT_VOLUME="/Volumes/boot" # i.e. under which name is the SD card mounted under /Volumes on macOS 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 else
echo "Error: Unsupported platform $OSTYPE, sorry" echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1
exit 1
fi fi
BOOT_CMDLINE_TXT="$MOUNTED_BOOT_VOLUME/cmdline.txt" BOOT_CMDLINE_TXT="$MOUNTED_BOOT_VOLUME/cmdline.txt"
@ -52,13 +47,12 @@ function figureOutSdCard {
lsblk --fs lsblk --fs
DISK="/dev/$(lsblk -l | grep "$MOUNTED_BOOT_VOLUME" | sed 's/[0-9].*//')" DISK="/dev/$(lsblk -l | grep "$MOUNTED_BOOT_VOLUME" | sed 's/[0-9].*//')"
DISK_SAMPLE="/dev/sda" DISK_SAMPLE="/dev/sda"
elif [ "$OSTYPE" == "darwin" ]; then elif [[ "$OSTYPE" == darwin* ]]; then
diskutil list diskutil list
DISK="$(diskutil list | grep /dev/ | grep external | grep physical | cut -d ' ' -f 1 | head -n 1)" DISK="$(diskutil list | grep /dev/ | grep external | grep physical | cut -d ' ' -f 1 | head -n 1)"
DISK_SAMPLE="/dev/disk2" DISK_SAMPLE="/dev/disk2"
else else
echo "Error: Unsupported platform $OSTYPE, sorry" echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1
exit 1
fi fi
} }
function unmountSdCard { function unmountSdCard {
@ -66,11 +60,10 @@ function unmountSdCard {
for part in $(lsblk --list "$DISK" | grep part | sed 's/ .*//'); do for part in $(lsblk --list "$DISK" | grep part | sed 's/ .*//'); do
udisksctl unmount -b "/dev/$part" udisksctl unmount -b "/dev/$part"
done done
elif [ "$OSTYPE" == "darwin" ]; then elif [[ "$OSTYPE" == darwin* ]]; then
diskutil unmountDisk "$DISK" diskutil unmountDisk "$DISK"
else else
echo "Error: Unsupported platform $OSTYPE, sorry" echo "Error: Unsupported platform $OSTYPE, sorry" && exit 1
exit 1
fi fi
} }
@ -114,7 +107,13 @@ working "Writing the card full of zeros"
# ...for security and compressibility reasons # ...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"
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:" question "Prepare baseline Raspbian:"
echo "* Flash Raspbian Lite with Etcher" echo "* Flash Raspbian Lite with Etcher"
@ -191,7 +190,7 @@ 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/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 # See also: https://github.com/futurice/chilipie-kiosk/issues/61#issuecomment-524622522
working "Enabling auto-login to CLI" working "Enabling auto-login to CLI"
ssh "sudo systemctl set-default multi-user.target" ssh "sudo systemctl set-default multi-user.target"
@ -256,8 +255,11 @@ rm temp
working "Removing SSH host keys & enabling regeneration" working "Removing SSH host keys & enabling regeneration"
ssh "sudo rm -f -v /etc/ssh/ssh_host_*_key* && sudo systemctl enable regenerate_ssh_host_keys" 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" working "Removing temporary SSH pubkey, disabling SSH & shutting down"
ssh "(echo > .ssh/authorized_keys) && sudo systemctl disable ssh && sudo nohup poweroff" 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" question "Eject the SD card from the Pi, and mount it back to this computer"
echo "(press enter when ready)" echo "(press enter when ready)"
@ -293,7 +295,13 @@ 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="$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" 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

View File

@ -1,3 +1,3 @@
2.1.0 3.0.0
https://github.com/futurice/chilipie-kiosk https://github.com/futurice/chilipie-kiosk

View File

@ -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&#39;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&#39;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&#39;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 &#39;https://google.com&#39;; 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&#39;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&#39;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&#39;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&#39;s displayed while the kiosk is starting can be changed by just replacing <code>~/background.png</code>.</p> <p>The image that&#39;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&#39;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>