mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
refactor build process (#1675)
* add nc-broadcast to view initialization.sh logs * include stderr * refactor build * add frontend/config.json as frontend dependency * fix nc-broadcast * always run all workflows * address dependabot alerts * fix build caching * remove registries.json * more efficient build
This commit is contained in:
@@ -8,6 +8,7 @@ Restart=on-failure
|
||||
RestartSec=5s
|
||||
ExecStart=/usr/local/bin/initialization.sh
|
||||
RemainAfterExit=true
|
||||
StandardOutput=append:/var/log/initialization.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -127,6 +127,7 @@ sed -i 's/^/usb-storage.quirks=152d:0562:u,14cd:121c:u,0781:cfcb:u /g' /boot/cmd
|
||||
# making that *sudo docker stats* command fulfil its purpose by displaying all metrics
|
||||
sed -i 's/rootwait quiet.*/rootwait cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory quiet/g' /boot/cmdline.txt
|
||||
|
||||
systemctl disable nc-broadcast.service
|
||||
systemctl disable initialization.service
|
||||
sudo systemctl restart NetworkManager
|
||||
|
||||
|
||||
13
build/nc-broadcast.service
Normal file
13
build/nc-broadcast.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Writes initialization logs to network
|
||||
Requires=initialization.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
ExecStart=/usr/local/bin/nc-broadcast --input=/var/log/initialization.log --tee 0.0.0.0:8080
|
||||
RemainAfterExit=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -3,4 +3,4 @@
|
||||
set -e
|
||||
|
||||
# Use fdisk to create DOS partition table with 4 primary partitions, set 1 as bootable, write, and quite
|
||||
(echo o; echo x; echo i; echo "0xcb15ae4d"; echo r; echo n; echo p; echo 1; echo 2048; echo 526335; echo t; echo c; echo n; echo p; echo 2; echo 526336; echo 1050623; echo t; echo 2; echo c; echo n; echo p; echo 3; echo 1050624; echo 16083455; echo n; echo p; echo 16083456; echo 31116287; echo a; echo 1; echo w) | sudo fdisk ${OUTPUT_DEVICE}
|
||||
(echo o; echo x; echo i; echo "0xcb15ae4d"; echo r; echo n; echo p; echo 1; echo 2048; echo 526335; echo t; echo c; echo n; echo p; echo 2; echo 526336; echo 1050623; echo t; echo 2; echo c; echo n; echo p; echo 3; echo 1050624; echo 16083455; echo n; echo p; echo 16083456; echo 31116287; echo a; echo 1; echo w) | sudo fdisk ${OUTPUT_DEVICE} > /dev/null
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
#cloud-config
|
||||
|
||||
# This is the user-data configuration file for cloud-init. By default this sets
|
||||
# up an initial user called "ubuntu" with password "ubuntu", which must be
|
||||
# changed at first login. However, many additional actions can be initiated on
|
||||
# first boot from this file. The cloud-init documentation has more details:
|
||||
#
|
||||
# https://cloudinit.readthedocs.io/
|
||||
#
|
||||
# Please note that the YAML format employed by this file is sensitive to
|
||||
# differences in whitespace; if you are editing this file in an editor (like
|
||||
# Notepad) which uses literal tabs, take care to only use spaces for
|
||||
# indentation. See the following link for more details:
|
||||
#
|
||||
# https://en.wikipedia.org/wiki/YAML
|
||||
#
|
||||
# Some additional examples are provided in comments below the default
|
||||
# configuration.
|
||||
|
||||
# On first boot, set the (default) ubuntu user's password to "ubuntu" and
|
||||
# expire user passwords
|
||||
#chpasswd:
|
||||
# expire: true
|
||||
# list:
|
||||
# - ubuntu:ubuntu
|
||||
|
||||
# Enable password authentication with the SSH daemon
|
||||
#ssh_pwauth: true
|
||||
|
||||
## On first boot, use ssh-import-id to give the specific users SSH access to
|
||||
## the default user
|
||||
#ssh_import_id:
|
||||
#- lp:my_launchpad_username
|
||||
#- gh:my_github_username
|
||||
|
||||
## Add users and groups to the system, and import keys with the ssh-import-id
|
||||
## utility
|
||||
#groups:
|
||||
#- robot: [robot]
|
||||
#- robotics: [robot]
|
||||
#- pi
|
||||
#
|
||||
#users:
|
||||
#- default
|
||||
#- name: robot
|
||||
# gecos: Mr. Robot
|
||||
# primary_group: robot
|
||||
# groups: users
|
||||
# ssh_import_id: foobar
|
||||
# lock_passwd: false
|
||||
# passwd: $5$hkui88$nvZgIle31cNpryjRfO9uArF7DYiBcWEnjqq7L1AQNN3
|
||||
|
||||
## Update apt database and upgrade packages on first boot
|
||||
#package_update: true
|
||||
#package_upgrade: true
|
||||
|
||||
## Install additional packages on first boot
|
||||
#packages:
|
||||
#- pwgen
|
||||
#- pastebinit
|
||||
#- [libpython2.7, 2.7.3-0ubuntu3.1]
|
||||
|
||||
## Write arbitrary files to the file-system (including binaries!)
|
||||
#write_files:
|
||||
#- path: /etc/default/keyboard
|
||||
# content: |
|
||||
# # KEYBOARD configuration file
|
||||
# # Consult the keyboard(5) manual page.
|
||||
# XKBMODEL="pc105"
|
||||
# XKBLAYOUT="gb"
|
||||
# XKBVARIANT=""
|
||||
# XKBOPTIONS="ctrl: nocaps"
|
||||
# permissions: '0644'
|
||||
# owner: root:root
|
||||
#- encoding: gzip
|
||||
# path: /usr/bin/hello
|
||||
# content: !!binary |
|
||||
# H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
|
||||
# owner: root:root
|
||||
# permissions: '0755'
|
||||
|
||||
## Run arbitrary commands at rc.local like time
|
||||
#runcmd:
|
||||
#- [ ls, -l, / ]
|
||||
#- [ sh, -xc, "echo $(date) ': hello world!'" ]
|
||||
#- [ wget, "http://ubuntu.com", -O, /run/mydir/index.html ]
|
||||
@@ -1,86 +0,0 @@
|
||||
#cloud-config
|
||||
|
||||
# This is the user-data configuration file for cloud-init. By default this sets
|
||||
# up an initial user called "ubuntu" with password "ubuntu", which must be
|
||||
# changed at first login. However, many additional actions can be initiated on
|
||||
# first boot from this file. The cloud-init documentation has more details:
|
||||
#
|
||||
# https://cloudinit.readthedocs.io/
|
||||
#
|
||||
# Please note that the YAML format employed by this file is sensitive to
|
||||
# differences in whitespace; if you are editing this file in an editor (like
|
||||
# Notepad) which uses literal tabs, take care to only use spaces for
|
||||
# indentation. See the following link for more details:
|
||||
#
|
||||
# https://en.wikipedia.org/wiki/YAML
|
||||
#
|
||||
# Some additional examples are provided in comments below the default
|
||||
# configuration.
|
||||
|
||||
# On first boot, set the (default) ubuntu user's password to "ubuntu" and
|
||||
# expire user passwords
|
||||
chpasswd:
|
||||
expire: true
|
||||
list:
|
||||
- ubuntu:ubuntu
|
||||
|
||||
# Enable password authentication with the SSH daemon
|
||||
ssh_pwauth: true
|
||||
|
||||
## On first boot, use ssh-import-id to give the specific users SSH access to
|
||||
## the default user
|
||||
#ssh_import_id:
|
||||
#- lp:my_launchpad_username
|
||||
#- gh:my_github_username
|
||||
|
||||
## Add users and groups to the system, and import keys with the ssh-import-id
|
||||
## utility
|
||||
#groups:
|
||||
#- robot: [robot]
|
||||
#- robotics: [robot]
|
||||
#- pi
|
||||
#
|
||||
#users:
|
||||
#- default
|
||||
#- name: robot
|
||||
# gecos: Mr. Robot
|
||||
# primary_group: robot
|
||||
# groups: users
|
||||
# ssh_import_id: foobar
|
||||
# lock_passwd: false
|
||||
# passwd: $5$hkui88$nvZgIle31cNpryjRfO9uArF7DYiBcWEnjqq7L1AQNN3
|
||||
|
||||
## Update apt database and upgrade packages on first boot
|
||||
#package_update: true
|
||||
#package_upgrade: true
|
||||
|
||||
## Install additional packages on first boot
|
||||
#packages:
|
||||
#- pwgen
|
||||
#- pastebinit
|
||||
#- [libpython2.7, 2.7.3-0ubuntu3.1]
|
||||
|
||||
## Write arbitrary files to the file-system (including binaries!)
|
||||
#write_files:
|
||||
#- path: /etc/default/keyboard
|
||||
# content: |
|
||||
# # KEYBOARD configuration file
|
||||
# # Consult the keyboard(5) manual page.
|
||||
# XKBMODEL="pc105"
|
||||
# XKBLAYOUT="gb"
|
||||
# XKBVARIANT=""
|
||||
# XKBOPTIONS="ctrl: nocaps"
|
||||
# permissions: '0644'
|
||||
# owner: root:root
|
||||
#- encoding: gzip
|
||||
# path: /usr/bin/hello
|
||||
# content: !!binary |
|
||||
# H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
|
||||
# owner: root:root
|
||||
# permissions: '0755'
|
||||
|
||||
## Run arbitrary commands at rc.local like time
|
||||
#runcmd:
|
||||
#- [ ls, -l, / ]
|
||||
#- [ sh, -xc, "echo $(date) ': hello world!'" ]
|
||||
#- [ wget, "http://ubuntu.com", -O, /run/mydir/index.html ]
|
||||
@@ -11,7 +11,7 @@ function partition_for () {
|
||||
}
|
||||
|
||||
# Write contents of LOOPDEV (Ubuntu image) to sd card and make filesystems, then detach the loop device
|
||||
echo USING $LOOPDEV TO IMAGE $OUTPUT_DEVICE
|
||||
echo USING $LOOPDEV TO IMAGE $OUTPUT_DEVICE WITH ENVIRONMENT $ENVIRONMENT
|
||||
sudo dd if=${LOOPDEV}p1 of=`partition_for ${OUTPUT_DEVICE} 1` bs=1M iflag=fullblock oflag=direct conv=fsync status=progress
|
||||
sudo mkfs.vfat -F 32 `partition_for ${OUTPUT_DEVICE} 2`
|
||||
sudo dd if=${LOOPDEV}p2 of=`partition_for ${OUTPUT_DEVICE} 3` bs=1M iflag=fullblock oflag=direct conv=fsync status=progress
|
||||
@@ -29,17 +29,11 @@ sudo e2label `partition_for ${OUTPUT_DEVICE} 4` blue
|
||||
mkdir -p /tmp/eos-mnt
|
||||
sudo mount `partition_for ${OUTPUT_DEVICE} 1` /tmp/eos-mnt
|
||||
|
||||
if [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
||||
sudo cp build/user-data-dev /tmp/eos-mnt/user-data
|
||||
else
|
||||
sudo cp build/user-data /tmp/eos-mnt/user-data
|
||||
fi
|
||||
|
||||
sudo sed -i 's/PARTUUID=cb15ae4d-02/PARTUUID=cb15ae4d-03/g' /tmp/eos-mnt/cmdline.txt
|
||||
sudo sed -i 's/ init=\/usr\/lib\/raspi-config\/init_resize.sh//g' /tmp/eos-mnt/cmdline.txt
|
||||
|
||||
cat /tmp/eos-mnt/config.txt | grep -v "dtoverlay=" | sudo tee /tmp/eos-mnt/config.txt.tmp
|
||||
echo "dtoverlay=pwm-2chan,disable-bt" | sudo tee -a /tmp/eos-mnt/config.txt.tmp
|
||||
cat /tmp/eos-mnt/config.txt | grep -v "dtoverlay=" | sudo tee /tmp/eos-mnt/config.txt.tmp > /dev/null
|
||||
echo "dtoverlay=pwm-2chan,disable-bt" | sudo tee -a /tmp/eos-mnt/config.txt.tmp > /dev/null
|
||||
sudo mv /tmp/eos-mnt/config.txt.tmp /tmp/eos-mnt/config.txt
|
||||
sudo touch /tmp/eos-mnt/ssh
|
||||
|
||||
@@ -51,10 +45,17 @@ sudo umount /tmp/eos-mnt
|
||||
|
||||
sudo mount `partition_for ${OUTPUT_DEVICE} 3` /tmp/eos-mnt
|
||||
|
||||
sudo mkdir /tmp/eos-mnt/media/boot-rw
|
||||
sudo mkdir /tmp/eos-mnt/embassy-os
|
||||
sudo mkdir /tmp/eos-mnt/media/boot-rw
|
||||
sudo mkdir /tmp/eos-mnt/embassy-os
|
||||
sudo mkdir /tmp/eos-mnt/etc/embassy
|
||||
sudo cp ENVIRONMENT.txt /tmp/eos-mnt/etc/embassy
|
||||
sudo cp GIT_HASH.txt /tmp/eos-mnt/etc/embassy
|
||||
sudo cp build/fstab /tmp/eos-mnt/etc/fstab
|
||||
sudo cp build/journald.conf /tmp/eos-mnt/etc/systemd/journald.conf
|
||||
|
||||
# copy over cargo dependencies
|
||||
sudo cp cargo-deps/aarch64-unknown-linux-gnu/release/nc-broadcast /tmp/eos-mnt/usr/local/bin
|
||||
|
||||
# Enter the backend directory, copy over the built EmbassyOS binaries and systemd services, edit the nginx config, then create the .ssh directory
|
||||
cd backend/
|
||||
|
||||
@@ -97,5 +98,7 @@ fi
|
||||
|
||||
sudo cp ./build/initialization.service /tmp/eos-mnt/etc/systemd/system/initialization.service
|
||||
sudo ln -s /etc/systemd/system/initialization.service /tmp/eos-mnt/etc/systemd/system/multi-user.target.wants/initialization.service
|
||||
sudo cp ./build/nc-broadcast.service /tmp/eos-mnt/etc/systemd/system/nc-broadcast.service
|
||||
sudo ln -s /etc/systemd/system/nc-broadcast.service /tmp/eos-mnt/etc/systemd/system/multi-user.target.wants/nc-broadcast.service
|
||||
|
||||
sudo umount /tmp/eos-mnt
|
||||
|
||||
Reference in New Issue
Block a user