Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/vagrant/initvagrant.sh
Views: 1798
#!/usr/bin/env bash1echo "---------- $0 start ----------"23# this script is run by the root user in the virtual machine45set -e6set -x78who=$(whoami)9echo "Initial setup of SITL-vagrant instance."10if [ $who != 'root' ]; then11echo "SORRY, MUST RUN THIS SCRIPT AS ROOT, GIVING UP"12exit 113fi1415VAGRANT_USER=ubuntu16if [ -e /home/vagrant ]; then17# prefer vagrant user18VAGRANT_USER=vagrant19fi20echo USING VAGRANT_USER:$VAGRANT_USER2122cd /home/$VAGRANT_USER2324IS_BENTO=025if [ -e /etc/update-motd.d/99-bento ]; then26IS_BENTO=127fi2829# artful rootfs is 2GB without resize. Do not resize if using Bento:30if [ ! $IS_BENTO ]; then31sudo resize2fs /dev/sda132fi3334echo "calling pre-reqs script..."35sudo -H -u $VAGRANT_USER /vagrant/Tools/environment_install/install-prereqs-ubuntu.sh -y36echo "...pre-reqs script done... initvagrant.sh continues."3738# valgrind support:39apt-get install -y valgrind4041# gdb support:42apt-get install -y gdb4344sudo -u $VAGRANT_USER ln -fs /vagrant/Tools/vagrant/screenrc /home/$VAGRANT_USER/.screenrc4546# enable permissive ptrace:47perl -pe 's/kernel.yama.ptrace_scope = ./kernel.yama.ptrace_scope = 0/' -i /etc/sysctl.d/10-ptrace.conf48echo 0 > /proc/sys/kernel/yama/ptrace_scope4950RELEASE_CODENAME=$(lsb_release -c -s)5152if [ ${RELEASE_CODENAME} != 'bionic' ]; then53# build JSB sim54apt-get install -y libtool automake autoconf libexpat1-dev cmake55# libtool-bin56sudo --login -u $VAGRANT_USER /vagrant/Tools/scripts/build-jsbsim.sh57fi5859# adjust environment for every login shell:60DOT_PROFILE=/home/$VAGRANT_USER/.profile61echo "source /vagrant/Tools/vagrant/shellinit.sh" |62sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$DOT_PROFILE6364BASHRC="/home/$VAGRANT_USER/.bashrc"65# adjust environment for every login shell:66BASHRC_GIT="/vagrant/Tools/vagrant/bashrc_git"67echo "source $BASHRC_GIT" |68sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$BASHRC6970# link a half-way decent .mavinit.scr into place:71sudo --login -u $VAGRANT_USER ln -sf /vagrant/Tools/vagrant/mavinit.scr /home/$VAGRANT_USER/.mavinit.scr7273# no multipath available, stop mutlipathd complaining about lack of data:74if [ ${RELEASE_CODENAME} == 'jammy' ]; then75cat >>/etc/multipath.conf <<EOF76blacklist { devnode "sda" }77blacklist { devnode "sdb" }78EOF79fi808182#Plant a marker for sim_vehicle that we're inside a vagrant box83touch /ardupilot.vagrant8485# Now you can run86# vagrant ssh -c "screen -d -R"87echo "---------- $0 end ----------"88899091