I want to add libcrafter file in cpp file which is provided from https://github.com/pellegre/libcrafter In that they provide steps
cd libcrafter/libcrafter
$ ./autogen.sh
$ make
$ sudo make install
$ sudo ldconfig
But when I run command it gives invalid option
I have already installed
sudo apt-get install autoconf libtool
sudo apt-get install libpcap0.8 libpcap0.8-dev
#!/bin/sh -e
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
autoreconf --force --install --verbose "$srcdir"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$#"
Error:
libcrafter$ sudo ./autogen.sh
[sudo] password for altaf: : invalid option
Related
i want to execute this cloud-init file and terraform file:
Cloud-init:
#cloud-config
runcmd:
- mkdir react
- cd react
- type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- curl -o actions-runner-linux-x64-2.301.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.301.1/actions-runner-linux-x64-2.301.1.tar.gz
- tar xzf ./actions-runner-linux-x64-2.301.1.tar.gz
- yes "" | ./config.sh --url https://github.com/yuuval/react-deploy --token AVYXWHXNRBPIDXJDPUDK6QTD2LIPE
- sudo ./svc.sh install
- sudo ./svc.sh start
- yes "" | sudo apt install nginx
- gh auth login --hostname github.com --with-token <<< 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 --git-protocol https
- gh repo clone yuuval/react-deploy
- cd react-deploy
- gh workflow run node.js.yml
- sleep 70
- cd /etc/nginx/sites-available
- sudo rm default
- echo "server {
listen 80 default_server;
server_name _;
# react app & front-end files
location / {
root /home/ubuntu/react/_work/react-deploy/react-deploy/build;
try_files \$uri /index.html;
}
}" | sudo tee /etc/nginx/sites-available/default
- sudo service nginx restart
- sudo chmod +x /home
- sudo chmod +x /home/ubuntu
- sudo chmod +x /home/ubuntu/react
- sudo chmod +x /home/ubuntu/react/_work
- sudo chmod +x /home/ubuntu/react/_work/react-deploy
- sudo chmod +x /home/ubuntu/react/_work/react-deploy/react-deploy
- sudo chmod +x /home/ubuntu/react/_work/react-deploy/react-deploy/build
The terraform file isn't relevant i think. So when i run this whole thing with terraform init and terraform apply, its going threw but nothing is hapenning. In the /var/log in the file cloud-init-output file i found this error:
dd: unrecognized operand ‘ ’
Try 'dd --help' for more information.
E: Command line option 'S' [from -fsSL] is not understood in combination with the other options.
I guess its from this command, which should install gh cli (found here: https://github.com/cli/cli/blob/trunk/docs/install_linux.md):
type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
If i do this whole cloud-init file manually it works. So i don't know what to do else.
You seem to be missing \ and && after install curl -y, since I just tried on two WSL machines (that's all I have with me right now) and it was just fine there.
So my suspicion is that your curl command got dazed inside, since you're not exactly running that smaller command and bigger one separately, but they should be rather sundered, so maybe give it a shot?
On this weird page (came up by exact search) https://ouyen.github.io/github/ I found no install curl -y but the next one, which clearly indicated it being ran separately, so I think your issue is just there.
I have a docker file that is supposed to build a container to run a simple Bluetooth scanning program written with nodejs that depends on bluez, Ubuntu and Noble.js but when I run it I get the following error that stops me from building the container when running a docker build -t. Here is the Dockerfile. And the error,
48 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
wget: invalid option -- 'f'
wget: invalid option -- 's'
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
The command '/bin/sh -c apt-get update && apt-get install -y vim python3 python3-dev python3-pip python3-virtualenv python3-wheel gcc build-essential libglib2.0-dev libbluetooth-dev libboost-python-dev git libdbus-1-dev libudev-dev libical-dev libreadline-dev wget curl --no-install-recommends && wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.49.tar.xz tar -xf bluez-5.49.tar.xz cd bluez-5.49 ./configure make make install curl -sL https://deb.nodesource.com/setup_9.x -o nodesource_setup.sh bash nodesource_setup.sh apt-get update && apt-get install -y apt-get install nodejs ln -s /usr/bin/nodejs /usr/bin/node rm -rf /var/lib/apt/lists/*' returned a non-zero code: 2
Look at the following section, particularly where tar is first called:
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.49.tar.xz tar -xf bluez-5.49.tar.xz cd bluez-5.49 ./configure make make install curl -sL https://deb.nodesource.com/setup_9.x -o nodesource_setup.sh bash nodesource_setup.sh apt-get update && apt-get install -y apt-get install nodejs ln -s /usr/bin/nodejs /usr/bin/node rm -rf /var/lib/apt/lists/*
When executing multiple commands in succession on a single line, you need to separate those commands with an operator like &&.
The && operator will run a command, but only if the first succeeds
The || operator will run a command, but only if the first fails
The ; operator will run a command, regardless if the first succeeds or fails
In addition you have a stray apt-get install in your command, most likely a copy/paste error. The section above should look like this:
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.49.tar.xz && tar -xf bluez-5.49.tar.xz && cd bluez-5.49 && ./configure && make && make install && curl -sL https://deb.nodesource.com/setup_9.x -o nodesource_setup.sh && bash nodesource_setup.sh && apt-get update && apt-get install -y nodejs && ln -s /usr/bin/nodejs /usr/bin/node && rm -rf /var/lib/apt/lists/*
As an additional note, the ln -s /usr/bin/nodejs /usr/bin/node is probably unnecessary and will cause an error, as the nodejs package already appears to create /usr/bin/node.
I have the following in my Dockerfile:
run apt-get update; \
apt-get install -y curl && \
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
Following this line of code, I need to run a command in a new bash shell so that the environment variable set from the NVM script are used.
I have tired the following to install Nodejs and it does not work:
run ["/bin/bash", "-c", "nvm install 8.7.0"]
What can I do?
It's better to use a Dockerhub repo and use it in your Dockerfile.
You can check this repositorie or this link for more repositories, please read description before choosing a repositorie.
So for example, you can add the code line below in your Dockerfile it will pull the nvm image and install it then add your app instructions.
FROM livingdocs/nvm
Or you can read their Dockerfile and use the command they used it to install nvm
ADD ./.nvmrc /app/.nvmrc
RUN bash -c '. /usr/share/nvm/nvm.sh && cd /app && nvm install && nvm alias default'
if it didn't put this one from another repositorie:
RUN sudo apt-get update && \
sudo apt-get install -y build-essential libssl-dev libmysqlclient-dev && \
sudo apt-get clean && \
sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN curl --location https://raw.github.com/creationix/nvm/master/install.sh | sh && \
sudo /bin/bash -c "echo \"[[ -s \$HOME/.nvm/nvm.sh ]] && . \$HOME/.nvm/nvm.sh\" >> /etc/profile.d/npm.sh" && \
echo "[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh" >> $HOME/.bashrc
I am trying to automate VM configuration with a script and am having some trouble getting access to some path variables that get set in either ~/.bashrc, ~/.bash_profile, or ~/.profile.
My remote VM is running ubuntu 14.04 LTS and I am deploying over ssh.
This is the array that gets joined together to be run as a bash command to configure the vm by installing nvm:
return [
rm -rf ~/.nvm,
sudo apt-get update,
sudo apt-get install -y build-essential libssl-dev,
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh,
bash install_nvm.sh,
echo "source ~/.nvm/nvm.sh" >> ~/.bash_profile
].join('\n');
return [
`rm -rf ~/.nvm`,
`sudo apt-get update`,
`sudo apt-get install -y build-essential libssl-dev`,
`curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh`,
`bash install_nvm.sh`,
`echo "source ~/.nvm/nvm.sh" >> ~/.bash_profile`
].join('\n');
But when when I run the next script that actually installs node and yarn, it cannot find nvm:
return [
`nvm install ${config.node.version}`,
`nvm use ${config.node.version}`,
`echo "using node $(node -v) and npm $(npm -v)"`,
`curl -o- -L https://yarnpkg.com/install.sh | bash`,
'echo "export PATH="$HOME/.yarn/bin:$PATH"" >> ~/.bash_profile',
].join('\n');
This is the error:
bash: nvm: command not found
bash: line 1: nvm: command not found`
I don't want to ssh in and manually add anything to any of the various profiles. I'd like it all to be done by the script. I also want to avoid sourcing ~/.nvm/nvm.sh or sourcing any of the profiles when the ssh session begins. I was under the impression that an ssh session automatically sources ~/.bash_profile, which should then read from those variables correct? If not, then how else can I configure my deployment script to automatically have access to these variables?
Based on the fact that you are using && as you said in your comments I would add a line to actually source ~/.nvm/nvm.sh before running the nvm commands. You likely don't have the command available at the shell until that has been run.
Change this:
return [
`rm -rf ~/.nvm`,
`sudo apt-get update`,
`sudo apt-get install -y build-essential libssl-dev`,
`curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh`,
`bash install_nvm.sh`,
`echo "source ~/.nvm/nvm.sh" >> ~/.bash_profile`
].join('\n');
To this:
return [
`rm -rf ~/.nvm`,
`sudo apt-get update`,
`sudo apt-get install -y build-essential libssl-dev`,
`curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh`,
`bash install_nvm.sh`,
`echo "source ~/.nvm/nvm.sh" >> ~/.bash_profile`,
`source ~/.nvm/nvm.sh`
].join('\n');
I have a script to get and setup the latest NodeJS on my .deb system:
echo "Downloading, building and installing latest NodeJS"
sudo apt-get install python g++ make checkinstall
mkdir /tmp/node_build && cd $_
curl -O "http://nodejs.org/dist/node-latest.tar.gz"
tar xf node-latest.tar.gz && cd node-v*
NODE_VERSION="${PWD#*v}"
#NODE_VERSION=python -c "print '$PWD'.split('-')[-1][1:]"
echo "Installing NodeJS" $NODE_VERSION
./configure
sudo checkinstall -y --install=no --pkgversion NODE_VERSION
sudo dpkg -i node_$NODE_VERSION
Unfortunately it doesn't work; as the echo line outputs:
Installing NodeJS i8/dir-where-runnning-script-from/node-v0.10.24
It does work from the shell though:
$ cd /tmp/node_build/node-v0.10.24 && echo "${PWD#*v}"
0.10.24
Is there another "v" in the path, like right before the "i8/"? #*v will remove through the first "v" in the variable; I'm pretty sure you want ##*v which'll remove through the last "v" in the variable. (Technically, # removes the shortest matching prefix, and ## removes the longest match). Thus:
NODE_VERSION="${PWD##*v}"
Should work.
Try this
sudo checkinstall -y --install=no --pkgversion "${NODE_VERSION##*v}"