Chroot Jail - Ubuntu 20.04 + ROS Noetic
sudo bash bootstrap.bash # creates a chroot jail at $HOME/bootstrap
sudo chroot $HOME/bootstrap # Type exit to exit the chroot jail
| #!/bin/bash | |
| set -e | |
| # Settings | |
| USER_HOME=$(eval echo "~$SUDO_USER") | |
| CHROOT_DIR=${USER_HOME}/bootstrap | |
| UBUNTU_VERSION="focal" | |
| ROS_VERSION="noetic" | |
| # Script dependencies | |
| apt-get update -q | |
| apt-get install -q debootstrap wget curl lsb-release | |
| # Bootstrap Ubuntu base installation | |
| mkdir -p ${CHROOT_DIR} | |
| if [ ! -f "${CHROOT_DIR}/bin/bash" ]; then | |
| debootstrap $UBUNTU_VERSION $CHROOT_DIR http://archive.ubuntu.com/ubuntu | |
| fi | |
| # Setup APT sources | |
| cat > ${CHROOT_DIR}/etc/apt/sources.list <<EOF | |
| deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION main universe restricted multiverse | |
| deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-updates main universe restricted multiverse | |
| deb http://archive.ubuntu.com/ubuntu $UBUNTU_VERSION-security main universe restricted multiverse | |
| deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main | |
| EOF | |
| # Install ROS | |
| cat << 'EOF' | chroot $CHROOT_DIR /bin/bash | |
| export DEBIAN_FRONTEND=noninteractive | |
| apt-get install -yqq curl | |
| curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - | |
| apt-get install -yqq ros-noetic-ros-base | |
| exit | |
| EOF | |
| ~ |
Chroot Jail - Ubuntu 20.04 + ROS Noetic
sudo bash bootstrap.bash # creates a chroot jail at $HOME/bootstrap
sudo chroot $HOME/bootstrap # Type exit to exit the chroot jail