mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
* Create BuildGuide.md * bug fixes * Update BuildGuide.md * Update make_image.sh * Update BuildGuide.md * Update make_image.sh additional improvements and "done" message added. Thanks @k0gen! * Update BuildGuide.md Added intro notes and made minor adjustments to the guide. * Update setup.sh Required adjustments to prevent reboot when following BuildGuide.md * Update BuildGuide.md Improvements to final setup steps * bug fix additional improvements and "done" message added. Thanks @k0gen! * Update Makefile Changes to facilitate building process when using the BuildGuide * Update BuildGuide.md Avoiding manual changes to Makefile and cleaning up step 7 * Update BuildGuide.md Switching from sftp to cp for one line command simplification * Update BuildGuide.md Simplified method of transferring .img to desktop. Thanks @k0gen! * Update BuildGuide.md update to latest openssl https://www.openssl.org/news/openssl-1.1.1-notes.html * Update BuildGuide.md Simplified step 6 and added new required dependency * Update BuildGuide.md Added hint on how to check `agent` log * Update setup.sh Added missing dependency * Update BuildGuide.md Simplified step 6 * Simplifying Rust installation One line install, reboot is no longer needed. * make_image.sh +x Make it executable before running * Step no longer needed chmod +x done by Makefile * Update BuildGuide.md Added dependency for Rust setup * Adding BuildGuide branch for the ease of use * Forgot about the guide file :) * Update BuildGuide.md apt -y by default and some environment add-ons Co-authored-by: Tommy Smith <63304263+t0mmysm1th@users.noreply.github.com>
51 lines
2.6 KiB
Bash
51 lines
2.6 KiB
Bash
#!/bin/bash
|
|
arch=$(uname -m)
|
|
if [[ $arch == armv7l ]]; then
|
|
dev_target="target"
|
|
else
|
|
dev_target="target/armv7-unknown-linux-musleabihf"
|
|
fi
|
|
mv buster.img embassy.img
|
|
product_key=$(cat product_key)
|
|
loopdev=$(losetup -f -P embassy.img --show)
|
|
root_mountpoint="/mnt/start9-${product_key}-root"
|
|
boot_mountpoint="/mnt/start9-${product_key}-boot"
|
|
mkdir -p "${root_mountpoint}"
|
|
mkdir -p "${boot_mountpoint}"
|
|
mount "${loopdev}p2" "${root_mountpoint}"
|
|
mount "${loopdev}p1" "${boot_mountpoint}"
|
|
mkdir -p "${root_mountpoint}/root/agent"
|
|
mkdir -p "${root_mountpoint}/etc/docker"
|
|
mkdir -p "${root_mountpoint}/home/pi/.ssh"
|
|
echo -n "" > "${root_mountpoint}/home/pi/.ssh/authorized_keys"
|
|
chown -R pi:pi "${root_mountpoint}/home/pi/.ssh"
|
|
echo -n "" > "${boot_mountpoint}/ssh"
|
|
echo "${product_key}" > "${root_mountpoint}/root/agent/product_key"
|
|
echo -n "start9-" > "${root_mountpoint}/etc/hostname"
|
|
echo -n "${product_key}" | shasum -t -a 256 | cut -c1-8 >> "${root_mountpoint}/etc/hostname"
|
|
cat "${root_mountpoint}/etc/hosts" | grep -v "127.0.1.1" > "${root_mountpoint}/etc/hosts.tmp"
|
|
echo -ne "127.0.1.1\tstart9-" >> "${root_mountpoint}/etc/hosts.tmp"
|
|
echo -n "${product_key}" | shasum -t -a 256 | cut -c1-8 >> "${root_mountpoint}/etc/hosts.tmp"
|
|
mv "${root_mountpoint}/etc/hosts.tmp" "${root_mountpoint}/etc/hosts"
|
|
cp agent/dist/agent "${root_mountpoint}/usr/local/bin/agent"
|
|
chmod 700 "${root_mountpoint}/usr/local/bin/agent"
|
|
cp "appmgr/${dev_target}/release/appmgr" "${root_mountpoint}/usr/local/bin/appmgr"
|
|
chmod 700 "${root_mountpoint}/usr/local/bin/appmgr"
|
|
cp "lifeline/${dev_target}/release/lifeline" "${root_mountpoint}/usr/local/bin/lifeline"
|
|
chmod 700 "${root_mountpoint}/usr/local/bin/lifeline"
|
|
cp docker-daemon.json "${root_mountpoint}/etc/docker/daemon.json"
|
|
cp setup.sh "${root_mountpoint}/root/setup.sh"
|
|
chmod 700 "${root_mountpoint}/root/setup.sh"
|
|
cp setup.service "${root_mountpoint}/etc/systemd/system/setup.service"
|
|
ln -s /etc/systemd/system/setup.service "${root_mountpoint}/etc/systemd/system/getty.target.wants/setup.service"
|
|
cp lifeline/lifeline.service "${root_mountpoint}/etc/systemd/system/lifeline.service"
|
|
cp agent/config/agent.service "${root_mountpoint}/etc/systemd/system/agent.service"
|
|
cat "${boot_mountpoint}/config.txt" | grep -v "dtoverlay=" > "${boot_mountpoint}/config.txt.tmp"
|
|
echo "dtoverlay=pwm-2chan" >> "${boot_mountpoint}/config.txt.tmp"
|
|
mv "${boot_mountpoint}/config.txt.tmp" "${boot_mountpoint}/config.txt"
|
|
umount "${root_mountpoint}"
|
|
rm -r "${root_mountpoint}"
|
|
umount "${boot_mountpoint}"
|
|
rm -r "${boot_mountpoint}"
|
|
losetup -d ${loopdev}
|
|
echo "DONE! Here is your EmbassyOS key: ${product_key}" |