mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
feature: 0.3.2 -> 0.3.3 upgrade (#1958)
* 0.3.2 -> 0.3.3 upgrade script * fix upgrade * integrated image * fix rip-image * no U option on older rsync * permissions and cleanup * fixes * label fs * fix progress reporting * only create rootfs for lite upgrade * shrink image after creating * fix for `blue` partitions
This commit is contained in:
7
Makefile
7
Makefile
@@ -3,7 +3,8 @@ ENVIRONMENT_FILE = $(shell ./check-environment.sh)
|
|||||||
GIT_HASH_FILE = $(shell ./check-git-hash.sh)
|
GIT_HASH_FILE = $(shell ./check-git-hash.sh)
|
||||||
EMBASSY_BINS := backend/target/$(ARCH)-unknown-linux-gnu/release/embassyd backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-init backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-cli backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-sdk backend/target/$(ARCH)-unknown-linux-gnu/release/avahi-alias libs/target/aarch64-unknown-linux-musl/release/embassy_container_init libs/target/x86_64-unknown-linux-musl/release/embassy_container_init
|
EMBASSY_BINS := backend/target/$(ARCH)-unknown-linux-gnu/release/embassyd backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-init backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-cli backend/target/$(ARCH)-unknown-linux-gnu/release/embassy-sdk backend/target/$(ARCH)-unknown-linux-gnu/release/avahi-alias libs/target/aarch64-unknown-linux-musl/release/embassy_container_init libs/target/x86_64-unknown-linux-musl/release/embassy_container_init
|
||||||
EMBASSY_UIS := frontend/dist/ui frontend/dist/setup-wizard frontend/dist/diagnostic-ui frontend/dist/install-wizard
|
EMBASSY_UIS := frontend/dist/ui frontend/dist/setup-wizard frontend/dist/diagnostic-ui frontend/dist/install-wizard
|
||||||
EMBASSY_SRC := backend/embassyd.service backend/embassy-init.service $(EMBASSY_UIS) $(shell find build)
|
BUILD_SRC := $(shell find build)
|
||||||
|
EMBASSY_SRC := backend/embassyd.service backend/embassy-init.service $(EMBASSY_UIS) $(BUILD_SRC)
|
||||||
COMPAT_SRC := $(shell find system-images/compat/ -not -path 'system-images/compat/target/*' -and -not -name *.tar -and -not -name target)
|
COMPAT_SRC := $(shell find system-images/compat/ -not -path 'system-images/compat/target/*' -and -not -name *.tar -and -not -name target)
|
||||||
UTILS_SRC := $(shell find system-images/utils/ -not -name *.tar)
|
UTILS_SRC := $(shell find system-images/utils/ -not -name *.tar)
|
||||||
BINFMT_SRC := $(shell find system-images/binfmt/ -not -name *.tar)
|
BINFMT_SRC := $(shell find system-images/binfmt/ -not -name *.tar)
|
||||||
@@ -61,6 +62,10 @@ embassyos-raspi.img: all raspios.img cargo-deps/aarch64-unknown-linux-gnu/releas
|
|||||||
! test -f embassyos-raspi.img || rm embassyos-raspi.img
|
! test -f embassyos-raspi.img || rm embassyos-raspi.img
|
||||||
./build/raspberry-pi/make-image.sh
|
./build/raspberry-pi/make-image.sh
|
||||||
|
|
||||||
|
lite-upgrade.img: raspios.img cargo-deps/aarch64-unknown-linux-gnu/release/nc-broadcast $(BUILD_SRC) update.img
|
||||||
|
! test -f lite-upgrade.img || rm lite-upgrade.img
|
||||||
|
./build/raspberry-pi/make-upgrade-image.sh
|
||||||
|
|
||||||
# For creating os images. DO NOT USE
|
# For creating os images. DO NOT USE
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(DESTDIR)/usr/bin
|
mkdir -p $(DESTDIR)/usr/bin
|
||||||
|
|||||||
12
build/raspberry-pi/033-upgrade.service
Normal file
12
build/raspberry-pi/033-upgrade.service
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Boot process for system initialization.
|
||||||
|
After=network-online.target systemd-time-wait-sync.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/bin/033-upgrade.sh
|
||||||
|
RemainAfterExit=true
|
||||||
|
StandardOutput=append:/var/log/initialization.log
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
68
build/raspberry-pi/033-upgrade.sh
Executable file
68
build/raspberry-pi/033-upgrade.sh
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if grep 'cb15ae4d-03' /boot/cmdline.txt; then
|
||||||
|
BLOCK_COUNT=$(tune2fs -l /dev/mmcblk0p3 | grep "^Block count:" | awk '{print $3}')
|
||||||
|
BLOCK_SIZE=$(tune2fs -l /dev/mmcblk0p3 | grep "^Block size:" | awk '{print $3}')
|
||||||
|
cat /dev/mmcblk0p3 | head -c $[$BLOCK_COUNT * $BLOCK_SIZE] > /dev/mmcblk0p4
|
||||||
|
sed -i 's/PARTUUID=cb15ae4d-03/PARTUUID=cb15ae4d-04/g' /boot/cmdline.txt
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /media/root-rw
|
||||||
|
mkfs.ext4 /dev/mmcblk0p3
|
||||||
|
mount /dev/mmcblk0p3 /media/root-rw
|
||||||
|
|
||||||
|
mkdir -p /embassy-os
|
||||||
|
mount /dev/mmcblk0p2 /embassy-os
|
||||||
|
|
||||||
|
mkdir -p /media/root-rw/config
|
||||||
|
mkdir -p /media/root-rw/current
|
||||||
|
mkdir -p /media/root-rw/next
|
||||||
|
rsync -acvAXUH --info=progress2 /embassy-os/ /media/root-rw/config/
|
||||||
|
rsync -acvAXUH --info=progress2 /update/ /media/root-rw/current/
|
||||||
|
rsync -acvAXUH --info=progress2 /media/root-rw/current/boot/ /boot/
|
||||||
|
cp /etc/machine-id /media/root-rw/current/etc/machine-id
|
||||||
|
cp /etc/ssh/ssh_host_rsa_key /media/root-rw/current/etc/ssh/ssh_host_rsa_key
|
||||||
|
cp /etc/ssh/ssh_host_rsa_key.pub /media/root-rw/current/etc/ssh/ssh_host_rsa_key.pub
|
||||||
|
cp /etc/ssh/ssh_host_ecdsa_key /media/root-rw/current/etc/ssh/ssh_host_ecdsa_key
|
||||||
|
cp /etc/ssh/ssh_host_ecdsa_key.pub /media/root-rw/current/etc/ssh/ssh_host_ecdsa_key.pub
|
||||||
|
cp /etc/ssh/ssh_host_ed25519_key /media/root-rw/current/etc/ssh/ssh_host_ed25519_key
|
||||||
|
cp /etc/ssh/ssh_host_ed25519_key.pub /media/root-rw/current/etc/ssh/ssh_host_ed25519_key.pub
|
||||||
|
|
||||||
|
sync
|
||||||
|
|
||||||
|
umount /embassy-os
|
||||||
|
umount /media/root-rw
|
||||||
|
|
||||||
|
fatlabel /dev/mmcblk0p1 boot
|
||||||
|
e2label /dev/mmcblk0p3 rootfs
|
||||||
|
|
||||||
|
(
|
||||||
|
echo d
|
||||||
|
echo 1
|
||||||
|
echo d
|
||||||
|
echo 2
|
||||||
|
echo n
|
||||||
|
echo p
|
||||||
|
echo 1
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo d
|
||||||
|
echo 3
|
||||||
|
echo d
|
||||||
|
echo 4
|
||||||
|
echo n
|
||||||
|
echo p
|
||||||
|
echo 2
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo t
|
||||||
|
echo 1
|
||||||
|
echo c
|
||||||
|
echo w
|
||||||
|
) | fdisk /dev/mmcblk0
|
||||||
|
|
||||||
|
reboot
|
||||||
@@ -6,6 +6,8 @@ function flatline {
|
|||||||
echo -n "2272727" > /sys/class/pwm/pwmchip0/pwm0/period
|
echo -n "2272727" > /sys/class/pwm/pwmchip0/pwm0/period
|
||||||
echo -n "1136364" > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
echo -n "1136364" > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
|
||||||
echo -n "1" > /sys/class/pwm/pwmchip0/pwm0/enable
|
echo -n "1" > /sys/class/pwm/pwmchip0/pwm0/enable
|
||||||
|
sleep 30
|
||||||
|
echo -n "0" > /sys/class/pwm/pwmchip0/pwm0/enable
|
||||||
}
|
}
|
||||||
|
|
||||||
initialization.sh
|
initialization.sh
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ function partition_for () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
cp raspios.img embassyos-raspi.img
|
TARGET_NAME=embassyos-raspi.img
|
||||||
truncate -s 3000000000 embassyos-raspi.img
|
TARGET_SIZE=2400000000
|
||||||
|
|
||||||
|
cp raspios.img $TARGET_NAME
|
||||||
|
truncate -s $TARGET_SIZE $TARGET_NAME
|
||||||
(
|
(
|
||||||
echo d
|
echo d
|
||||||
echo 2
|
echo 2
|
||||||
@@ -21,8 +24,8 @@ truncate -s 3000000000 embassyos-raspi.img
|
|||||||
echo 532480
|
echo 532480
|
||||||
echo
|
echo
|
||||||
echo w
|
echo w
|
||||||
) | fdisk embassyos-raspi.img
|
) | fdisk $TARGET_NAME
|
||||||
export OUTPUT_DEVICE=$(sudo losetup --show -fP embassyos-raspi.img)
|
export OUTPUT_DEVICE=$(sudo losetup --show -fP $TARGET_NAME)
|
||||||
sudo e2fsck -f -y `partition_for ${OUTPUT_DEVICE} 2`
|
sudo e2fsck -f -y `partition_for ${OUTPUT_DEVICE} 2`
|
||||||
sudo resize2fs `partition_for ${OUTPUT_DEVICE} 2`
|
sudo resize2fs `partition_for ${OUTPUT_DEVICE} 2`
|
||||||
./build/raspberry-pi/write-image.sh
|
./build/raspberry-pi/write-image.sh
|
||||||
|
|||||||
47
build/raspberry-pi/make-upgrade-image.sh
Executable file
47
build/raspberry-pi/make-upgrade-image.sh
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function partition_for () {
|
||||||
|
if [[ "$1" =~ [0-9]+$ ]]; then
|
||||||
|
echo "$1p$2"
|
||||||
|
else
|
||||||
|
echo "$1$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
TARGET_NAME=lite-upgrade.img
|
||||||
|
TARGET_SIZE=7000000000
|
||||||
|
|
||||||
|
LOOPDEV=$(sudo losetup --show -fP raspios.img)
|
||||||
|
sudo cat `partition_for ${LOOPDEV} 2` > $TARGET_NAME
|
||||||
|
sudo losetup -d $LOOPDEV
|
||||||
|
truncate -s $TARGET_SIZE $TARGET_NAME
|
||||||
|
sudo e2fsck -f -y $TARGET_NAME
|
||||||
|
sudo resize2fs $TARGET_NAME
|
||||||
|
|
||||||
|
TMPDIR=$(mktemp -d)
|
||||||
|
mkdir $TMPDIR/target
|
||||||
|
mkdir $TMPDIR/source
|
||||||
|
|
||||||
|
sudo mount update.img $TMPDIR/source
|
||||||
|
|
||||||
|
sudo mount $TARGET_NAME $TMPDIR/target
|
||||||
|
|
||||||
|
sudo mkdir -p $TMPDIR/target/update
|
||||||
|
sudo rsync -acvAXH $TMPDIR/source/ $TMPDIR/target/update/
|
||||||
|
sudo cp ./build/raspberry-pi/033-upgrade.sh $TMPDIR/target/usr/local/bin/033-upgrade.sh
|
||||||
|
sudo cp ./build/raspberry-pi/033-upgrade.service $TMPDIR/target/etc/systemd/system/033-upgrade.service
|
||||||
|
sudo ln -s /etc/systemd/system/033-upgrade.service $TMPDIR/target/etc/systemd/system/multi-user.target.wants/033-upgrade.service
|
||||||
|
sudo cp ./build/raspberry-pi/nc-broadcast.service $TMPDIR/target/etc/systemd/system/nc-broadcast.service
|
||||||
|
sudo ln -s /etc/systemd/system/nc-broadcast.service $TMPDIR/target/etc/systemd/system/multi-user.target.wants/nc-broadcast.service
|
||||||
|
|
||||||
|
sudo umount $TMPDIR/target
|
||||||
|
|
||||||
|
sudo e2fsck -f -y $TARGET_NAME
|
||||||
|
sudo resize2fs -M $TARGET_NAME
|
||||||
|
BLOCK_INFO=$(sudo dumpe2fs $TARGET_NAME)
|
||||||
|
BLOCK_COUNT=$(echo "$BLOCK_INFO" | grep "Block count:" | sed 's/Block count:\s\+//g')
|
||||||
|
BLOCK_SIZE=$(echo "$BLOCK_INFO" | grep "Block size:" | sed 's/Block size:\s\+//g')
|
||||||
|
FS_SIZE=$[$BLOCK_COUNT*$BLOCK_SIZE]
|
||||||
|
truncate -s $FS_SIZE $TARGET_NAME
|
||||||
@@ -2,51 +2,12 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
function mktmpfifo () {
|
TMPDIR=$(mktemp -d)
|
||||||
TMP_PATH=$(mktemp)
|
|
||||||
rm $TMP_PATH
|
|
||||||
mkfifo $TMP_PATH
|
|
||||||
echo $TMP_PATH
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! which pv > /dev/null; then
|
ROOT_PARTITION=$(readlink -f /dev/disk/by-label/rootfs)
|
||||||
>&2 echo 'This script would like to use `pv` to show a progress indicator, but it is not installed.'
|
BOOT_PARTITION=$(readlink -f /dev/disk/by-label/boot)
|
||||||
if which apt-get > /dev/null; then
|
|
||||||
read -p "Install? [y/N]" -n 1 -r
|
|
||||||
echo
|
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
|
||||||
sudo apt-get install pv
|
|
||||||
fi
|
|
||||||
elif which pacman > /dev/null; then
|
|
||||||
read -p "Install? [y/N]" -n 1 -r
|
|
||||||
echo
|
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
|
||||||
sudo pacman -S pv
|
|
||||||
fi
|
|
||||||
elif which brew > /dev/null; then
|
|
||||||
read -p "Install? [y/N]" -n 1 -r
|
|
||||||
echo
|
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
|
||||||
brew install pv
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
>&2 echo 'This script does not recognize what package manager you have available on your system.'
|
|
||||||
>&2 echo 'Please go install the utility manually if you want progress reporting.'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then
|
if [[ "$ROOT_PARTITION" =~ ^/dev/loop ]] || [[ "$BOOT_PARTITION" =~ ^/dev/loop ]]; then
|
||||||
>&2 echo 'OSX not supported'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! test -e /dev/disk/by-label/green; then
|
|
||||||
>&2 echo '`green` partition not found'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export SOURCE_PARTITION=$(readlink -f /dev/disk/by-label/green)
|
|
||||||
|
|
||||||
if [[ "$SOURCE_PARTITION" =~ ^/dev/loop ]]; then
|
|
||||||
>&2 echo 'You are currently ripping from a loop device.'
|
>&2 echo 'You are currently ripping from a loop device.'
|
||||||
>&2 echo 'This is probably a mistake, and usually means you failed to detach a .img file.'
|
>&2 echo 'This is probably a mistake, and usually means you failed to detach a .img file.'
|
||||||
read -p "Continue anyway? [y/N]" -n 1 -r
|
read -p "Continue anyway? [y/N]" -n 1 -r
|
||||||
@@ -56,46 +17,35 @@ if [[ "$SOURCE_PARTITION" =~ ^/dev/loop ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo e2fsck -f ${SOURCE_PARTITION}
|
mkdir -p $TMPDIR/source
|
||||||
sudo resize2fs -M ${SOURCE_PARTITION}
|
mkdir -p $TMPDIR/target
|
||||||
export BLOCK_INFO=$(sudo dumpe2fs ${SOURCE_PARTITION})
|
|
||||||
export BLOCK_COUNT=$(echo "$BLOCK_INFO" | grep "Block count:" | sed 's/Block count:\s\+//g')
|
|
||||||
export BLOCK_SIZE=$(echo "$BLOCK_INFO" | grep "Block size:" | sed 's/Block size:\s\+//g')
|
|
||||||
export FS_SIZE=$[$BLOCK_COUNT*$BLOCK_SIZE]
|
|
||||||
|
|
||||||
echo "Ripping $FS_SIZE bytes from $SOURCE_PARTITION"
|
rm -f update.img
|
||||||
if which pv > /dev/null; then
|
truncate -s 5000000000 update.img
|
||||||
sudo cat ${SOURCE_PARTITION} | head -c $FS_SIZE | pv -s $FS_SIZE | sudo dd of=update.img bs=1M iflag=fullblock oflag=direct conv=fsync 2>/dev/null
|
mkfs.ext4 update.img
|
||||||
else
|
e2label update.img rootfs
|
||||||
sudo cat ${SOURCE_PARTITION} | head -c $FS_SIZE | sudo dd of=update.img bs=1M iflag=fullblock oflag=direct conv=fsync
|
sudo mount update.img $TMPDIR/target/
|
||||||
fi
|
|
||||||
echo Verifying...
|
|
||||||
export INPUT_HASH=$(mktemp)
|
|
||||||
export OUTPUT_HASH=$(mktemp)
|
|
||||||
if which pv > /dev/null; then
|
|
||||||
export PV_IN=$(mktmpfifo)
|
|
||||||
fi
|
|
||||||
sudo cat ${SOURCE_PARTITION} | head -c $FS_SIZE | tee -a $PV_IN | sha256sum > $INPUT_HASH &
|
|
||||||
export INPUT_CHILD=$!
|
|
||||||
sudo cat update.img | head -c $FS_SIZE | tee -a $PV_IN | sha256sum > $OUTPUT_HASH &
|
|
||||||
export OUTPUT_CHILD=$!
|
|
||||||
if which pv > /dev/null; then
|
|
||||||
pv -s $[$FS_SIZE*2] < $PV_IN > /dev/null &
|
|
||||||
fi
|
|
||||||
wait $INPUT_CHILD $OUTPUT_CHILD
|
|
||||||
if which pv > /dev/null; then
|
|
||||||
rm $PV_IN
|
|
||||||
fi
|
|
||||||
if ! [[ "$(cat $INPUT_HASH)" == "$(cat $OUTPUT_HASH)" ]]; then
|
|
||||||
rm $INPUT_HASH $OUTPUT_HASH
|
|
||||||
>&2 echo Verification Failed
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm $INPUT_HASH $OUTPUT_HASH
|
|
||||||
echo "Verification Succeeded"
|
|
||||||
|
|
||||||
sudo e2label update.img red
|
sudo mount $ROOT_PARTITION $TMPDIR/source/
|
||||||
echo "Image Relabeled to \"red\""
|
sudo mount $BOOT_PARTITION $TMPDIR/source/current/boot/
|
||||||
|
sudo rsync -acvAXH --info=progress2 $TMPDIR/source/current/ $TMPDIR/target/
|
||||||
|
|
||||||
|
sudo sed -i 's/PARTUUID=[a-f0-9]+/PARTUUID=cb15ae4d/g' $TMPDIR/target/etc/fstab
|
||||||
|
sudo sed -i 's/PARTUUID=[a-f0-9]+/PARTUUID=cb15ae4d/g' $TMPDIR/target/boot/cmdline.txt
|
||||||
|
|
||||||
|
sudo umount $TMPDIR/source/current/boot/
|
||||||
|
sudo umount $TMPDIR/source/
|
||||||
|
sudo umount $TMPDIR/target
|
||||||
|
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
|
||||||
|
sudo e2fsck -f -y update.img
|
||||||
|
sudo resize2fs -M update.img
|
||||||
|
BLOCK_INFO=$(sudo dumpe2fs update.img)
|
||||||
|
BLOCK_COUNT=$(echo "$BLOCK_INFO" | grep "Block count:" | sed 's/Block count:\s\+//g')
|
||||||
|
BLOCK_SIZE=$(echo "$BLOCK_INFO" | grep "Block size:" | sed 's/Block size:\s\+//g')
|
||||||
|
FS_SIZE=$[$BLOCK_COUNT*$BLOCK_SIZE]
|
||||||
|
truncate -s $FS_SIZE update.img
|
||||||
|
|
||||||
echo "Compressing..."
|
echo "Compressing..."
|
||||||
if which pv > /dev/null; then
|
if which pv > /dev/null; then
|
||||||
|
|||||||
@@ -11,45 +11,45 @@ function partition_for () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Mount the boot partition and config
|
# Mount the boot partition and config
|
||||||
mkdir -p /tmp/eos-mnt
|
TMPDIR=$(mktemp -d)
|
||||||
sudo mount `partition_for ${OUTPUT_DEVICE} 1` /tmp/eos-mnt
|
sudo mount `partition_for ${OUTPUT_DEVICE} 1` $TMPDIR
|
||||||
|
|
||||||
cat /tmp/eos-mnt/config.txt | grep -v "dtoverlay=" | sudo tee /tmp/eos-mnt/config.txt.tmp > /dev/null
|
cat $TMPDIR/config.txt | grep -v "dtoverlay=" | sudo tee $TMPDIR/config.txt.tmp > /dev/null
|
||||||
echo "dtoverlay=pwm-2chan,disable-bt" | sudo tee -a /tmp/eos-mnt/config.txt.tmp > /dev/null
|
echo "dtoverlay=pwm-2chan,disable-bt" | sudo tee -a $TMPDIR/config.txt.tmp > /dev/null
|
||||||
echo "gpu_mem=16" | sudo tee -a /tmp/eos-mnt/config.txt.tmp > /dev/null
|
echo "gpu_mem=16" | sudo tee -a $TMPDIR/config.txt.tmp > /dev/null
|
||||||
sudo mv /tmp/eos-mnt/config.txt.tmp /tmp/eos-mnt/config.txt
|
sudo mv $TMPDIR/config.txt.tmp $TMPDIR/config.txt
|
||||||
sudo touch /tmp/eos-mnt/ssh
|
sudo touch $TMPDIR/ssh
|
||||||
|
|
||||||
sudo umount /tmp/eos-mnt
|
sudo umount $TMPDIR
|
||||||
|
|
||||||
sudo mount `partition_for ${OUTPUT_DEVICE} 2` /tmp/eos-mnt
|
sudo mount `partition_for ${OUTPUT_DEVICE} 2` $TMPDIR
|
||||||
|
|
||||||
sudo mkdir /tmp/eos-mnt/media/embassy/
|
sudo mkdir $TMPDIR/media/embassy/
|
||||||
sudo make install ARCH=aarch64 DESTDIR=/tmp/eos-mnt
|
sudo make install ARCH=aarch64 DESTDIR=$TMPDIR
|
||||||
sudo sed -i 's/raspberrypi/embassy/g' /tmp/eos-mnt/etc/hostname
|
sudo sed -i 's/raspberrypi/embassy/g' $TMPDIR/etc/hostname
|
||||||
sudo sed -i 's/raspberrypi/embassy/g' /tmp/eos-mnt/etc/hosts
|
sudo sed -i 's/raspberrypi/embassy/g' $TMPDIR/etc/hosts
|
||||||
sudo cp cargo-deps/aarch64-unknown-linux-gnu/release/nc-broadcast /tmp/eos-mnt/usr/local/bin
|
sudo cp cargo-deps/aarch64-unknown-linux-gnu/release/nc-broadcast $TMPDIR/usr/local/bin
|
||||||
sudo cp backend/*.service /tmp/eos-mnt/etc/systemd/system/
|
sudo cp backend/*.service $TMPDIR/etc/systemd/system/
|
||||||
sudo mkdir -p /tmp/eos-mnt/etc/embassy
|
sudo mkdir -p $TMPDIR/etc/embassy
|
||||||
sudo cp build/raspberry-pi/config.yaml /tmp/eos-mnt/etc/embassy/config.yaml
|
sudo cp build/raspberry-pi/config.yaml $TMPDIR/etc/embassy/config.yaml
|
||||||
|
|
||||||
# Make the .ssh directory for UID 1000 user
|
# Make the .ssh directory for UID 1000 user
|
||||||
sudo mkdir -p /tmp/eos-mnt/home/$(awk -v val=1000 -F ":" '$3==val{print $1}' /tmp/eos-mnt/etc/passwd)/.ssh
|
sudo mkdir -p $TMPDIR/home/$(awk -v val=1000 -F ":" '$3==val{print $1}' $TMPDIR/etc/passwd)/.ssh
|
||||||
sudo mv /tmp/eos-mnt/etc/sudoers.d/010_pi-nopasswd /tmp/eos-mnt/etc/sudoers.d/010_start9-nopasswd
|
sudo mv $TMPDIR/etc/sudoers.d/010_pi-nopasswd $TMPDIR/etc/sudoers.d/010_start9-nopasswd
|
||||||
sudo sed -i 's/pi/start9/g' /tmp/eos-mnt/etc/sudoers.d/010_start9-nopasswd
|
sudo sed -i 's/pi/start9/g' $TMPDIR/etc/sudoers.d/010_start9-nopasswd
|
||||||
sudo sed -i 's/ pi / start9 /g' /tmp/eos-mnt/etc/systemd/system/autologin@.service
|
sudo sed -i 's/ pi / start9 /g' $TMPDIR/etc/systemd/system/autologin@.service
|
||||||
|
|
||||||
if [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
if [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
||||||
cat ./build/raspberry-pi/initialization.sh | grep -v "passwd -l start9" | sudo tee /tmp/eos-mnt/usr/local/bin/initialization.sh > /dev/null
|
cat ./build/raspberry-pi/initialization.sh | grep -v "passwd -l start9" | sudo tee $TMPDIR/usr/local/bin/initialization.sh > /dev/null
|
||||||
sudo chmod +x /tmp/eos-mnt/usr/local/bin/initialization.sh
|
sudo chmod +x $TMPDIR/usr/local/bin/initialization.sh
|
||||||
else
|
else
|
||||||
sudo cp ./build/raspberry-pi/initialization.sh /tmp/eos-mnt/usr/local/bin
|
sudo cp ./build/raspberry-pi/initialization.sh $TMPDIR/usr/local/bin
|
||||||
fi
|
fi
|
||||||
sudo cp ./build/raspberry-pi/init-with-sound.sh /tmp/eos-mnt/usr/local/bin
|
sudo cp ./build/raspberry-pi/init-with-sound.sh $TMPDIR/usr/local/bin
|
||||||
|
|
||||||
sudo cp ./build/raspberry-pi/initialization.service /tmp/eos-mnt/etc/systemd/system/initialization.service
|
sudo cp ./build/raspberry-pi/initialization.service $TMPDIR/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 ln -s /etc/systemd/system/initialization.service $TMPDIR/etc/systemd/system/multi-user.target.wants/initialization.service
|
||||||
sudo cp ./build/raspberry-pi/nc-broadcast.service /tmp/eos-mnt/etc/systemd/system/nc-broadcast.service
|
sudo cp ./build/raspberry-pi/nc-broadcast.service $TMPDIR/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 ln -s /etc/systemd/system/nc-broadcast.service $TMPDIR/etc/systemd/system/multi-user.target.wants/nc-broadcast.service
|
||||||
|
|
||||||
sudo umount /tmp/eos-mnt
|
sudo umount $TMPDIR
|
||||||
|
|||||||
Reference in New Issue
Block a user