mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
new pi-builder
This commit is contained in:
parent
fa3d894172
commit
033ad8922c
2
os/.gitignore
vendored
2
os/.gitignore
vendored
@ -1 +1 @@
|
|||||||
/pi-builder/
|
/.build/
|
||||||
|
|||||||
38
os/Makefile
38
os/Makefile
@ -1,32 +1,36 @@
|
|||||||
|
_BUILD_DIR=./.build
|
||||||
|
|
||||||
all:
|
all:
|
||||||
cat Makefile
|
cat Makefile
|
||||||
|
|
||||||
v1:
|
v1:
|
||||||
make _pikvm PIKVM_PLATFORM=v1
|
make _pikvm PIKVM_PLATFORM=v1
|
||||||
|
|
||||||
_pikvm: pi-builder
|
_pikvm: $(_BUILD_DIR)
|
||||||
rm -rf pi-builder/builder/scripts/pikvm
|
rm -rf $(_BUILD_DIR)/stages/pikvm
|
||||||
cp -a platforms/$(PIKVM_PLATFORM) pi-builder/builder/scripts/pikvm
|
rm -rf $(_BUILD_DIR)/builder/scripts/pikvm
|
||||||
cd pi-builder && make _rpi \
|
cp -a platforms/$(PIKVM_PLATFORM) $(_BUILD_DIR)/stages/pikvm
|
||||||
|
cd $(_BUILD_DIR) && make _rpi \
|
||||||
PLATFORM=rpi-2 \
|
PLATFORM=rpi-2 \
|
||||||
BUILDER=pikvm-builder \
|
BUILDER=pikvm-builder \
|
||||||
STAGES="base keys watchdog ro pikvm"
|
STAGES="base os ssh watchdog ro pikvm" \
|
||||||
|
HOSTNAME=pikvm
|
||||||
|
|
||||||
pi-builder:
|
$(_BUILD_DIR):
|
||||||
git clone https://github.com/mdevaev/pi-builder --depth=1
|
git clone --depth=1 https://github.com/mdevaev/pi-builder $(_BUILD_DIR)
|
||||||
|
|
||||||
format: pi-builder
|
format: $(_BUILD_DIR)
|
||||||
cd pi-builder && make format
|
cd $(_BUILD_DIR) && make format
|
||||||
|
|
||||||
install: pi-builder
|
install: $(_BUILD_DIR)
|
||||||
cd pi-builder && make install
|
cd $(_BUILD_DIR) && make install
|
||||||
|
|
||||||
scan: pi-builder
|
scan: $(_BUILD_DIR)
|
||||||
cd pi-builder && make scan
|
cd $(_BUILD_DIR) && make scan
|
||||||
|
|
||||||
clean: pi-builder
|
clean: $(_BUILD_DIR)
|
||||||
cd pi-builder && make clean
|
cd $(_BUILD_DIR) && make clean
|
||||||
|
|
||||||
clean-all:
|
clean-all:
|
||||||
-cd pi-builder && make clean
|
-cd $(_BUILD_DIR) && make clean-all
|
||||||
rm -rf pi-builder
|
rm -rf $(_BUILD_DIR)
|
||||||
|
|||||||
13
os/platforms/v1/Dockerfile.part
Normal file
13
os/platforms/v1/Dockerfile.part
Normal 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
|
||||||
@ -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 = new WebSocket("ws://" + location.host + "/kvmd/ws");
|
||||||
ws.onmessage = (message) => onWsMessage(message);
|
ws.onmessage = (message) => onWsMessage(message);
|
||||||
ws.onerror = (error) => console.error(error);
|
ws.onerror = (error) => console.error(error);
|
||||||
ws.onclose = () => console.log("closed");
|
ws.onclose = () => console.log("closed");
|
||||||
|
|
||||||
|
//https://www.codeday.top/2017/05/03/24906.html
|
||||||
|
document.onkeydown = onKeyPress;
|
||||||
|
document.onkeyup = onKeyRelease;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="screen">
|
<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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -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
|
|
||||||
Loading…
x
Reference in New Issue
Block a user