mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
* Init commit of setup scripts * Minor edit * Script edit and dir rename * Oops * Updated README * Updated scripts/readme * Additional Script/README updates * Further Script updates * BuildGuide updates * More git fuckery * Init commit of setup scripts * Minor edit * Script edit and dir rename * Oops * Updated scripts/readme * Script/README updates * Additional Script/README updates * Script/README edits * Copy script edit * Copy script edit * Filesystem script edit * More edits * Guide edit * Makefile * fixes ui build scripts to use submodules (#546) * fix product key generation Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Keagan McClelland <keagan.mcclelland@gmail.com>
58 lines
2.2 KiB
Bash
Executable File
58 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Write contents of LOOPDEV (Ubuntu image) to sd card and make filesystems, then detach the loop device
|
|
echo USING $LOOPDEV TO IMAGE $OUTPUT_DEVICE
|
|
sudo dd if=${LOOPDEV}p1 of=${OUTPUT_DEVICE}p1 bs=4096 conv=fsync status=progress
|
|
sudo mkfs.vfat -F 32 ${OUTPUT_DEVICE}p2
|
|
sudo dd if=${LOOPDEV}p2 of=${OUTPUT_DEVICE}p3 bs=4096 conv=fsync status=progress
|
|
sudo mkfs.ext4 ${OUTPUT_DEVICE}p4
|
|
|
|
sudo losetup -d $LOOPDEV
|
|
|
|
# Label the filesystems
|
|
sudo fatlabel ${OUTPUT_DEVICE}p1 system-boot
|
|
sudo fatlabel ${OUTPUT_DEVICE}p2 EMBASSY
|
|
sudo e2label ${OUTPUT_DEVICE}p3 writable
|
|
sudo e2label ${OUTPUT_DEVICE}p4 reserved
|
|
|
|
# Mount the boot partition and config
|
|
mkdir -p /tmp/eos-mnt
|
|
sudo mount ${OUTPUT_DEVICE}p1 /tmp/eos-mnt
|
|
|
|
cat /tmp/eos-mnt/config.txt | grep -v "dtoverlay=" | sudo tee /tmp/eos-mnt/config.txt.tmp
|
|
echo "dtoverlay=pwm-2chan" | sudo tee -a /tmp/eos-mnt/config.txt.tmp
|
|
sudo mv /tmp/eos-mnt/config.txt.tmp /tmp/eos-mnt/config.txt
|
|
|
|
# Unmount the boot partition and mount embassy partition
|
|
sudo umount /tmp/eos-mnt
|
|
sudo mount ${OUTPUT_DEVICE}p2 /tmp/eos-mnt
|
|
sudo cp product_key.txt /tmp/eos-mnt
|
|
sudo umount /tmp/eos-mnt
|
|
|
|
sudo mount ${OUTPUT_DEVICE}p3 /tmp/eos-mnt
|
|
# Enter the appmgr directory, copy over the built EmbassyOS binaries and systemd services, edit the nginx config, then create the .ssh directory
|
|
cd appmgr/
|
|
|
|
sudo cp target/aarch64-unknown-linux-gnu/release/embassy-init /tmp/eos-mnt/usr/local/bin
|
|
sudo cp target/aarch64-unknown-linux-gnu/release/embassyd /tmp/eos-mnt/usr/local/bin
|
|
sudo cp target/aarch64-unknown-linux-gnu/release/embassy-cli /tmp/eos-mnt/usr/local/bin
|
|
sudo cp *.service /tmp/eos-mnt/etc/systemd/system/
|
|
|
|
cd ..
|
|
|
|
# after performing npm run build
|
|
sudo mkdir -p /tmp/eos-mnt/var/www/html
|
|
sudo cp -R ui/www /tmp/eos-mnt/var/www/html/main
|
|
sudo cp -R setup-wizard/www /tmp/eos-mnt/var/www/html/setup
|
|
sudo cp -R diagnostic-ui/www /tmp/eos-mnt/var/www/html/diagnostic
|
|
|
|
# Make the .ssh directory
|
|
sudo mkdir -p /tmp/eos-mnt/root/.ssh
|
|
|
|
sudo cp ./build/initialization.sh /tmp/eos-mnt/usr/local/bin
|
|
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 umount /tmp/eos-mnt |