From b912a9686820e874af141e09dbf604f56369c099 Mon Sep 17 00:00:00 2001 From: Alex Davies Date: Tue, 18 Jun 2024 15:09:29 -0300 Subject: [PATCH] Fix permissions --- Dockerfile | 11 ++++++++--- skel/Desktop/simulated-drone/sim_drone.py | 10 ++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index b20d053..c1f90f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN make px4_sitl_default RUN pip3 install typer-slim loguru sh #Remove the ubuntu GUI and replace it with lxqt -RUN apt-get purge ubuntu-desktop gdm3 --yes +RUN apt-get purge ubuntu-desktop gdm3 mutter --yes RUN apt-get install --yes virtualbox-guest-dkms virtualbox-guest-utils spice-vdagent qemu-guest-agent RUN apt-get install --yes docker-compose-v2 @@ -37,10 +37,15 @@ RUN apt-get install --yes lxqt sddm firefox COPY ./skel/ /opt/spiri-sdk/user-home-skeleton/ RUN cp -r /opt/spiri-sdk/user-home-skeleton/* /etc/skel/ -RUN usermod -l spiri -m -d /home/spiri user +RUN usermod -u 1000 -l spiri -m -d /home/spiri user RUN echo 'spiri:spiri-friend' | chpasswd RUN usermod -aG sudo,docker spiri +USER spiri +RUN cp -r /opt/spiri-sdk/user-home-skeleton/* /home/spiri/ + +USER root + #Install vscodium, a vscode fork with no telemetry and a worse package store # RUN sh -c "curl -fSsL https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | sudo gpg --dearmor | sudo tee /usr/share/keyrings/vscodium.gpg > /dev/null" # RUN "echo deb [signed-by=/usr/share/keyrings/vscodium.gpg] https://download.vscodium.com/debs vscodium main | sudo tee /etc/apt/sources.list.d/vscodium.list" @@ -48,4 +53,4 @@ RUN usermod -aG sudo,docker spiri # RUN apt install codium --yes #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 spiri:100 /opt/spiri-sdk diff --git a/skel/Desktop/simulated-drone/sim_drone.py b/skel/Desktop/simulated-drone/sim_drone.py index 4d7b8f4..ab9102e 100755 --- a/skel/Desktop/simulated-drone/sim_drone.py +++ b/skel/Desktop/simulated-drone/sim_drone.py @@ -6,6 +6,7 @@ import contextlib import pathlib import time import functools +from typing import List from loguru import logger import sh import atexit @@ -110,7 +111,7 @@ def wait_for_gazebo(timeout=60, interval=1): @app.command() -def start(sys_id: int = 1, extra_apps: list[pathlib.Path] = []): +def start(sys_id: int = 1, extra_apps: List[pathlib.Path] = []): """Starts the simulated drone with a given sys_id, each drone must have it's own unique ID. """ @@ -154,12 +155,13 @@ def start(sys_id: int = 1, extra_apps: list[pathlib.Path] = []): @app.command() -@functools.wraps(start) -def start_group(count: int = typer.Argument(min=1, max=10), *args, **kwargs): +def start_group( + count: int = typer.Argument(min=1, max=10), extra_apps: List[pathlib.Path] = [] +): """Start a group of robots""" for i in range(count): logger.info(f"start robot {i}") - start(sys_id=i + 1, *args, **kwargs) + start(sys_id=i + 1, extra_apps=extra_apps) if i == 0: wait_for_gazebo()