-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.Pifile
92 lines (62 loc) · 2.71 KB
/
base.Pifile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Start with the base raspiOS-lite image
FROM images/source.img
TO images/base.img
ENV DEBIAN_FRONTEND noninteractive
user=pi
# Enable SSH
RUN touch /boot/ssh
hostname=kolibri
# Write hostname to /etc/hostname and /etc/hosts
RUN sed -i "s/raspberrypi/${hostname}/g" /etc/hostname
RUN sed -i "s/raspberrypi/${hostname}/g" /etc/hosts
echo "Done."
INSTALL 644 files/learningequality-ubuntu-kolibri-noble.list /etc/apt/sources.list.d/
# Copy the GPG key file into the Docker image
INSTALL 644 files/learningequality.gpg.key /tmp/learningequality.gpg.key
# Convert the GPG key to binary format
RUN bash -c 'gpg --dearmor < /tmp/learningequality.gpg.key > /tmp/learningequality.gpg'
# Install the binary GPG key to the trusted directory
RUN install -m 644 /tmp/learningequality.gpg /etc/apt/trusted.gpg.d/
# Clean up temporary files
RUN rm -f /tmp/learningequality.gpg /tmp/learningequality.gpg.key
RUN mkdir -p "/home/${user}/.kolibri"
RUN mkdir -p /KOLIBRI_DATA/content
INSTALL 644 files/options.ini "/home/${user}/.kolibri/"
RUN chown -R ${user}:${user} /KOLIBRI_DATA
RUN chmod -R +rwx /KOLIBRI_DATA
RUN chown -R ${user}:${user} /home/${user}
RUN chmod -R +rwx /home/${user}
RUN apt-get update
RUN apt-get install -y nginx-full uwsgi uwsgi-plugin-python3 redis-server dnsmasq hostapd
RUN debconf-set-selections <<EOF
$(cat files/debconf)
EOF
INSTALL files/wlan0 /etc/network/interfaces.d/wlan0
RUN systemctl restart networking
INSTALL files/dnsmasq_hotspot.conf /etc/dnsmasq.d/hotspot.conf
INSTALL files/hostapd.conf /etc/hostapd/hostapd.conf
INSTALL files/hostapd_5ghz.conf /etc/hostapd/hostapd_5ghz.conf
INSTALL 644 files/99-usb.rules /etc/udev/rules.d/99-usb.rules
INSTALL 755 files/usb-mount.sh /usr/local/bin/usb-mount.sh
INSTALL 755 files/[email protected] /etc/systemd/system/[email protected]
RUN tee /etc/default/hostapd <<EOF
DAEMON_CONF="/etc/hostapd/hostapd.conf"
EOF
RUN tee /etc/default/dnsmasq <<EOF
DNSMASQ_EXCEPT=lo
EOF
# latest debian version seems to have this line commented
RUN bash -c "sed -i 's/^#conf-dir=\\/etc\\/dnsmasq.d\\/,.*/conf-dir=\\/etc\\/dnsmasq.d\\/,*.conf/' /etc/dnsmasq.conf"
RUN rm /etc/nginx/sites-enabled/default
RUN systemctl enable hostapd
RUN systemctl enable dnsmasq
RUN systemctl enable nginx
RUN systemctl enable ssh
# Set kolibryfly password for specified user (pi by default)
RUN bash -c 'echo pi:\$6\$OUzfiWw5K8RdwdFV\$7Skel9ojIekqNSE/KVPIhemg9D.tQqoOF2BwZwIgZ/X0CTC0MJPbcUmzvnSSE3CkBdG2zsD1rCHSQ9yQCqVfr/ > /boot/firmware/userconf.txt'
# avoid keyboard setup questions blocking first boot:
RUN sh -c 'echo "keyboard-configuration keyboard-configuration/layout select English (US)" | sudo debconf-set-selections'
RUN tee -a /boot/firmware/cmdline.txt<<EOF
debconf=low
EOF
ENV DEBIAN_FRONTEND