Limited scope further, to just exporting a VDI image

This commit is contained in:
Alex Davies 2024-05-21 15:09:07 -03:00
parent 1e421a0de1
commit 292acdb45a
4 changed files with 46 additions and 8 deletions

View File

@ -15,7 +15,16 @@ RUN git clone --depth 1 -b v1.15.0-beta1 https://github.com/PX4/PX4-Autopilot.gi
WORKDIR /opt/spiri-sdk/PX4-Autopilot/ WORKDIR /opt/spiri-sdk/PX4-Autopilot/
RUN DONT_RUN=1 make px4_sitl gazebo-classic RUN DONT_RUN=1 make px4_sitl gazebo-classic
RUN apt-get install --yes virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
#This should be the first real user created and the `users` group on most linux distros #This should be the first real user created and the `users` group on most linux distros
RUN chown -R 1000:100 /opt/spiri-sdk RUN chown -R 1000:100 /opt/spiri-sdk
#Install our desktop environment last #Install our desktop environment last
RUN apt-get install --yes lxqt RUN apt-get install --yes lubuntu-qt-desktop
RUN apt-get remove --yes ubuntu-desktop
RUN useradd -m -s /bin/bash spiri && echo 'spiri:spiri-friend' | chpasswd
# Optional: Add spiri to sudo group if needed
RUN usermod -aG sudo spiri

View File

@ -3,8 +3,9 @@
There are two main ways of running this software. There are two main ways of running this software.
Most users are recomended to install [VirtualBox](https://www.virtualbox.org/) and load the Most users are recomended to install [VirtualBox](https://www.virtualbox.org/), create a new
virtual appliance file into it. VM, and use the supplied VDI as the disk image. You will likely want
to increase memory limits and CPU count above the default.
Advanced users can also use the SDK as a docker image. It pairs well with Advanced users can also use the SDK as a docker image. It pairs well with
[distrobox](https://github.com/89luca89/distrobox) to better [distrobox](https://github.com/89luca89/distrobox) to better
@ -20,6 +21,7 @@ make px4_sitl gazebo-classic #Start the simulator
# Building # Building
```bash ```bash
docker build -t spiri-desktop-sdk ./ #Note that because this is running in a container, the -o output flag must be relative to the current directory.
./virtualize.sh spiri-desktop-sdk spiri-sdk.ova # We mount the current working directory in the docker container as part of this script.
./virtualize.sh build ./ -s 100gb -o sdk.vdi
``` ```

View File

@ -4,7 +4,6 @@ system:
os_vmw: other4xLinux64Guest os_vmw: other4xLinux64Guest
firmware: efi firmware: efi
secure_boot: false secure_boot: false
# default_configuration: grande
networks: networks:
vm_network: vm_network:
@ -25,7 +24,7 @@ hardware:
type: hard_disk type: hard_disk
parent: scsi1 parent: scsi1
#Set automatically as part of our pipeline, do not change #Set automatically as part of our pipeline, do not change
disk_image: /tmp/output.vmdk disk_image: output.vmdk
usb1: usb1:
type: usb_controller type: usb_controller
# ethernet1: # ethernet1:

View File

@ -1,3 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v $PWD:/d2vm -w /d2vm git.spirirobotics.com/spiri/utils-docker_to_ovf:main $@ # Function to extract the output file from arguments
extract_output_file() {
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-o | --output)
output_file="$2"
shift # past argument
shift # past value
;;
*)
shift # past argument
;;
esac
done
}
# Extract the -o argument
extract_output_file "$@"
# Run the docker command
#docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v "$PWD":/d2vm -w /d2vm vmutil "$@"
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --privileged -v "$PWD":/d2vm -w /d2vm git.spirirobotics.com/spiri/utils-docker_to_ovf:2024-05-21 "$@"
# Change the ownership of the output file to the current user
if [[ -n "$output_file" ]]; then
echo "Setting permissions on file"
sudo chown $(whoami) "$output_file"
fi