Commit graph

52 commits

Author SHA1 Message Date
Jody Frankowski
bc1e1d2cdc Fix rm call in hacking/env-setup. Since it is sourced from a user shell,
rm can have an alias to 'rm -i', which will make sourcing hang when '-q'
is enabled.
2015-08-15 00:43:45 +02:00
Abhijit Menon-Sen
114070c226 Add missing $ 2015-08-07 09:41:29 +05:30
bryan hunt
7a76fcb159 merged 2015-07-27 11:57:58 +01:00
Sheldon Hearn
c800a1c68a Preserve OLDPWD 2015-07-23 11:24:30 +02:00
Matt Martz
104b2036f7 egg_info is now written directly to lib 2015-03-27 12:03:20 -05:00
Toshio Kuratomi
caf2a96ef9 Merge pdksh fix to v2 2015-03-15 13:22:07 -07:00
Patrik Lundin
731b268cd6 env-setup: Don't use ${.sh.file} if shell is pdksh
The default ksh in OpenBSD throws the following error:
===
$ . hacking/env-setup
ksh: hacking/env-setup[23]: ${.sh.file}": bad substitution
[...]
===

The same error can be seen on Linux if pdksh is used.
2015-03-15 10:46:21 +01:00
Toshio Kuratomi
7c86db3187 Add KSH compat
cherry picked from https://github.com/ansible/ansible/pull/6899
2015-02-09 15:37:35 -08:00
rpe-github
0a73067153 Use basename -- $0 in case $0 starts with a dash.
For example, pdksh $0 contains '-ksh'.
2015-01-25 23:13:54 +01:00
Marco Ippolito
23da2f6415 Redundant file descriptor specifier 2015-01-19 09:03:15 -08:00
Marco Ippolito
4cd5be396d BUG! Incorrect order of redirection AND incorrect redirection syntax
The replaced code only created a text file called `1' in the
current directory, it did *not* redirect output.
2015-01-19 09:03:15 -08:00
Marco Ippolito
bc0f0f838e More elegant output using here-document syntax
POSIX section 2.7.4 defines here-documents.
2015-01-19 09:03:15 -08:00
Marco Ippolito
7eb278e797 Identified two verbosity levels: info, silent
Conflicts:
	hacking/env-setup
2015-01-19 09:03:15 -08:00
Marco Ippolito
9bc1e1a4a0 Reserve capitalised identifiers for system variables
Conflicts:
	hacking/env-setup
2015-01-19 09:03:15 -08:00
Marco Ippolito
53fadd371b No need to prepend `.' to a relative path 2015-01-19 09:03:14 -08:00
Toshio Kuratomi
566a8d1b9d Fix issue with mixing quoting and glo9bbing. 2015-01-18 10:29:07 -08:00
Toshio Kuratomi
365af69c3e More quotes and reimplement without pushd/popd 2015-01-18 08:17:37 -08:00
Toshio Kuratomi
dde32a826f Set default values for shell variables that we use
Fixes #9991
2015-01-15 11:08:00 -08:00
Toshio Kuratomi
09e556e9a4 Get rid of bash compound command to make more portable 2015-01-13 11:38:06 -08:00
Toshio Kuratomi
245f934629 Remove shebang and execute perms for env-setup since it must be sourced 2015-01-12 08:03:53 -08:00
Marco Ippolito
b688570380 Corrected quoting of parameter expansions in hacking/env-setup
Conflicts:
	hacking/env-setup
2015-01-10 17:29:56 -08:00
Marco Ippolito
b8921706f8 Prefer modern-style Bash command substitution in hacking/env-setup
Conflicts:
	hacking/env-setup
2015-01-10 17:26:19 -08:00
Marco Ippolito
31c8523371 Updated shebang from #!/bin/bash to #!/usr/bin/env bash (more flexible) 2015-01-10 17:21:43 -08:00
Brian Coca
88443d6dcf Merge pull request #7306 from abadger/feature/egg-info
Feature/egg info
2014-12-15 16:26:37 -05:00
Bryan Hunt
e5f651c458 export ANSIBLE_HOME so it can be used in scripts
In order that scripts like this can work 
```
#!/bin/bash
ansible -vvvv tag_instance_type_foo-training -i "${ANSIBLE_HOME}/plugins/inventory/ec2.py" --private-key=~/Downloads/foo-training.pem -u ec2-user -m ping
```
2014-10-28 20:19:15 +00:00
Michael DeHaan
7f6ab89b5b hacking/env-setup no longer needs to set library since modules appear as git submodules. 2014-09-26 17:59:46 -04:00
Toshio Kuratomi
6a6060ac55 Teach env-setup how to create egg-info for ansible so that pkg_resources works 2014-05-06 11:19:41 -07:00
willthames
e2d04f7e96 Allow hacking/env-setup module path to use config file library path
hacking/env-setup now adds the configured library path in ANSIBLE_CONFIG
to the ANSIBLE_LIBRARY environment variable in addition to the previous
default of ANSIBLE_HOME/library.

This replaces #5950.
2014-02-12 12:06:57 +10:00
Jens Rantil
2096c669d9 env-setup fix for zsh <= 4.3.10
This fixes issue #5026. It used to work. The regression was
introduced in 2b3381de7c.
2013-12-04 14:36:47 +01:00
phy1729
2b3381de7c Add zsh support for working dir independant sourcing 2013-11-19 13:35:01 -06:00
Michael DeHaan
955611bda8 Fixes #3294 2013-06-30 19:59:48 -04:00
Michael DeHaan
8b592c9d4b Add some whitespace to script 2013-06-30 19:21:28 -04:00
martin f. krafft
3839dcd56c Remove extra $ character
Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-23 14:58:09 +02:00
martin f. krafft
bbbc214ffb Remove bashisms, replace with POSIX constructs
This replaces double conditional brackets with single ones and gets ris
of bashisms, so that the tool should be sourcable from any POSIX shell.

Constructs like [ $foo = "$bar"* ] yield filesystem-globbing behaviour
according to POSIX. A compliant way is to use case statements.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-20 08:18:37 +02:00
martin f. krafft
9f4988dbfd Quote variables in shell script
In case paths contain spaces, it's better to consistently quote
variables, and to use $() instead of `` for external invocations.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-20 08:18:37 +02:00
martin f. krafft
4b9f8fc294 Replace external command with shell construct
dirname/basename do not need an external process, shell variable
expansion can be made to do the same a bit faster.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-20 08:18:11 +02:00
martin f. krafft
013cd38929 Remove shebang line
The env-setup script is not intended to be run directly, so it does not
need a shebang line, which might even create the wrong expectations.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-20 08:18:11 +02:00
martin f. krafft
3b008d6fa6 Expand usage synopsis
'source' is actually a "bashism" and the POSIX-way of sourcing a file
uses the single dot (which is arguably less readable). Both yield the
same result, and since the script may now also be sourced from
within the hacking directory, this commit expands the usage synopsis
accordingly.

Signed-off-by: martin f. krafft <madduck@madduck.net>

Conflicts:
	hacking/env-setup
2013-06-14 10:39:58 +02:00
martin f. krafft
581dea70d1 Generalise determination of hacking directory path
Bash needs a special case to determine the dirname of the sourced path
(the hacking dir), but in all other cases, using $0 allows the script to
be sourced also from within the hacking directory, not only from its
parent.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2013-06-14 10:39:26 +02:00
Michael DeHaan
03db6ef24a Slightly more self-explanatory output for ./hacking/env-setup 2013-03-18 00:27:44 -04:00
Yves Dorfsman
dfdc5bda4b Prevents PATH, PYTHONPATH etc... to be re-added. 2013-02-20 01:12:38 -07:00
junyoung
a2aacaaec8 whitespaces in FULL_PATH cause an error to get ANSIBLE_PATH 2013-01-28 10:46:34 +09:00
Daniel Hokka Zakrisson
a117944d0f Make env-setup work on Python 3 2013-01-23 19:48:13 +01:00
Blair Zajac
ec5f6ae246 hacking/env-setup: remove unused sys import. 2013-01-12 19:07:50 -08:00
Will Thames
4d4d0b90c5 readlink -f does not work on OS X. Replaced with a python solution 2012-07-30 21:35:24 +10:00
willthames
6219fc4932 env-setup no longer needs to be run from the ansible directory, it can be run from anywhere
env-setup now takes a -q argument to run in quiet mode
2012-07-30 13:18:28 +10:00
Tim Bielawa
e9e8417735 Update hacking with MANPATH. Correct hacking README details. 2012-04-17 10:53:32 -04:00
Michael DeHaan
82bd75c1e0 Update env-setup script to make it work better 2012-03-18 12:28:22 -04:00
Michael DeHaan
85e0de5bb2 Move print statements out of playbook.py and back into CLI so we can simplify playbook operations
independent of output, and can also see all the output nicely grouped together if we want
to reformat it or make summaries of statistics.
2012-03-06 19:24:36 -05:00
Tim Bielawa
c5f8bc9d79 Don't set ANSIBLE_HOSTS inside the env-setup script 2012-03-05 16:12:05 -05:00