Browse Source

Fixed build sudo priviliges

master
B.J. Dweck 11 months ago
parent
commit
20e1d72160
4 changed files with 13 additions and 9 deletions
  1. +2
    -1
      .gitignore
  2. +3
    -1
      README.md
  3. +2
    -4
      build.sh
  4. +6
    -3
      img-config.sh

+ 2
- 1
.gitignore View File

@ -1,3 +1,4 @@
/build/
parameters.env
*.img
*.img
*.img.*

+ 3
- 1
README.md View File

@ -48,8 +48,10 @@ tar -xzvf build/rpi-cloud-init.tgz -C /mnt/rpi-boot
Place a decompressed Ubuntu Server `*.img` file in the project directory and
use `img-config.sh` to both build the project and dope the boot partition of `*.img` file directly
**Note**: Must be run from an account with `sudo` permissions
```bash
sudo ./img-config.sh ubuntu-20.04.1-preinstalled-server-arm64+raspi.img
./img-config.sh ubuntu-20.04.1-preinstalled-server-arm64+raspi.img
```
## Roadmap

+ 2
- 4
build.sh View File

@ -16,9 +16,7 @@ $(cat src/user-data)
~" > build/cloud-init/user-data
cp src/meta-data build/cloud-init/
cp src/initial-setup.sh build/cloud-init/
cp src/install-torch.sh build/cloud-init/
cp src/torch-agent_0.0.4-1_all.deb build/cloud-init/
cp src/*.sh build/cloud-init/
mkdir build/cloud-init/torch-config
cp -r $TORCH_CONFIG_DIR/* build/cloud-init/torch-config/
@ -26,4 +24,4 @@ cp -r $TORCH_CONFIG_DIR/* build/cloud-init/torch-config/
tar -C build -czvf build/rpi-cloud-init.tgz cmdline.txt cloud-init
rm -rf build/cloud-init
rm build/cmdline.txt
rm build/cmdline.txt

+ 6
- 3
img-config.sh View File

@ -1,12 +1,15 @@
#!/bin/bash
[ $# -eq 0 ] && { echo "Usage: $0 IMG_FILE"; exit 1; }
SECTOR_BYTES=512
SECTOR_START=2048
OFFSET=$(($SECTOR_BYTES*$SECTOR_START))
./build.sh
mkdir -p boot-part
mount -o rw,loop,offset=$OFFSET $1 ./boot-part
sudo mount -o rw,loop,offset=$OFFSET $1 ./boot-part
tar -xzvf build/rpi-cloud-init.tgz -C boot-part
umount ./boot-part
rmdir ./boot-part
sudo umount ./boot-part
rmdir ./boot-part
rm -rf ./build

Loading…
Cancel
Save