From 379e3aa01bb125530e0859edd66d76aa3ba45f0e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Wed, 27 Nov 2024 17:40:02 +0900 Subject: [PATCH] update cleanup scripts Signed-off-by: Yutaka Kondo --- docker/scripts/cleanup_apt.sh | 8 ++++---- docker/scripts/cleanup_system.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/scripts/cleanup_apt.sh b/docker/scripts/cleanup_apt.sh index 0b0d43fea1..ad03c1f39e 100755 --- a/docker/scripts/cleanup_apt.sh +++ b/docker/scripts/cleanup_apt.sh @@ -1,10 +1,10 @@ #!/bin/bash function cleanup_apt() { - local remove_var_lib_apt_lists=$1 - apt-get autoremove -y && rm -rf "$HOME"/.cache - if [[ $remove_var_lib_apt_lists == true ]]; then - rm -rf /var/lib/apt/lists/* + local apt_clean=$1 + apt-get autoremove -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + if [[ $apt_clean == true ]]; then + apt-get clean fi } diff --git a/docker/scripts/cleanup_system.sh b/docker/scripts/cleanup_system.sh index 1e8d911bec..0833be2b3a 100755 --- a/docker/scripts/cleanup_system.sh +++ b/docker/scripts/cleanup_system.sh @@ -4,15 +4,15 @@ function cleanup_system() { local lib_dir=$1 local ros_distro=$2 - apt-get autoremove -y && rm -rf "$HOME"/.cache && - find /usr/lib/"$lib_dir"-linux-gnu -name "*.a" -type f -delete && + find /usr/lib/"$lib_dir"-linux-gnu -name "*.a" -type f -delete && find / -name "*.o" -type f -delete && find / -name "*.h" -type f -delete && find / -name "*.hpp" -type f -delete && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ros_distro"/include /etc/apt/sources.list.d/cuda*.list \ + /root/.local/pipx /opt/ros/"$ros_distro"/include /opt/autoware/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* } +./cleanup_apt.sh cleanup_system "$@"