summaryrefslogtreecommitdiff
path: root/examples/file-server/serve-files.sh
blob: 93d3932ca92a34a43e637da4effc6f1f5df3600f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# Serves 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