new pi-builder

This commit is contained in:
Devaev Maxim 2018-07-05 15:13:27 +00:00
parent fa3d894172
commit 033ad8922c
5 changed files with 52 additions and 39 deletions

2
os/.gitignore vendored
View File

@ -1 +1 @@
/pi-builder/
/.build/

View File

@ -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)

View File

@ -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

View File

@ -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>

View File

@ -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