-y option in inline shell

10 views
Skip to first unread message

hd hsd

unread,
Feb 21, 2018, 9:04:15 AM2/21/18
to Vagrant
I have this on my vagrantfile.I have configured it to install software  I needed. 

   config.vm.provision "shell", inline: <<-SHELL
   cd /vagrant
   chmod +x install.sh
   sudo ./install.sh


   SHELL

install.sh

sudo apt-get -y update

why I can't use -y option. I always got this error
Command line option 'y' [from -y] is not known.
==> default: ./install.sh: 12: ./install.sh:
: not found:


Alvaro Miranda Aguilera

unread,
Feb 22, 2018, 6:24:43 AM2/22/18
to vagra...@googlegroups.com
because is in the wrong place.


not a vagrant issue, but easy to solve


if you run 

vagrant ssh
sudo apt-get -y update

You will see the error

fix:
sudo apt-get update


don't think -y is needed

Thanks
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/1febba10-5004-49ff-914c-292776302304%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Yves Guerin

unread,
Feb 22, 2018, 8:59:36 AM2/22/18
to Vagrant
Dear,

the right command is: apt-get update 

but apt-get -y install PKG, apt-get -y upgrade

Regards

Antony Stone

unread,
Feb 22, 2018, 9:06:44 AM2/22/18
to vagra...@googlegroups.com
On Thursday 22 February 2018 at 12:24:35, Alvaro Miranda Aguilera wrote:

> because is in the wrong place.
>
>
> not a vagrant issue, but easy to solve
>
>
> if you run
>
> vagrant ssh
> *sudo apt-get -y update*
>
> You will see the error
>
> fix:
> *sudo apt-get update*
>
>
> don't think -y is needed
>
> Thanks
> Alvaro

Also, if you're not familiar with working on Linux machines at the command
line, this is a good opportunity for you to find out about the built-in help
systems:

1. apt-get --help

2. man apt-get


Regards,


Antony.

> On Wed, Feb 21, 2018 at 3:04 PM, hd hsd wrote:
> > I have this on my vagrantfile.I have configured it to install software I
> > needed.
> >
> > config.vm.provision "shell", inline: <<-SHELL
> > cd /vagrant
> > chmod +x install.sh
> > sudo ./install.sh
> >
> >
> > SHELL
> >
> > *install.sh*
> >
> > *sudo apt-get -y update*
> >
> > why I can't use -y option. I always got this error
> > Command line option 'y' [from -y] is not known.
> >
> > ==> default: ./install.sh: 12: ./install.sh:
> > : not found:

--
René Descartes walks in to a bar.
The barman asks him "Do you want a drink?"
Descartes says "I think not," and disappears.

Please reply to the list;
please *don't* CC me.

hd hsd

unread,
Feb 22, 2018, 9:34:07 AM2/22/18
to Vagrant
here is my full content of install.sh. vagrant inline script(vagrant provision command) should be the correct solution to installing multiple tools like this situations. some of the command such as `sudo apt-get install git`  requires confirmation, and if I use vagrant -provision I can't enter the `y` option in the terminal.

sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get install -y git
sudo apt-get install -y python3-pip
sudo apt-get install -y python-pip
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y jq
sudo apt-get install -y ruby-full
sudo apt-get install -y libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev ruby-dev build-essential libgmp-dev zlib1g-dev
sudo apt-get install -y realpath

#Don't forget to set up AWS credentials!
echo "Don't forget to set up AWS credentials!"
sudo apt install awscli
echo "Don't forget to set up AWS credentials!"

sudo apt-get -y install build-essential libssl-dev libffi-dev python-dev
sudo apt-get -y install python-setuptools

#create a tools folder in /vagrant/tools
mkdir /vagrant/tools
cd /vagrant/tools/


echo "installing Sublist3r"
cd Sublist3r*
sudo pip install -r requirements.txt
cd /vagrant/tools/
echo "done"

echo "installing wpscan"
cd ~
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.4.2
rvm use 2.4.2 --default
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
cd /vagrant/tools
cd wpscan
gem install bundler
bundle install --without test
cd /vagrant/tools/
echo "done"

echo "installing dirsearch"
cd /vagrant/tools/
echo "done"

echo "installing lazys3"
cd /vagrant/tools/
echo "done"

echo "installing virtual host discovery"
cd /vagrant/tools/
echo "done"

echo "installing sqlmap"
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
cd /vagrant/tools/
echo "done"

echo "installing knock.py"
sudo apt-get install python-dnspython
cd /vagrant/tools/
echo "done"

echo "installing gittyleaks"
sudo pip install gittyleaks
echo "done"

echo "installing relative-url-extractor"
cd /vagrant/tools/
echo "done"

echo "installing wafwoof"
sudo pip install wafwoof
echo 'done'

#echo "installing recon-ng"
#cd recon-ng
#sudo pip install -r REQUIREMENTS
echo "done"

echo "installing recon.sh"
cd /vagrant/tools/
echo "done"

cp /vagrant/bash_profile ~/.bash_profile
source ~/.bash_profile

# init recon.sh for recon-data
mkdir /vagrant/recon-data
cd /vagrant/recon-data
git init
recon.sh init /vagrant/recon-data

#installing httpscreenshoot
echo "installing httpscreenshoot"
sudo apt-get install swig swig2.0 libssl-dev python-dev python-pip
cd httpscreenshot
sudo ./install-dependencies.sh 
#installing bountymonitor
echo "installing bountymonitor"
pip install -r requirements.txt
echo "One last time: don't forget to set up AWS credentials in ~/.aws/!"
# install namp
sudo apt-get install nmap


To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

Antony Stone

unread,
Feb 22, 2018, 10:18:33 AM2/22/18
to vagra...@googlegroups.com
On Thursday 22 February 2018 at 15:34:06, hd hsd wrote:

> here is my full content of install.sh. vagrant inline script(vagrant
> provision command) should be the correct solution to installing multiple
> tools like this situations. some of the command such as `sudo apt-get
> install git` requires confirmation, and if I use vagrant -provision I
> can't enter the `y` option in the terminal.
>
> sudo apt-get -y update

apt-get update does not require (and does not allow) a -y option

> sudo apt-get -y upgrade

apt-get -y upgrade is fine

> sudo apt-get install -y git
> sudo apt-get install -y python3-pip
> sudo apt-get install -y python-pip
> sudo apt-get install -y libcurl4-openssl-dev
> sudo apt-get install -y libssl-dev
> sudo apt-get install -y jq
> sudo apt-get install -y ruby-full
> sudo apt-get install -y libcurl4-openssl-dev libxml2 libxml2-dev
> libxslt1-dev ruby-dev build-essential libgmp-dev zlib1g-dev
> sudo apt-get install -y realpath

Why write all those as separate commands? As you can see from the penultimate
line, you can install many packages at once by listing the names separated by
spaces, so why no do the whole of the above with one command:

sudo apt-get install -y git python3-pip python-pip libcurl4-openssl-dev
libssl-dev jq ruby-full libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev
ruby-dev build-essential libgmp-dev zlib1g-dev realpath


Do you have any further questions regarding the rest of your script below?


Antony.
--
Police have found a cartoonist dead in his house. They say that details are
currently sketchy.
Reply all
Reply to author
Forward
0 new messages