[tor-commits] [ooni-probe/master] fix checking if commands exist, other minor changes
commit 0e975d3c47a1a6d9cdbe028b2c3ce08aca6431ce Author: juga0 Date: Wed Dec 23 19:50:07 2015 + fix checking if commands exist, other minor changes * fix checking if commands exist * only install virtualenv if it is needed to create a new one * add/change debug ouput --- scripts/psiphon_install.sh | 50 -- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/scripts/psiphon_install.sh b/scripts/psiphon_install.sh index 117c823..12086c8 100755 --- a/scripts/psiphon_install.sh +++ b/scripts/psiphon_install.sh @@ -20,8 +20,10 @@ sh_c='sh -c' if [ "$user" != 'root' ]; then if command_exists sudo; then sh_c='sudo sh -c -E' +echo "[D] using sudo" elif command_exists su; then sh_c='su -c --preserve-environment' +echo "[D] using su" else echo >&2 'Error: this installer needs the ability to run commands as root.' echo >&2 'We are unable to find either "sudo" or "su" available to make this happen.' @@ -29,42 +31,49 @@ if [ "$user" != 'root' ]; then fi fi -echo "installing dependencies" +echo "[D] installing dependencies" $sh_c "apt-get -y install zlib1g-dev libssl-dev" -if [ ! "command_exists hg" ]; then +if ! command_exists hg; then + echo "[D] installing mercurial" $sh_c "apt-get -y install mercurial" fi +echo "[D] mercurial installed" cd $PSIPHON_PATH if [ ! -d "psiphon-circumvention-system" ]; then - echo "cloning psiphon repository" + echo "[D] cloning psiphon repository" hg clone $PSIPHON_REPO_URL fi -echo "psiphon repository cloned" +echo "[D] psiphon repository cloned" # optional, compile their ssh if [ ! -f "$PSIPHON_PYCLIENT_PATH/ssh" ]; then -echo "compiling psiphon ssh" +echo "[D] compiling psiphon ssh" cd psiphon-circumvention-system/Server/3rdParty/openssh-5.9p1/ ./configure make -mv ssh ../../../pyclient/ +mv ssh ../../../pyclient/pyclient/ make clean -echo "psiphon ssh compiled" +echo "[D] psiphon ssh compiled" fi # check if we are in a virtualenv, create it otherwise -echo "checking virtualenv" +echo "[D] checking virtualenv" if [ `python -c 'import sys; print hasattr(sys, "real_prefix")'` = "False" ]; then - # not in a virtualenv - # create a virtualenv - # FIXME: assuming debian version will have secure pip/virtualenv - if [ ! "command_exists virtualenv" ]; then -$sh_c "apt-get -y install python-virtualenv" - fi + echo "[D] not in a virtualenv" if [ ! -f $OONI_VIRTUALENV_PATH/bin/activate ]; then +echo "[D] virtualenv not found" +# create a virtualenv +# FIXME: assuming debian version will have secure pip/virtualenv +if ! command_exists virtualenv; then + echo "[D] installing virtualenv" + $sh_c "apt-get -y install python-virtualenv" +else + echo "[D] virtualenv command found" +fi +echo "[D] creating a virtualenv" # Set up the virtual environment mkdir -p $HOME/.virtualenvs virtualenv $OONI_VIRTUALENV_PATH @@ -72,12 +81,12 @@ if [ `python -c 'import sys; print hasattr(sys, "real_prefix")'` = "False" ]; th else . $OONI_VIRTUALENV_PATH/bin/activate fi + echo "[D] virtualenv activated" fi -echo "virtualenv activated" # create psi_client.dat -echo "creating servers data file" -echo "installing dependencies to create servers data file" +echo "[D] creating servers data file" +echo "[D] installing dependencies to create servers data file" pip install -v --timeout 60 wget cd /tmp cat < psi_generate_dat.py @@ -107,9 +116,12 @@ EOF chmod +x psi_generate_dat.py ./psi_generate_dat.py -echo "servers data file created" +echo "[D] servers data file created" mv psi_client.dat $PSIPHON_PYCLIENT_PATH rm /tmp/psi_generate_dat.py -echo "[+] Installing all of the Python dependency requirements with pip in your virtualenv!"; +echo "[D] installing all of the Python dependency requirements with pip in the virtualenv"; pip install -v --timeout 60 jsonpickle pexpect + +echo "You can now run Psiphon: cd ~/psiphon-circumvention-system/pyclient/pyclient;python psi_client.py" +echo "NOTE that if OONI is not installed, you will not be able to run OONI Psiphon test" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [ooni-probe/master] fix checking if commands exist, other minor changes
commit b955184f3689de91b9a4b792e46ceb144e03f161 Author: juga0 Date: Wed Dec 23 19:50:07 2015 + fix checking if commands exist, other minor changes * fix checking if commands exist * only install virtualenv if it is needed to create a new one * add/change debug ouput --- scripts/psiphon_install.sh | 50 -- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/scripts/psiphon_install.sh b/scripts/psiphon_install.sh index 117c823..12086c8 100755 --- a/scripts/psiphon_install.sh +++ b/scripts/psiphon_install.sh @@ -20,8 +20,10 @@ sh_c='sh -c' if [ "$user" != 'root' ]; then if command_exists sudo; then sh_c='sudo sh -c -E' +echo "[D] using sudo" elif command_exists su; then sh_c='su -c --preserve-environment' +echo "[D] using su" else echo >&2 'Error: this installer needs the ability to run commands as root.' echo >&2 'We are unable to find either "sudo" or "su" available to make this happen.' @@ -29,42 +31,49 @@ if [ "$user" != 'root' ]; then fi fi -echo "installing dependencies" +echo "[D] installing dependencies" $sh_c "apt-get -y install zlib1g-dev libssl-dev" -if [ ! "command_exists hg" ]; then +if ! command_exists hg; then + echo "[D] installing mercurial" $sh_c "apt-get -y install mercurial" fi +echo "[D] mercurial installed" cd $PSIPHON_PATH if [ ! -d "psiphon-circumvention-system" ]; then - echo "cloning psiphon repository" + echo "[D] cloning psiphon repository" hg clone $PSIPHON_REPO_URL fi -echo "psiphon repository cloned" +echo "[D] psiphon repository cloned" # optional, compile their ssh if [ ! -f "$PSIPHON_PYCLIENT_PATH/ssh" ]; then -echo "compiling psiphon ssh" +echo "[D] compiling psiphon ssh" cd psiphon-circumvention-system/Server/3rdParty/openssh-5.9p1/ ./configure make -mv ssh ../../../pyclient/ +mv ssh ../../../pyclient/pyclient/ make clean -echo "psiphon ssh compiled" +echo "[D] psiphon ssh compiled" fi # check if we are in a virtualenv, create it otherwise -echo "checking virtualenv" +echo "[D] checking virtualenv" if [ `python -c 'import sys; print hasattr(sys, "real_prefix")'` = "False" ]; then - # not in a virtualenv - # create a virtualenv - # FIXME: assuming debian version will have secure pip/virtualenv - if [ ! "command_exists virtualenv" ]; then -$sh_c "apt-get -y install python-virtualenv" - fi + echo "[D] not in a virtualenv" if [ ! -f $OONI_VIRTUALENV_PATH/bin/activate ]; then +echo "[D] virtualenv not found" +# create a virtualenv +# FIXME: assuming debian version will have secure pip/virtualenv +if ! command_exists virtualenv; then + echo "[D] installing virtualenv" + $sh_c "apt-get -y install python-virtualenv" +else + echo "[D] virtualenv command found" +fi +echo "[D] creating a virtualenv" # Set up the virtual environment mkdir -p $HOME/.virtualenvs virtualenv $OONI_VIRTUALENV_PATH @@ -72,12 +81,12 @@ if [ `python -c 'import sys; print hasattr(sys, "real_prefix")'` = "False" ]; th else . $OONI_VIRTUALENV_PATH/bin/activate fi + echo "[D] virtualenv activated" fi -echo "virtualenv activated" # create psi_client.dat -echo "creating servers data file" -echo "installing dependencies to create servers data file" +echo "[D] creating servers data file" +echo "[D] installing dependencies to create servers data file" pip install -v --timeout 60 wget cd /tmp cat < psi_generate_dat.py @@ -107,9 +116,12 @@ EOF chmod +x psi_generate_dat.py ./psi_generate_dat.py -echo "servers data file created" +echo "[D] servers data file created" mv psi_client.dat $PSIPHON_PYCLIENT_PATH rm /tmp/psi_generate_dat.py -echo "[+] Installing all of the Python dependency requirements with pip in your virtualenv!"; +echo "[D] installing all of the Python dependency requirements with pip in the virtualenv"; pip install -v --timeout 60 jsonpickle pexpect + +echo "You can now run Psiphon: cd ~/psiphon-circumvention-system/pyclient/pyclient;python psi_client.py" +echo "NOTE that if OONI is not installed, you will not be able to run OONI Psiphon test" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits