-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts to build a custom Pi SD card image.
- Loading branch information
Showing
10 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ node_modules | |
|
||
*.sw* | ||
*~ | ||
|
||
deploy/pi-sdcard/pi-gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
|
||
git clone https://github.com/RPi-Distro/pi-gen | ||
cd pi-gen | ||
git fetch | ||
git fetch --tags | ||
git checkout 2020-02-13-raspbian-buster | ||
cp ../config config | ||
cp -a ../stage-gymnasticon stage-gymnasticon | ||
touch stage2/SKIP_IMAGES | ||
./build-docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
IMG_NAME=Gymnasticon | ||
RELEASE=buster | ||
LOCALE_DEFAULT=en_US.UTF-8 | ||
TARGET_HOSTNAME=gymnasticon | ||
KEYBOARD_KEYMAP=us | ||
KEYBOARD_LAYOUT="English (US)" | ||
TIMEZONE_DEFAULT=US/Eastern | ||
FIRST_USER_NAME=pi | ||
FIRST_USER_PASS=raspberry | ||
ENABLE_SSH=0 | ||
STAGE_LIST="stage0 stage1 stage2 stage-gymnasticon" |
1 change: 1 addition & 0 deletions
1
deploy/pi-sdcard/stage-gymnasticon/00-install-gymnasticon/00-packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
libudev-dev |
33 changes: 33 additions & 0 deletions
33
deploy/pi-sdcard/stage-gymnasticon/00-install-gymnasticon/01-run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash -e | ||
|
||
NODE_SHASUM256=de4440edf147d6b534b7dea61ef2e05eb8b7844dec93bdf324ce2c83cf7a7f3c | ||
NODE_URL=https://unofficial-builds.nodejs.org/download/release/v12.18.3/node-v12.18.3-linux-armv6l.tar.gz | ||
GYMNASTICON_USER=${FIRST_USER_NAME} | ||
GYMNASTICON_GROUP=${FIRST_USER_NAME} | ||
|
||
if [ ! -x "${ROOTFS_DIR}/opt/gymnasticon/node/bin/node" ] ; then | ||
TMPD=$(mktemp -d) | ||
trap 'rm -rf $TMPD' EXIT | ||
cd $TMPD | ||
curl -Lo node.tar.gz ${NODE_URL} | ||
sha256sum -c <(echo "$NODE_SHASUM256 node.tar.gz") | ||
install -v -m 644 "$TMPD/node.tar.gz" "${ROOTFS_DIR}/tmp/node.tar.gz" | ||
on_chroot <<EOF | ||
mkdir -p /opt/gymnasticon/node | ||
cd /opt/gymnasticon/node | ||
tar zxvf /tmp/node.tar.gz --strip 1 | ||
chown -R "${GYMNASTICON_USER}:${GYMNASTICON_GROUP}" /opt/gymnasticon | ||
EOF | ||
fi | ||
|
||
on_chroot <<EOF | ||
su ${GYMNASTICON_USER} -c 'export PATH=/opt/gymnasticon/node/bin:\$PATH; /opt/gymnasticon/node/bin/npm install -g gymnasticon' | ||
EOF | ||
|
||
install -v -m 644 files/gymnasticon.service "${ROOTFS_DIR}/etc/systemd/system/gymnasticon.service" | ||
|
||
on_chroot <<EOF | ||
systemctl enable gymnasticon | ||
EOF | ||
|
||
install -v -m 644 files/motd "${ROOTFS_DIR}/etc/motd" |
21 changes: 21 additions & 0 deletions
21
deploy/pi-sdcard/stage-gymnasticon/00-install-gymnasticon/files/gymnasticon.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[Unit] | ||
Description=Gymnasticon | ||
After=bluetooth.target | ||
Requires=bluetooth.target | ||
|
||
[Service] | ||
Type=simple | ||
Environment=PATH=/opt/gymnasticon/node/bin | ||
WorkingDirectory=/opt/gymnasticon | ||
User=pi | ||
Group=pi | ||
ExecStart=/opt/gymnasticon/node/bin/gymnasticon | ||
RestartSec=1 | ||
Restart=on-failure | ||
|
||
AmbientCapabilities=CAP_NET_RAW CAP_NET_ADMIN | ||
NoNewPrivileges=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
6 changes: 6 additions & 0 deletions
6
deploy/pi-sdcard/stage-gymnasticon/00-install-gymnasticon/files/motd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
____ _ _ | ||
/ ___|_ _ _ __ ___ _ __ __ _ ___| |_(_) ___ ___ _ __ | ||
| | _| | | | '_ ` _ \| '_ \ / _` / __| __| |/ __/ _ \| '_ \ | ||
| |_| | |_| | | | | | | | | | (_| \__ \ |_| | (_| (_) | | | | | ||
\____|\__, |_| |_| |_|_| |_|\__,_|___/\__|_|\___\___/|_| |_| | ||
|___/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
IMG_SUFFIX="-lite" | ||
if [ "${USE_QEMU}" = "1" ]; then | ||
export IMG_SUFFIX="${IMG_SUFFIX}-qemu" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NOOBS_NAME="Gymnasticon Lite" | ||
NOOBS_DESCRIPTION="Raspbian Lite with Gymnasticon pre-installed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -e | ||
|
||
if [ ! -d "${ROOTFS_DIR}" ]; then | ||
copy_previous | ||
fi |