cordova ./create function not found Ubuntu 12.04 - linux

I'm digging around in PhoneGap to build a quick prototype we need.
When I navigate to the
~/cordova-2.1.0/bin$
and run
./create ~/jdphonegap com.jdphonegap.app JDPhoneGap
I get the following error
unexpected operator
./create: 48: ./create: function: not found
I'm not the only one:
https://groups.google.com/forum/?fromgroups=#!topic/phonegap/uI_rmd-Gto0
A little help?

Change the first line in create script from
#! /bin/sh
to
#!/bin/bash
Download commons-codec-1.6 from main server:
http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.tar.gz
Extract the commons-codec-1.6.jar and place it to the cordova-android/framework/libs/ (need to create libs)
Alternatively change the URL of this package in create script at line 96
Install ant if you don't have it: http://archive.apache.org/dist/ant/ant-current-bin.zip, extract and add the ant bin folder in your PATH
Example for ant installed in /usr/local:
export PATH=/usr/local/ant/bin:$PATH
Then you can run the create script as documented.

see this line of create script:
ANDROID_BIN=$( which android )
if the environment variable "android" is not set it does not work.
In my case, I ran the following command:
export PATH= android-sdk-linux/tools/:$PATH
and with this it worked.

Related

Cobra init not working,: Command not found

I am following this guide.
***#pop-os:~/go/src/foo$ cobra init --pkg-name foo
Command 'cobra' not found, but can be installed with:
sudo apt install cobra
My setup:
I have go 1.16 installed
$ go version
go version go1.16.3 linux/amd64
my $GOPATH is set to ~/go
$ go env
...
GOPATH="/home/***/go"
What I have done:
I used the command
$ go get -u github.com/spf13/cobra/cobra
In my bin's dir I now find cobra
***#pop-os:~/go/bin$ ls
cobra
...
What am I doing wrong?
Use
go mod init <MODNAME>
~/go/bin/cobra-cli init
or keep reading to learn how to to make the cobra-cli command available on the command line.
This seems to be an issue of $PATH configuration. Because the cobra-cli command is not found, the path ~/go/bin is not part of the $PATH variable. One can add the path like this:
export PATH="~/go/bin:$PATH"
and then use the cobra-cli command on the command-line. One can add that export ... command to ~/.bashrc or a similar file to have the PATH configured properly on startup.
The cobra command is now become cobra-cli.
see https://github.com/spf13/cobra#usage

How to run virtual environment from shell script?

I am trying to setup my project environment from a shell script on ubuntu so that I can skip basic setup every time.
I use my virtual environmet cv using the command workon cv.
But I am having trouble doing so using a shell script. I tried the the script
#!/bin/bash
workon cv
But I get the error
workon: command not found
I try to list all the venv I have
pran#pran-HP-65-Notebook-PC:~$ lsvirtualenv
cv
==
virtual-py2
===========
Also, I thought of locating it
(cv) pran#pran-HP-65-Notebook-PC:~/.virtualenvs$ l
cv/ postdeactivate preactivate* prermvirtualenv*
get_env_details* postmkproject* predeactivate virtual-py2/
initialize postmkvirtualenv premkproject*
postactivate postrmvirtualenv* premkvirtualenv*
How can I do it?
You cannot execute workon command outside of Python virtual environment.
If you are interested, check out this article that will walk you through all of the steps required to set up your virutal env.
If it is not what you need then please clarify your requirements for a project environment.
I found the solution:
My venv was located in .virtualenvs. So, I put the command in the bash file start.sh (meant to be executed before working on my project).
#start.sh
source ~/.virtualenvs/cv/bin/activate
And run it using
$ source start.sh
It works perfectly 👍

Go moq : running "moq": exec: "moq": executable file not found in $PATH

when trying the example of the moq framework, I get the following exception when I enter "go generate":
example.go:5: running "moq": exec: "moq": executable file not found in $PATH
What should I do? I'm using Kubuntu 16.04
PS: I tried
export PATH=$PATH:/home/[...]/go/src/github.com/matryer/moq
without success
#sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:
export PATH=$PATH:/home/[...]/go/bin
and if it doesn't work, check that moq was correctly installed.
First, install using the following command:
go install github.com/matryer/moq#latest
Go binary should be added to the global PATH
export PATH=$PATH:$HOME/go/bin
worked for me on MAC

Starting Ant build from bash script: build.xml does not exist

I am creating a bash script in Linux (ubuntu) that starts an ant build from a build.xml file, located in another directory. My folder structure looks like this:
myBashScript.sh
/project56
/http
build.xml
When I try to call this build file from myBashScript.sh I get the following error:
"Buildfile project56/http/buildfile.xml does not exist!"
I tried the following:
sudo ant -buildfile project56/http/build.xml
sudo ant -v project56/http/build.xml
sudo ant -v fullPathStartingFromHome/build.xml
But I keep getting this error. The funny thing is, when I try to invoke ant (using the first option listed above) from the terminal in the same location that myBashScript.sh is in, the build starts fine.
Can someone help me with this?
Thanks in advance,
Robert
Fixed it, turns out another cd to project56 buried somewhere in my script was screwing things up.

OpenVPN FreeNAS BSD installation issues

im following this guide to install OpenVPN on my FreeNAS system.
http://joepaetzel.wordpress.com/2013/09/22/openvpn-on-freenas-9-1/
I have ran in to the issues detailed below when trying to create the CA.cert.
[root#freenas] /mnt/NAS/openvpn# chmod -R 755 easy-rsa/2.0/*
[root#freenas] /mnt/NAS/openvpn# cd easy-rsa/2.0
[root#freenas] /mnt/NAS/openvpn/easy-rsa/2.0# sh
#./clean-all
Please source the vars script first (i.e. "source ./vars")
Make sure you have edited it to reflect your configuration.
# . ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /mnt/NAS/openvpn/easyrsa/2.0/keys
# ./build-ca
Please edit the vars script to reflect your configuration,
then source it with "source ./vars".
Next, to start with a fresh PKI configuration and to delete any
previous certificates and keys, run "./clean-all".
Finally, you can run this tool (pkitool) to build certificates/keys.
I have tried creating the keys directory manually as i have read this has worked for others but still no luck. Being new to BSD I've hit a road block and looking for some advice.
Any ideas?
cheers guys
UPDATE:
When trying to source ./vars i get the following output
[root#freenas] /mnt/NAS/openvpn/easy-rsa/2.0# source ./vars
export: Command not found.
export: Command not found.
export: Command not found.
export: Command not found.
EASY_RSA: Undefined variable.
export: Command not found.
EASY_RSA: Undefined variable.
FreeNAS's default shell is not sh, and therefore doesn't support the 'export' command. The ./vars script needs the export command to set environment variables it then needs.
So before you call ./vars (don't call source) call:
sh
This is clearly stated in the site: http://joepaetzel.wordpress.com/2013/09/22/openvpn-on-freenas-9-1/
Not sure about the original issue, i think nrathaus has covered that well.
demonLaMagra - If you want to check if openvpn in running use this command:
service openvpn status
Sorry I couldn't comment on the last answer because of being a new new user, otherwise I would have.

Resources