From aef2be11c5ea90bc66e774923e6570213e54c195 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 23 May 2020 12:46:54 +0100 Subject: Fix or suppress various shellcheck errors under debian/ --- debian/agent-launch | 5 +++-- debian/changelog | 6 ++++++ debian/openssh-client.postinst | 1 - debian/openssh-server.postinst | 5 ++--- debian/openssh-server.ssh.init | 4 ++++ debian/openssh-server.ssh.runscript/finish | 10 +++++----- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/debian/agent-launch b/debian/agent-launch index f3cbfaef8..3b2abdbf7 100755 --- a/debian/agent-launch +++ b/debian/agent-launch @@ -3,6 +3,7 @@ set -e if [ ! -d "$XDG_RUNTIME_DIR" ]; then + # shellcheck disable=SC2016 echo 'This needs $XDG_RUNTIME_DIR to be set' >&2 exit 1 fi @@ -10,8 +11,8 @@ fi if [ "$1" = start ]; then if [ -z "$SSH_AUTH_SOCK" ] && grep -s -q '^use-ssh-agent$' /etc/X11/Xsession.options; then S="$XDG_RUNTIME_DIR/openssh_agent" - dbus-update-activation-environment --verbose --systemd SSH_AUTH_SOCK=$S SSH_AGENT_LAUNCHER=openssh - exec ssh-agent -D -a $S + dbus-update-activation-environment --verbose --systemd SSH_AUTH_SOCK="$S" SSH_AGENT_LAUNCHER=openssh + exec ssh-agent -D -a "$S" fi elif [ "$1" = stop ]; then if [ "$SSH_AGENT_LAUNCHER" = openssh ]; then diff --git a/debian/changelog b/debian/changelog index e9ee5d1eb..69cbf0b4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +openssh (1:8.2p1-5) UNRELEASED; urgency=medium + + * Fix or suppress various shellcheck errors under debian/. + + -- Colin Watson Sat, 23 May 2020 12:46:19 +0100 + openssh (1:8.2p1-4) unstable; urgency=medium * Add /etc/ssh/ssh_config.d/ to openssh-client. diff --git a/debian/openssh-client.postinst b/debian/openssh-client.postinst index ec0ad2b2b..cf046ed7c 100644 --- a/debian/openssh-client.postinst +++ b/debian/openssh-client.postinst @@ -2,7 +2,6 @@ set -e action="$1" -oldversion="$2" umask 022 diff --git a/debian/openssh-server.postinst b/debian/openssh-server.postinst index 552b0744e..f45f5851c 100644 --- a/debian/openssh-server.postinst +++ b/debian/openssh-server.postinst @@ -5,7 +5,6 @@ set -e db_version 2.0 action="$1" -oldversion="$2" umask 022 @@ -47,7 +46,7 @@ create_key() { if echo "$hostkeys" | grep -x "$file" >/dev/null && \ [ ! -f "$file" ] ; then - echo -n $msg + printf %s "$msg" ssh-keygen -q -f "$file" -N '' "$@" echo if which restorecon >/dev/null 2>&1; then @@ -92,7 +91,7 @@ create_sshdconfig() { password_authentication="$RET" trap cleanup EXIT - new_config="$(tempfile)" + new_config="$(mktemp)" cp -a /usr/share/openssh/sshd_config "$new_config" if [ "$permit_root_login" != true ]; then sed -i 's/^#*PermitRootLogin .*/PermitRootLogin yes/' \ diff --git a/debian/openssh-server.ssh.init b/debian/openssh-server.ssh.init index 620af70e0..4f0fb10de 100755 --- a/debian/openssh-server.ssh.init +++ b/debian/openssh-server.ssh.init @@ -68,6 +68,7 @@ check_privsep_dir() { check_config() { if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then + # shellcheck disable=SC2086 /usr/sbin/sshd $SSHD_OPTS -t || exit 1 fi } @@ -80,6 +81,7 @@ case "$1" in check_for_no_start check_dev_null log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true + # shellcheck disable=SC2086 if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 || true else @@ -113,6 +115,7 @@ case "$1" in start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /run/sshd.pid --exec /usr/sbin/sshd check_for_no_start log_end_msg check_dev_null log_end_msg + # shellcheck disable=SC2086 if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 || true else @@ -131,6 +134,7 @@ case "$1" in # old daemon stopped check_for_no_start log_end_msg check_dev_null log_end_msg + # shellcheck disable=SC2086 if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 || true else diff --git a/debian/openssh-server.ssh.runscript/finish b/debian/openssh-server.ssh.runscript/finish index 7e29ef1db..8c67acf43 100644 --- a/debian/openssh-server.ssh.runscript/finish +++ b/debian/openssh-server.ssh.runscript/finish @@ -3,14 +3,14 @@ set -e NAME=ssh -[ $1 = -1 ] && echo "runsv: ERROR in $NAME: unexpected error or wrong sh syntax" +[ "$1" = -1 ] && echo "runsv: ERROR in $NAME: unexpected error or wrong sh syntax" # no need to stop the service here, runsv will stop trying after the first attempt -[ $1 = 161 ] && echo "runsv: ERROR $1 in $NAME: disabled by local settings" \ - && sv d $(dirname $0) && exit 0 +[ "$1" = 161 ] && echo "runsv: ERROR $1 in $NAME: disabled by local settings" \ + && sv d "$(dirname "$0")" && exit 0 -[ $1 = 162 ] && echo "runsv: ERROR $1 in $NAME: configtest or early setup failed" \ - && sv d $(dirname $0) && exit 0 +[ "$1" = 162 ] && echo "runsv: ERROR $1 in $NAME: configtest or early setup failed" \ + && sv d "$(dirname "$0")" && exit 0 echo "$NAME Stopped" -- cgit v1.2.3