Browse Source

Add example Umbrel OS build

umbrel-os
Luke Childs 4 years ago
parent
commit
498321bdae
  1. 2
      .gitignore
  2. 6
      os/build.sh
  3. 64
      os/provision.sh
  4. 41
      os/raspberrypi.json

2
.gitignore

@ -33,6 +33,8 @@ logs/*
statuses/*
tor/*
app-data/*
os/packer_cache
os/*.img
# Commit these files

6
os/build.sh

@ -0,0 +1,6 @@
docker run \
--rm \
--privileged \
-v /dev:/dev \
-v ${PWD}:/build \
mkaczanowski/packer-builder-arm build raspberrypi.json

64
os/provision.sh

@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -euox pipefail
UMBREL_VERSION="v0.3.13"
UMBREL_ROOT="/home/umbrel/umbrel"
export DEBIAN_FRONTEND=noninteractive
# Setup Umbrel OS
# -----------------------
# Update package lists
apt-get update
# Set UMBREL_OS environment variable
# TODO: Find the correct place to set this
echo "UMBREL_OS=${UMBREL_VERSION}" >> /etc/environment
echo "export UMBREL_OS=${UMBREL_VERSION}" >> /etc/default/umbrel
# Change hostname to Umbrel
echo umbrel > /etc/hostname
# Install Avahi
apt-get install -y avahi-daemon avahi-discover libnss-mdns
# Create umbrel user
password_hash=$(perl -e 'print crypt("moneyprintergobrrr", "salt")')
useradd --create-home --groups sudo --password $password_hash umbrel
# Pi OS specific tweaks
# -----------------------
# Enable SSH
touch /boot/ssh
# Delete Pi user
pkill --euid pi || true
deluser --remove-home pi
# Umbrel installation
# -------------------
# Install Docker
apt-get install -y curl
curl -fsSL https://get.docker.com | sh
usermod --append --groups docker umbrel
# Install docker-compose
apt-get install -y python3-pip libffi-dev
pip3 install docker-compose
# Install Umbrel
apt-get install -y python3-qrcode fswatch rsync jq
mkdir "${UMBREL_ROOT}"
(
cd "${UMBREL_ROOT}" &&
curl -L "https://github.com/getumbrel/umbrel/archive/${UMBREL_VERSION}.tar.gz" | tar -xz --strip-components=1 &&
UMBREL_SYSTEMD_SERVICES="${UMBREL_ROOT}/scripts/umbrel-os/services/*.service"
for service_path in $UMBREL_SYSTEMD_SERVICES; do
service_name=$(basename "${service_path}")
install -m 644 "${service_path}" "/etc/systemd/system/${service_name}"
systemctl enable "${service_name}"
done
)

41
os/raspberrypi.json

@ -0,0 +1,41 @@
{
"variables": {},
"builders": [{
"type": "arm",
"file_urls" : ["https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2021-05-28/2021-05-07-raspios-buster-arm64-lite.zip"],
"file_checksum": "868cca691a75e4280c878eb6944d95e9789fa5f4bbce2c84060d4c39d057a042",
"file_checksum_type": "sha256",
"file_target_extension": "zip",
"image_build_method": "resize",
"image_path": "umbrel-os.img",
"image_size": "4G",
"image_type": "dos",
"image_partitions": [
{
"name": "boot",
"type": "c",
"start_sector": "8192",
"filesystem": "vfat",
"size": "256M",
"mountpoint": "/boot"
},
{
"name": "root",
"type": "83",
"start_sector": "532480",
"filesystem": "ext4",
"size": "0",
"mountpoint": "/"
}
],
"image_chroot_env": ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"],
"qemu_binary_source_path": "/usr/bin/qemu-aarch64-static",
"qemu_binary_destination_path": "/usr/bin/qemu-aarch64-static"
}],
"provisioners": [
{
"type": "shell",
"script": "provision.sh"
}
]
}
Loading…
Cancel
Save