|
| 1 | +#!/usr/bin/env bash |
| 2 | +# treehouses cube image generation script for CustomPiOS |
| 3 | +set -x |
| 4 | +set -e |
| 5 | + |
| 6 | +export LC_ALL=C |
| 7 | + |
| 8 | +source /common.sh |
| 9 | + |
| 10 | + |
| 11 | +unpack /filesystem/home/pi /home/"${BASE_USER}" "${BASE_USER}" |
| 12 | +unpack /filesystem/home/root /root root |
| 13 | +unpack /filesystem/boot /boot |
| 14 | + |
| 15 | +# for kubernetes |
| 16 | +sed -i -e 's#$# cgroup_memory=1 cgroup_enable=memory#' /boot/cmdline.txt |
| 17 | + |
| 18 | +apt update |
| 19 | + |
| 20 | +# in case we are building from a regular raspbian image instead of the lite one... |
| 21 | +remove_extra=$(remove_if_installed scratch squeak-plugins-scratch squeak-vm wolfram-engine python-minecraftpi minecraft-pi sonic-pi oracle-java8-jdk bluej libreoffice-common libreoffice-core freepats greenfoot nodered) |
| 22 | +echo "removing:" $remove_extra |
| 23 | +apt remove -y --purge $remove_extra |
| 24 | +apt autoremove -y |
| 25 | + |
| 26 | +apt install -y --force-yes git screen vim avahi-daemon curl autossh docker.io apt-transport-https |
| 27 | + |
| 28 | +curl -fsSL https://deb.nodesource.com/setup_18.x | bash - |
| 29 | +curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg |
| 30 | +echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list |
| 31 | +apt update |
| 32 | +apt install -y nodejs kubectl kubeadm kubelet |
| 33 | + |
| 34 | +mkdir -p /etc/bash_completion.d |
| 35 | +npm i -g @treehouses/cli |
| 36 | +mkdir -p /root/.ssh |
| 37 | +chmod go-rwx /root/.ssh |
| 38 | +treehouses sshkey github adduser dogi |
| 39 | +treehouses sshkey github adduser louhdy |
| 40 | +treehouses sshkey github adduser lanxel97 |
| 41 | +treehouses sshkey github adduser wesitos |
| 42 | +treehouses sshkey github adduser lmmrssa |
| 43 | +cp -R /root/.ssh /home/"${BASE_USER}" |
| 44 | +chown -R "${BASE_USER}": /home/"${BASE_USER}"/.ssh |
| 45 | + |
| 46 | +echo " - reinstall iputils-ping" |
| 47 | +apt install --reinstall iputils-ping |
| 48 | + |
| 49 | +# disable GUI at start |
| 50 | +#systemctl_if_exists disable lightdm.service || true |
| 51 | + |
| 52 | +#cleanup |
| 53 | +apt clean |
| 54 | +apt autoremove -y |
| 55 | + |
| 56 | +# unpack root again ;) |
| 57 | +unpack /filesystem/root / |
0 commit comments