diff options
Diffstat (limited to 'scripts/qs')
-rwxr-xr-x | scripts/qs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/qs b/scripts/qs new file mode 100755 index 0000000..afc998f --- /dev/null +++ b/scripts/qs @@ -0,0 +1,39 @@ +#!/bin/bash + +PORT=8000 + +cat <<EOF +Quickshare (qs) +############### + +Will run (port is optional and = 8000 by default): + + python3 -m SimpleHTTPServer ${PORT} + +Or, if python3 is not installed on the host: + + python -m SimpleHTTPServer ${PORT} + +Depending on the current lan configuration, +you can access files by going to either: + + http://${HOSTNAME}.local:${PORT}/ + http://${HOSTNAME}:${PORT}/ +EOF + +for ipv4 in $(ip -oneline -family inet address show \ + | sed 's/^.*inet \([0-9.]\+\).*$/\1/'); do + echo " http://${ipv4}:${PORT}/" +done + +for ipv6 in $(ip -oneline -family inet6 address show \ + | sed 's/^.*inet6 \([0-9:a-fA-F]\+\).*$/\1/'); do + echo " http://[${ipv6}]:${PORT}/" +done + +echo "" +echo "==================================================" + +[ -e /usr/bin/python3 ] && \ + python3 -m http.server 8000 || \ + python2 -m SimpleHTTPServer 8000 |