Skip to content

Commit 0ad8839

Browse files
authored
first build (fixes #1) (#2)
1 parent 3a260ae commit 0ad8839

File tree

11 files changed

+149
-0
lines changed

11 files changed

+149
-0
lines changed

.github/workflows/build.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build Image
2+
3+
on:
4+
repository_dispatch:
5+
push:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Install Dependencies
12+
run: |
13+
sudo apt update
14+
sudo apt install coreutils p7zip-full qemu-user-static
15+
16+
- name: Checkout CustomPiOS
17+
uses: actions/checkout@v2
18+
with:
19+
repository: 'guysoft/CustomPiOS'
20+
path: CustomPiOS
21+
22+
- name: Checkout Project Repository
23+
uses: actions/checkout@v2
24+
with:
25+
path: repository
26+
submodules: true
27+
28+
- name: Download Raspios Lite ARM64 Image
29+
run: |
30+
cd repository/src/image
31+
wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-07/2022-09-06-raspios-bullseye-arm64-lite.img.xz'
32+
33+
- name: Update CustomPiOS Paths
34+
run: |
35+
cd repository/src
36+
../../CustomPiOS/src/update-custompios-paths
37+
38+
- name: Build Image
39+
run: |
40+
sudo modprobe loop
41+
cd repository/src
42+
sudo bash -x ./build_dist
43+
44+
- name: Copy output
45+
id: copy
46+
run: |
47+
source repository/src/config
48+
NOW=$(date +"%Y-%m-%d-%H%M")
49+
IMAGE=$NOW-cube-$DIST_VERSION
50+
cp repository/src/workspace/*.img $IMAGE.img
51+
gzip $IMAGE.img
52+
sync; sync; sync
53+
echo "::set-output name=image::$IMAGE"
54+
55+
- uses: actions/upload-artifact@v1
56+
with:
57+
name: ${{ steps.copy.outputs.image }}
58+
path: ${{ steps.copy.outputs.image }}.img.gz

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vscode
2+
.idea

src/build_dist

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! /bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
export DIST_PATH=${DIR}
6+
export CUSTOM_PI_OS_PATH=$(<${DIR}/custompios_path)
7+
export PATH=$PATH:$CUSTOM_PI_OS_PATH
8+
echo ${CUSTOM_PI_OS_PATH}
9+
10+
${CUSTOM_PI_OS_PATH}/build_custom_os $@

src/config

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export DIST_NAME=ebuc
2+
export DIST_VERSION=0.0.1
3+
export MODULES="base(cube)"
4+
5+
export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION}"
6+
export RPI_IMAGER_DESCRIPTION="A Raspberry Pi distribution for servers. Ships Planet out-of-the-box."
7+
export RPI_IMAGER_ICON="https://avatars.githubusercontent.com/u/33208073"
8+
9+
10+
export BASE_IMAGE_ENLARGEROOT=2000
11+
export BASE_IMAGE_RESIZEROOT=200

src/image/README

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Place zipped Raspberry Pi OS image here. Or any other variant you want to build/
2+
3+
If not otherwise specified, the build script will always use the most
4+
recent zip file matching the file name pattern "*-raspbian.zip" or "*-rpios.zip" or "*-rpios.xz" located
5+
here.

src/modules/cube/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BASE_ARCH=arm64
2+
BASE_USER=pi

src/modules/cube/filesystem/boot/test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/boot
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/pi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/root

src/modules/cube/filesystem/root/test

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/

src/modules/cube/start_chroot_script

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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

Comments
 (0)