Skip to content

Commit 403963e

Browse files
authored
Merge pull request #64 from openssh-rust/fix-script
FIx `{start, stop}_sshd.sh`: Do not mod `$XDG_RUNTIME_DIR`
2 parents 85fa7e9 + 96f4f6b commit 403963e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

start_sshd.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -euxo pipefail
44

55
cd "$(dirname "$(realpath "$0")")"
66

7-
[ -z ${XDG_RUNTIME_DIR+x} ] && export XDG_RUNTIME_DIR=/tmp
7+
export RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp}
88

9-
[ -f "$XDG_RUNTIME_DIR/openssh-rs/sshd_started" ] && exit
9+
[ -f "$RUNTIME_DIR/openssh-rs/sshd_started" ] && exit
1010

1111
# Start the container
1212
export PUBLIC_KEY='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7'
@@ -25,12 +25,12 @@ docker run \
2525
export HOSTNAME=127.0.0.1
2626
chmod 600 .test-key
2727

28-
mkdir -p "$XDG_RUNTIME_DIR/openssh-rs/"
28+
mkdir -p "$RUNTIME_DIR/openssh-rs/"
2929

3030
echo Waiting for sshd to be up
31-
while ! ssh -i .test-key -v -p 2222 -l test-user $HOSTNAME -o StrictHostKeyChecking=no -o UserKnownHostsFile="$XDG_RUNTIME_DIR/openssh-rs/known_hosts" whoami; do
31+
while ! ssh -i .test-key -v -p 2222 -l test-user $HOSTNAME -o StrictHostKeyChecking=no -o UserKnownHostsFile="$RUNTIME_DIR/openssh-rs/known_hosts" whoami; do
3232
sleep 3
3333
done
3434

3535
# Create sshd_started in runtime directory so that it is auto removed on restart.
36-
touch "$XDG_RUNTIME_DIR/openssh-rs/sshd_started"
36+
touch "$RUNTIME_DIR/openssh-rs/sshd_started"

stop_sshd.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -euxo pipefail
44

55
cd "$(dirname "$(realpath "$0")")"
66

7-
[ -z ${XDG_RUNTIME_DIR+x} ] && export XDG_RUNTIME_DIR=/tmp
7+
export RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp}
88

9-
rm "$XDG_RUNTIME_DIR/openssh-rs/sshd_started"
10-
rm "$XDG_RUNTIME_DIR/openssh-rs/known_hosts"
9+
rm "$RUNTIME_DIR/openssh-rs/sshd_started"
10+
rm "$RUNTIME_DIR/openssh-rs/known_hosts"
1111

1212
docker stop openssh

0 commit comments

Comments
 (0)