File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+ # SPDX-FileCopyrightText: 2024 Robin Vobruba <[email protected] >
3
+ # SPDX-License-Identifier: Unlicense
4
+
5
+ set -eu
6
+
7
+ script_path=" $( readlink -f " $0 " ) "
8
+ script_dir=" $( dirname " $script_path " ) "
9
+ script_name=" $( basename " $script_path " ) "
10
+
11
+ serve_port=" 8083"
12
+ # serve_dir="$script_dir/../public/"
13
+ serve_dir=" $script_dir /../"
14
+
15
+ print_help () {
16
+
17
+ echo " $script_name - Runs a simple HTTP server,"
18
+ echo " serving '$serve_dir ' on <http://localhost:8083>."
19
+ }
20
+
21
+ # read command-line args
22
+ i=1
23
+ while [ " $i " -lt " $# " ]
24
+ do
25
+ arg=" $( eval " echo \$ $i " ) "
26
+
27
+ case " $arg " in
28
+ -h|--help)
29
+ shift " $i "
30
+ print_help
31
+ exit 0
32
+ ;;
33
+ * ) # non-/unknown option
34
+ i=$(( i + 1 ))
35
+ ;;
36
+ esac
37
+ done
38
+
39
+ echo " Serving '$serve_dir ' on <http://localhost:$serve_port >."
40
+ echo " Stop serving with [Ctrl+C]."
41
+ busybox httpd -f -h " $serve_dir " -v -p " $serve_port "
You can’t perform that action at this time.
0 commit comments