diff options
author | Devaev Maxim <[email protected]> | 2018-07-05 15:13:27 +0000 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-05 15:13:27 +0000 |
commit | 033ad8922c6407bd9e7ca77817afdb4ed40ffc82 (patch) | |
tree | 0ac0f0136c44232c37a876066e66013d479d184a | |
parent | fa3d894172103ab1036140f7f0a61a5c0689f9ab (diff) |
new pi-builder
-rw-r--r-- | os/.gitignore | 2 | ||||
-rw-r--r-- | os/Makefile | 38 | ||||
-rw-r--r-- | os/platforms/v1/Dockerfile.part | 13 | ||||
-rw-r--r-- | os/platforms/v1/index.html | 18 | ||||
-rwxr-xr-x | os/platforms/v1/run.sh | 20 |
5 files changed, 52 insertions, 39 deletions
diff --git a/os/.gitignore b/os/.gitignore index 145ea57d..0e03e15f 100644 --- a/os/.gitignore +++ b/os/.gitignore @@ -1 +1 @@ -/pi-builder/ +/.build/ diff --git a/os/Makefile b/os/Makefile index f2696448..8b1bcbe5 100644 --- a/os/Makefile +++ b/os/Makefile @@ -1,32 +1,36 @@ +_BUILD_DIR=./.build + all: cat Makefile v1: make _pikvm PIKVM_PLATFORM=v1 -_pikvm: pi-builder - rm -rf pi-builder/builder/scripts/pikvm - cp -a platforms/$(PIKVM_PLATFORM) pi-builder/builder/scripts/pikvm - cd pi-builder && make _rpi \ +_pikvm: $(_BUILD_DIR) + rm -rf $(_BUILD_DIR)/stages/pikvm + rm -rf $(_BUILD_DIR)/builder/scripts/pikvm + cp -a platforms/$(PIKVM_PLATFORM) $(_BUILD_DIR)/stages/pikvm + cd $(_BUILD_DIR) && make _rpi \ PLATFORM=rpi-2 \ BUILDER=pikvm-builder \ - STAGES="base keys watchdog ro pikvm" + STAGES="base os ssh watchdog ro pikvm" \ + HOSTNAME=pikvm -pi-builder: - git clone https://github.com/mdevaev/pi-builder --depth=1 +$(_BUILD_DIR): + git clone --depth=1 https://github.com/mdevaev/pi-builder $(_BUILD_DIR) -format: pi-builder - cd pi-builder && make format +format: $(_BUILD_DIR) + cd $(_BUILD_DIR) && make format -install: pi-builder - cd pi-builder && make install +install: $(_BUILD_DIR) + cd $(_BUILD_DIR) && make install -scan: pi-builder - cd pi-builder && make scan +scan: $(_BUILD_DIR) + cd $(_BUILD_DIR) && make scan -clean: pi-builder - cd pi-builder && make clean +clean: $(_BUILD_DIR) + cd $(_BUILD_DIR) && make clean clean-all: - -cd pi-builder && make clean - rm -rf pi-builder + -cd $(_BUILD_DIR) && make clean-all + rm -rf $(_BUILD_DIR) diff --git a/os/platforms/v1/Dockerfile.part b/os/platforms/v1/Dockerfile.part new file mode 100644 index 00000000..c525b8e7 --- /dev/null +++ b/os/platforms/v1/Dockerfile.part @@ -0,0 +1,13 @@ +RUN pkg-install \ + kvmd \ + mjpg-streamer-pikvm \ + nginx + +COPY stages/pikvm/config.txt /boot/ +COPY stages/pikvm/99-pikvm.conf /etc/sysctl.d/ +COPY stages/pikvm/index.html /srv/http/ +COPY stages/pikvm/kvmd.yaml /etc/ +COPY stages/pikvm/nginx.conf /etc/nginx/ + +RUN systemctl enable kvmd +RUN systemctl enable nginx diff --git a/os/platforms/v1/index.html b/os/platforms/v1/index.html index 399d2e89..87281e88 100644 --- a/os/platforms/v1/index.html +++ b/os/platforms/v1/index.html @@ -36,15 +36,31 @@ function onWsMessage(message) { } } +function onKeyPress(event) { + console.log("key pressed: ", event); + let e = event || window.event || arguments.callee.caller.arguments[0]; +// ws.Send("EVENT press " + e.keyCode); +} + +function onKeyRelease(event) { + console.log("key released: ", event); + let e = event || window.event || arguments.callee.caller.arguments[0]; +// ws.Send("EVENT press " + e.keyCode); +} + ws = new WebSocket("ws://" + location.host + "/kvmd/ws"); ws.onmessage = (message) => onWsMessage(message); ws.onerror = (error) => console.error(error); ws.onclose = () => console.log("closed"); + +//https://www.codeday.top/2017/05/03/24906.html +document.onkeydown = onKeyPress; +document.onkeyup = onKeyRelease; </script> <body> <div class="screen"> - <img src="/video/?action=stream" id="stream-image" class="screen-image" alt="" /> + <img src="/streamer/?action=stream" id="stream-image" class="screen-image" alt="" /> </div> </body> </html> diff --git a/os/platforms/v1/run.sh b/os/platforms/v1/run.sh deleted file mode 100755 index 4dbc17a0..00000000 --- a/os/platforms/v1/run.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -set -e -set -x - -. ../functions.sh - - -pkg_install \ - kvmd \ - mjpg-streamer-pikvm \ - nginx - -cp config.txt "$FS/boot/" -cp 99-pikvm.conf "$FS/etc/sysctl.d/" -cp index.html "$FS/srv/http/" -cp kvmd.yaml "$FS/etc/" -cp nginx.conf "$FS/etc/nginx/" - -rpi systemctl enable kvmd -rpi systemctl enable nginx |