Skip to content

Commit 8fa17fd

Browse files
authored
Merge pull request ignite#726 from tendermint/loopdisk-var
fix: starport rpi dev env
2 parents 4430f19 + 9f73b50 commit 8fa17fd

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

.pi/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ RUN useradd --create-home starport && \
77
usermod --append --groups wheel starport && \
88
passwd -e root
99

10+
USER starport
11+
12+
# Setup $PATH & GOPATH for more seamlessness
13+
RUN mkdir /home/starport/go && \
14+
echo "PATH=$PATH:/home/starport/go/bin" >> /home/starport/.bash_profile && \
15+
echo "GOPATH=/home/starport/go" >> /home/starport/.bash_profile
16+
17+
USER root
18+
1019

1120
# later, update to tendermint/starport
1221
COPY --from=tendermintdevelopment/starport /go/bin/starport /usr/bin/starport

.pi/build.sh

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# * we are not offering as many choices to users and are designing around automation.
1111
# Later we can make this work for more devices and platforms with nearly the same technique.
1212
# Reasonable build targets include: https://archlinuxarm.org/platforms/armv8
13-
# For example, the Odroid-N2 is the same software-wise as our Router!
13+
# For example, the Odroid-C2 is the same software-wise as our Router!
1414

1515
# Fail on error
1616
set -exo pipefail
@@ -46,31 +46,32 @@ sudo bash -c "echo starport > ./.tmp/result-rootfs/etc/hostname"
4646
# ===================================================================================
4747

4848

49-
# Unmount anything on the loop device
50-
sudo umount /dev/loop0p2 || true
51-
sudo umount /dev/loop0p1 || true
49+
# Unmount anything on the loop device (uncomment if building on metal and "working in a loop")
50+
# sudo umount /dev/loop0p2 || true
51+
# sudo umount /dev/loop0p1 || true
5252

53-
# Detach from the loop device
54-
sudo losetup -d /dev/loop0 || true
53+
# Detach from the loop device (uncomment if building on metal and "working in a loop")
54+
# sudo losetup -d /dev/loop0 || true
5555

56-
# Create a folder for images
57-
rm -rf images || true
58-
mkdir -p images
56+
# Create a folder for images (uncomment if building on metal and "working in a loop")
57+
# rm -rf images || true
58+
mkdir images
5959

6060
# Make the image file
6161
fallocate -l 4G "images/starport.img"
6262

63+
6364
# loop-mount the image file so it becomes a disk
64-
sudo losetup --find --show images/starport.img
65+
export LOOP=$(sudo losetup --find --show images/starport.img)
6566

6667
# partition the loop-mounted disk
67-
sudo parted --script /dev/loop0 mklabel msdos
68-
sudo parted --script /dev/loop0 mkpart primary fat32 0% 200M
69-
sudo parted --script /dev/loop0 mkpart primary ext4 200M 100%
68+
sudo parted --script $LOOP mklabel msdos
69+
sudo parted --script $LOOP mkpart primary fat32 0% 200M
70+
sudo parted --script $LOOP mkpart primary ext4 200M 100%
7071

7172
# format the newly partitioned loop-mounted disk
72-
sudo mkfs.vfat -F32 /dev/loop0p1
73-
sudo mkfs.ext4 -F /dev/loop0p2
73+
sudo mkfs.vfat -F32 $(echo $LOOP)p1
74+
sudo mkfs.ext4 -F $(echo $LOOP)p2
7475

7576
# Use the toolbox to copy the rootfs into the filesystem we formatted above.
7677
# * mount the disk's /boot and / partitions
@@ -79,12 +80,12 @@ sudo mkfs.ext4 -F /dev/loop0p2
7980
# soon will not use toolbox
8081

8182
sudo mkdir -p mnt/boot mnt/rootfs
82-
sudo mount /dev/loop0p1 mnt/boot
83-
sudo mount /dev/loop0p2 mnt/rootfs
83+
sudo mount $(echo $LOOP)p1 mnt/boot
84+
sudo mount $(echo $LOOP)p2 mnt/rootfs
8485
sudo rsync -a ./.tmp/result-rootfs/boot/* mnt/boot
8586
sudo rsync -a ./.tmp/result-rootfs/* mnt/rootfs --exclude boot
8687
sudo mkdir mnt/rootfs/boot
87-
sudo umount mnt/boot mnt/rootfs || true
88+
sudo umount mnt/boot mnt/rootfs
8889

89-
# Drop the loop mount
90-
sudo losetup -d /dev/loop0
90+
# Drop the loop mount (uncomment if building outside of Github Actions)
91+
# sudo losetup -d /dev/loop0

0 commit comments

Comments
 (0)