shell - Downloadable Bash Script That Downloads Bash Scripts -
i'm working on automating provisioning of development vm. few basic things:
- sets corporate proxy stuff
- updates apt-get , installs bunch of libraries
- installs virtualbox guest additions
- installs rbenv, plugins , ruby 2.2
the rest of provisioning going managed ruby scripts, why ruby last step of script.
i have these things broken out separate scripts, , can run them running
curl some.host/proxy.sh | bash
so, in pursuit of getting dream on 1-command provisioning on blank vm, tried make looks this:
curl some.host/proxy.sh | bash source ~/.bashrc curl some.host/apt.sh | bash curl some.host/guest_additions.sh | bash curl some.host/development_base.sh | bash proxy script (this completes successfully):
sudo sh -c "echo 'acquire::http::proxy \"http://proxy.company.net:3000\";' > /etc/apt/apt.conf.d/01proxy" sudo sh -c "echo 'acquire::https::proxy \"https://proxy.company.net:3000\";' >> /etc/apt/apt.conf.d/01proxy" echo 'export http_proxy=http://proxy.company.net:3000' >> ~/.bashrc echo 'export http_proxy=http://proxy.company.net:3000' >> ~/.bashrc echo 'export https_proxy=https://proxy.company.net:3000' >> ~/.bashrc echo 'export https_proxy=https://proxy.company.net:3000' >> ~/.bashrc echo 'export no_proxy="company.net,localhost,127.0.0.1"' >> ~/.bashrc echo 'export no_proxy="company.net,localhost,127.0.0.1"' >> ~/.bashrc echo 'source ~/.bashrc' >> .bash_profile the apt commands
sudo apt-get update sudo apt-get install -y build-essential git-core libxml2 libxml2-dev libxslt1-dev dkms linux-headers-generic linux-headers-$(uname -r) zlib1g-dev libssl-dev tklib guest additions (this never runs)
source ~/.bashrc guest_additions_iso=vboxguestadditions_4.3.28.iso wget --directory-prefix=$home http://dlc-cdn.sun.com/virtualbox/4.3.28/$guest_additions_iso sudo mount -o loop $home/$guest_additions_iso /mnt sudo /mnt/vboxlinuxadditions.run sudo umount -f /mnt rm $home/$guest_additions_iso ruby (this never runs)
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash export path="$home/.rbenv/bin:$home/.rbenv/shims:$path" if rbenv > /dev/null; eval "$(rbenv init -)"; fi rbenv install 2.1.5 rbenv global 2.1.5 gem install bundler this works great, until guest_additions script.
the apt-get install takes few minutes, , when it's done, script stops. never attempts go out , fetch / run next script.
what proper way this?
edit:
okay, lots of comments, i'll try address here instead of in comments.
- what scripts doing?
fair enough point, i've added above. thought perhaps mere idea of script downloads , executes other scripts off base or have caveats in , of itself, did not include scripts @ first avoid busying question many details
- what happens when stalls?
it doesn't stall, persay, acts guest additions , developer base lines aren't there.
- why not chef or else
i may using puppet or @ point, @ point don't want to.
Comments
Post a Comment