diff --git a/Dockerfile b/Dockerfile index 8cace22..bdda237 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ 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 RUN chown -R 1000:100 /opt/spiri-sdk #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 diff --git a/README.md b/README.md index 60d01d2..6d13921 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ There are two main ways of running this software. -Most users are recomended to install [VirtualBox](https://www.virtualbox.org/) and load the -virtual appliance file into it. +Most users are recomended to install [VirtualBox](https://www.virtualbox.org/), create a new +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 [distrobox](https://github.com/89luca89/distrobox) to better @@ -20,6 +21,7 @@ make px4_sitl gazebo-classic #Start the simulator # Building ```bash -docker build -t spiri-desktop-sdk ./ -./virtualize.sh spiri-desktop-sdk spiri-sdk.ova +#Note that because this is running in a container, the -o output flag must be relative to the current directory. +# We mount the current working directory in the docker container as part of this script. +./virtualize.sh build ./ -s 100gb -o sdk.vdi ``` diff --git a/ova-compose.yml b/ova-compose.yml index 5d37092..503f51c 100644 --- a/ova-compose.yml +++ b/ova-compose.yml @@ -4,7 +4,6 @@ system: os_vmw: other4xLinux64Guest firmware: efi secure_boot: false - # default_configuration: grande networks: vm_network: @@ -25,7 +24,7 @@ hardware: type: hard_disk parent: scsi1 #Set automatically as part of our pipeline, do not change - disk_image: /tmp/output.vmdk + disk_image: output.vmdk usb1: type: usb_controller # ethernet1: diff --git a/virtualize.sh b/virtualize.sh index 524092a..f729386 100755 --- a/virtualize.sh +++ b/virtualize.sh @@ -1,3 +1,31 @@ #!/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