Fixed build sudo priviliges

This commit is contained in:
B.J. Dweck 2020-11-02 12:00:10 +02:00
parent cce80e6fde
commit 20e1d72160
4 changed files with 13 additions and 9 deletions

3
.gitignore vendored
View File

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

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 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 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 ```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 ## Roadmap

View File

@ -16,9 +16,7 @@ $(cat src/user-data)
~" > build/cloud-init/user-data ~" > build/cloud-init/user-data
cp src/meta-data build/cloud-init/ cp src/meta-data build/cloud-init/
cp src/initial-setup.sh build/cloud-init/ cp src/*.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/
mkdir build/cloud-init/torch-config mkdir build/cloud-init/torch-config
cp -r $TORCH_CONFIG_DIR/* 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 tar -C build -czvf build/rpi-cloud-init.tgz cmdline.txt cloud-init
rm -rf build/cloud-init rm -rf build/cloud-init
rm build/cmdline.txt rm build/cmdline.txt

View File

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