diff --git a/robot/docker/.bashrc b/robot/docker/.bashrc index 0eb09112f..73eaa351e 100755 --- a/robot/docker/.bashrc +++ b/robot/docker/.bashrc @@ -73,7 +73,7 @@ export ROBOT_NAME=$(echo "$container_name" | sed 's/.*-\(robot-[0-9]*\)$/\1/' | export ROS_DOMAIN_ID=$(echo "$ROBOT_NAME" | awk -F'_' '{print $NF}') # case: will be null on real world robot -if [ "$ROBOT_NAME" == "null" ]; then +if [ "$ROBOT_NAME" == "null" ] || echo "$ROBOT_NAME" | grep -q "refused"; then num=$(hostname | awk -F'-' '{print $2}') # get number from hostname num=$((num)) #remove leading zeros @@ -99,8 +99,8 @@ shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTFILE=$HOME/.bash_history -HISTSIZE=1000 -HISTFILESIZE=2000 +HISTSIZE=-1 +HISTFILESIZE=-1 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. diff --git a/robot/docker/Dockerfile.robot b/robot/docker/Dockerfile.robot index 85ee738b9..7b4819b62 100644 --- a/robot/docker/Dockerfile.robot +++ b/robot/docker/Dockerfile.robot @@ -162,17 +162,6 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so EXPOSE 22 -ARG REAL_ROBOT=false -RUN if [ "$REAL_ROBOT" = "true" ]; then \ - # Put commands here that should run for the real robot but not the sim - echo "REAL_ROBOT is true"; \ - apt-get ${UPDATE_FLAGS} update && apt-get ${INSTALL_FLAGS} install -y libimath-dev; \ -else \ - # Put commands here that should be run for the sim but not the real robot - echo "REAL_ROBOT is false"; \ - fi - - # Install colcon, seems to be getting removed RUN pip install -U colcon-common-extensions @@ -228,13 +217,34 @@ RUN addgroup --gid 1000 robot && \ echo "robot ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/robot && \ echo "robot:robot" | chpasswd -RUN USER=robot && \ + +ARG REAL_ROBOT=false +RUN if [ "$REAL_ROBOT" = "true" ]; then \ + # Put commands here that should run for the real robot but not the sim + echo "REAL_ROBOT is true"; \ + apt-get ${UPDATE_FLAGS} update && apt-get ${INSTALL_FLAGS} install -y libimath-dev; \ + groupadd -g 20 dialout; \ + usermod -aG dialout robot; \ + USER=robot && \ + GROUP=robot && \ + curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-arm64.tar.gz | tar -C /usr/local/bin -xzf - && \ + chown root:root /usr/local/bin/fixuid && \ + chmod 4755 /usr/local/bin/fixuid && \ + mkdir -p /etc/fixuid && \ + printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml; \ +else \ + # Put commands here that should be run for the sim but not the real robot + echo "REAL_ROBOT is false"; \ + USER=robot && \ GROUP=robot && \ curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \ chown root:root /usr/local/bin/fixuid && \ chmod 4755 /usr/local/bin/fixuid && \ mkdir -p /etc/fixuid && \ - printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml + printf "user: $USER\ngroup: $GROUP\n" > /etc/fixuid/config.yml; \ + fi + + # Cleanup RUN apt autoremove -y \ diff --git a/robot/docker/docker-compose.yaml b/robot/docker/docker-compose.yaml index 61a9bd7c1..6ee0345d3 100644 --- a/robot/docker/docker-compose.yaml +++ b/robot/docker/docker-compose.yaml @@ -46,6 +46,8 @@ services: profiles: - hitl - deploy + group_add: + - "20" extends: file: ./robot-base-docker-compose.yaml service: robot_base