aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/qs
diff options
context:
space:
mode:
authorVG <vg@devys.org>2017-05-11 10:01:40 +0200
committerVG <vg@devys.org>2017-05-11 10:01:40 +0200
commitdc8d497a298165ec954a5ff550cd97c79dde1a8a (patch)
treed53a673d2a8f4b52d806a1bf365fe6245e38b33e /scripts/qs
parent0cbddfab73b55bdfad07991663a56c84fea026e3 (diff)
downloadscripts-dc8d497a298165ec954a5ff550cd97c79dde1a8a.tar.gz
scripts-dc8d497a298165ec954a5ff550cd97c79dde1a8a.tar.bz2
scripts-dc8d497a298165ec954a5ff550cd97c79dde1a8a.zip
add more scripts
Diffstat (limited to 'scripts/qs')
-rwxr-xr-xscripts/qs39
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