summaryrefslogtreecommitdiff
path: root/examples/file-server/serve-files.sh
blob: 5728c10bdafc3cf7ddc5120517c103a8069b4cb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# Serve a single file and exits.

ROOT="/srv/tlsd/files"

if   read -r LINE
then echo "${SHA256}: ${LINE}" 1>&2
     FILEPATH="${ROOT}/$(echo "${LINE}" | sed -e 's/\.\.//g')"
     if   [ -f "${FILEPATH}" ]
     then cat "${FILEPATH}"
     else echo "${FILEPATH} is not a file"
     fi
fi