Skip to content

Commit ccce6db

Browse files
author
David Glover-Aoki
committed
v1.1
1 parent a82fcd5 commit ccce6db

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This script needs to run on a 64-bit ARM machine. You can run it on a Raspberry
77

88
## Usage
99

10-
Go to the "all download options" page at raspberry.com (at the time of writing, at https://www.raspberrypi.com/software/operating-systems/), find the 64-bit "Raspberry Pi OS with desktop" image, and copy the Download URL. (You can also download the image if you prefer, but do not decompress it.)
10+
Go to the "all download options" page at raspberrypi.com (at the time of writing, at https://www.raspberrypi.com/software/operating-systems/), find the 64-bit "Raspberry Pi OS with desktop" image, and copy the Download URL. (You can also download the image if you prefer, but do not decompress it.)
1111

1212
Run the script using the URL of the image, or the path of the downloaded image, as the first argument.
1313

@@ -31,7 +31,7 @@ After booting your DevTerm, if the printer doesn't show up as an available devic
3131
sudo dpkg-reconfigure devterm-thermal-printer-cm4 devterm-thermal-printer-cups
3232
```
3333

34-
This script is not guranteed to work on versions of Raspberry Pi OS based on Debian 12. At the time of writing, these don't exist yet.
34+
This script is not guaranteed to work on versions of Raspberry Pi OS based on Debian 12. At the time of writing, these don't exist yet.
3535

3636
David Glover-Aoki
3737

Diff for: changelog.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
1.0:
2+
* Initial release
3+
4+
1.1:
5+
* X11 and LightDM modifications are skipped if X11 or LightDM are not found. This should allow use with the "Lite" OS image, but only in theory. In practice, the lite image doesn't have enough free space to install the extra packages. A problem for a future version.
6+
* Removed use of "curl" which is not always installed by default, use "wget" instead.
7+
* Fixed typos in readme.
8+
* Added changelog.txt.

Diff for: makecm4devterm

+43-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
# makecm4devterm
4+
# makecm4devterm v1.1
55
#
66
# David Glover-Aoki [email protected]
77
#
@@ -20,11 +20,29 @@ set -euo pipefail
2020

2121
function processroot {
2222
rootpath="$1"
23+
2324
echo "Creating bind mounts"
2425
mount --bind /dev "$rootpath/dev/"
2526
mount --bind /sys "$rootpath/sys/"
2627
mount --bind /proc "$rootpath/proc/"
2728
mount --bind /dev/pts "$rootpath/dev/pts"
29+
30+
echo "Installing ClockworkPi apt key"
31+
wget -nv "https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg" -O "$rootpath/etc/apt/trusted.gpg.d/clockworkpi.asc"
32+
echo "Installing ClockworkPi apt repo"
33+
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" >"$rootpath/etc/apt/sources.list.d/clockworkpi.list"
34+
35+
echo "Entering chroot"
36+
chroot "$rootpath" /bin/bash -euo pipefail <<EOF
37+
echo "Installing ClockworkPi packages"
38+
DEBIAN_FRONTEND=noninteractive apt-get -qq clean
39+
DEBIAN_FRONTEND=noninteractive apt-get -qq update
40+
DEBIAN_FRONTEND=noninteractive apt-get -qq install devterm-thermal-printer-cm4 devterm-thermal-printer-cups devterm-fan-temp-daemon-cm4 devterm-kernel-cm4-rpi devterm-audio-patch devterm-wiringpi-cm4-cpi
41+
echo "Leaving chroot"
42+
EOF
43+
# Somehow apt starts cupsd from inside the chroot. I don't know how, this feels like a bug.
44+
pgrep "cupsd" >/dev/null && killall -2 cupsd
45+
2846
echo "Configuring GNOME screen rotation"
2947
mkdir -p "$rootpath/etc/skel/.config"
3048
cat <<EOF >"$rootpath/etc/skel/.config/monitors.xml"
@@ -60,26 +78,26 @@ EOF
6078
owner_id=$(stat -c '%u' "$d")
6179
chown -R $owner_id "$d/.config"
6280
done
63-
echo "Installing ClockworkPi apt key"
64-
curl -sS "https://raw.githubusercontent.com/clockworkpi/apt/main/debian/KEY.gpg" >"$rootpath/etc/apt/trusted.gpg.d/clockworkpi.asc"
65-
echo "Installing ClockworkPi apt repo"
66-
echo "deb https://raw.githubusercontent.com/clockworkpi/apt/main/debian/ stable main" >"$rootpath/etc/apt/sources.list.d/clockworkpi.list"
67-
echo "Configuring X11 screen rotation"
68-
echo "xrandr --output DSI-1 --rotate right" >"$rootpath/etc/X11/Xsession.d/100custom_xrandr"
69-
echo "Configuring LightDM screen rotation"
70-
sed -i '/^#greeter-setup-script=/c\greeter-setup-script=/etc/lightdm/setup.sh' "$rootpath/etc/lightdm/lightdm.conf"
71-
echo "xrandr --output DSI-1 --rotate right" >"$rootpath/etc/lightdm/setup.sh"
72-
echo "exit 0" >>"$rootpath/etc/lightdm/setup.sh"
73-
chmod +x "$rootpath/etc/lightdm/setup.sh"
74-
echo "Entering chroot"
75-
chroot "$rootpath" /bin/bash -euo pipefail <<EOF
76-
echo "Installing ClockworkPi packages"
77-
DEBIAN_FRONTEND=noninteractive apt-get -qq update
78-
DEBIAN_FRONTEND=noninteractive apt-get -qq install devterm-thermal-printer-cm4 devterm-thermal-printer-cups devterm-fan-temp-daemon-cm4 devterm-kernel-cm4-rpi devterm-audio-patch devterm-wiringpi-cm4-cpi
79-
echo "Leaving chroot"
80-
EOF
81-
# Somehow apt starts cupsd from inside the chroot. I don't know how, this feels like a bug.
82-
pgrep "cupsd" >/dev/null && killall -2 cupsd
81+
82+
echo -n "Configuring X11 screen rotation: "
83+
if [[ -d "$rootpath/etc/X11" ]]; then
84+
echo "xrandr --output DSI-1 --rotate right" >"$rootpath/etc/X11/Xsession.d/100custom_xrandr"
85+
echo "OK"
86+
else
87+
echo "Skipped"
88+
fi
89+
90+
echo -n "Configuring LightDM screen rotation: "
91+
if [[ -d "$rootpath/etc/lightdm" ]]; then
92+
sed -i '/^#greeter-setup-script=/c\greeter-setup-script=/etc/lightdm/setup.sh' "$rootpath/etc/lightdm/lightdm.conf"
93+
echo "xrandr --output DSI-1 --rotate right" >"$rootpath/etc/lightdm/setup.sh"
94+
echo "exit 0" >>"$rootpath/etc/lightdm/setup.sh"
95+
chmod +x "$rootpath/etc/lightdm/setup.sh"
96+
echo "OK"
97+
else
98+
echo "Skipped"
99+
fi
100+
83101
echo "Configuring console screen rotation"
84102
sed -i '1s/$/ fbcon=rotate:1/' "$rootpath/boot/cmdline.txt"
85103
echo "Removing bind mounts"
@@ -123,6 +141,9 @@ xz -dc "$src" >"$workdir/devterm.img"
123141
echo "Mounting image"
124142
losetup -fP "$workdir/devterm.img"
125143

144+
# Partitions sometimes don't show up immediately, wait.
145+
sleep 1
146+
126147
echo "Checking partitions on image"
127148
mkdir -p "$workdir/mount/boot"
128149
for n in {1..3}; do
@@ -154,4 +175,4 @@ rm -rf "$workdir/mount"
154175
rm -rf "$workdir/loop0p"*
155176

156177
echo "Complete. Image is at:"
157-
echo "$workdir/devterm.img"
178+
echo "$workdir/devterm.img"

0 commit comments

Comments
 (0)