Skip to content

Commit c39bc12

Browse files
committed
Merge pull request certbot#1238 from devnsec-com/pr5
Use `printf` instead of `echo -n` for better portability
2 parents b36be12 + 69365a7 commit c39bc12

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

bootstrap/venv.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ pip install -U letsencrypt letsencrypt-apache # letsencrypt-nginx
2525
echo
2626
echo "Congratulations, Let's Encrypt has been successfully installed/updated!"
2727
echo
28-
echo -n "Your prompt should now be prepended with ($VENV_NAME). Next "
29-
echo -n "time, if the prompt is different, 'source' this script again "
30-
echo -n "before running 'letsencrypt'."
28+
printf "%s" "Your prompt should now be prepended with ($VENV_NAME). Next "
29+
printf "time, if the prompt is different, 'source' this script again "
30+
printf "before running 'letsencrypt'."
3131
echo
3232
echo
3333
echo "You can now run 'letsencrypt --help'."

letsencrypt-auto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ then
7373
fi
7474
fi
7575

76-
echo -n "Updating letsencrypt and virtual environment dependencies..."
76+
printf "Updating letsencrypt and virtual environment dependencies..."
7777
if [ "$VERBOSE" = 1 ] ; then
7878
echo
7979
$VENV_BIN/pip install -U setuptools
@@ -86,15 +86,15 @@ if [ "$VERBOSE" = 1 ] ; then
8686
fi
8787
else
8888
$VENV_BIN/pip install -U setuptools > /dev/null
89-
echo -n .
89+
printf .
9090
$VENV_BIN/pip install -U pip > /dev/null
91-
echo -n .
91+
printf .
9292
# nginx is buggy / disabled for now...
9393
$VENV_BIN/pip install -U letsencrypt > /dev/null
94-
echo -n .
94+
printf .
9595
$VENV_BIN/pip install -U letsencrypt-apache > /dev/null
9696
if $VENV_BIN/pip freeze | grep -q letsencrypt-nginx ; then
97-
echo -n .
97+
printf .
9898
$VENV_BIN/pip install -U letsencrypt-nginx > /dev/null
9999
fi
100100
echo

letsencrypt/plugins/manual.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Authenticator(common.Plugin):
7070
CMD_TEMPLATE = """\
7171
mkdir -p {root}/public_html/{response.URI_ROOT_PATH}
7272
cd {root}/public_html
73-
echo -n {validation} > {response.URI_ROOT_PATH}/{encoded_token}
73+
printf "%s" {validation} > {response.URI_ROOT_PATH}/{encoded_token}
7474
# run only once per server:
7575
$(command -v python2 || command -v python2.7 || command -v python2.6) -c \\
7676
"import BaseHTTPServer, SimpleHTTPServer; \\
@@ -142,15 +142,14 @@ def _perform_single(self, achall):
142142
ct=response.CONTENT_TYPE, port=port)
143143
if self.conf("test-mode"):
144144
logger.debug("Test mode. Executing the manual command: %s", command)
145-
# sh shipped with OS X does't support echo -n
146-
executable = "/bin/bash" if sys.platform == "darwin" else None
145+
# sh shipped with OS X does't support echo -n, but supports printf
147146
try:
148147
self._httpd = subprocess.Popen(
149148
command,
150149
# don't care about setting stdout and stderr,
151150
# we're in test mode anyway
152151
shell=True,
153-
executable=executable,
152+
executable=None,
154153
# "preexec_fn" is UNIX specific, but so is "command"
155154
preexec_fn=os.setsid)
156155
except OSError as error: # ValueError should not happen!

0 commit comments

Comments
 (0)