mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
os building environ
This commit is contained in:
parent
4c145f363f
commit
4804aa53b5
1
os/.gitignore
vendored
Normal file
1
os/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/pi-builder/
|
||||||
25
os/Makefile
Normal file
25
os/Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
all:
|
||||||
|
cat Makefile
|
||||||
|
|
||||||
|
pi-builder:
|
||||||
|
git clone https://github.com/mdevaev/pi-builder --depth=1
|
||||||
|
|
||||||
|
pi-kvm: pi-builder
|
||||||
|
rm -rf pi-builder/builder/scripts/kvm
|
||||||
|
cp -a kvm pi-builder/builder/scripts
|
||||||
|
cd pi-builder && make _rpi \
|
||||||
|
PLATFORM=rpi-2 \
|
||||||
|
BUILDER=kvm-builder \
|
||||||
|
STAGES="base keys watchdog ro kvm"
|
||||||
|
|
||||||
|
format: pi-builder
|
||||||
|
cd pi-builder && make format
|
||||||
|
|
||||||
|
install: pi-builder
|
||||||
|
cd pi-builder && make install
|
||||||
|
|
||||||
|
clean: pi-builder
|
||||||
|
cd pi-builder && make clean
|
||||||
|
|
||||||
|
clean-all: clean
|
||||||
|
rm -rf pi-builder
|
||||||
2
os/kvm/config.txt
Normal file
2
os/kvm/config.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
gpu_mem=16
|
||||||
|
dtparam=act_led_gpio=27
|
||||||
50
os/kvm/index.html
Normal file
50
os/kvm/index.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>π-kvm</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.screen, .screen * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.screen {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #e5e5f5;
|
||||||
|
font-family: Arial, Tahoma, Verdana, sans;
|
||||||
|
font-size: 10pt;
|
||||||
|
text-align: center;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.screen .screen-image {
|
||||||
|
width: 720px;
|
||||||
|
height: 576px;
|
||||||
|
border: 1px solid #77d;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function onWsMessage(message) {
|
||||||
|
console.log(message.data);
|
||||||
|
if (message.data == "EVENT mjpg_streamer started") {
|
||||||
|
document.getElementById("stream-image").src = "/video/?action=stream&time=" + new Date().getTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ws = new WebSocket("ws://" + location.host + "/kvm/ws");
|
||||||
|
ws.onmessage = (message) => onWsMessage(message);
|
||||||
|
ws.onerror = (error) => console.error(error);
|
||||||
|
ws.onclose = () => console.log("closed");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="screen">
|
||||||
|
<img src="/video/?action=stream" id="stream-image" class="screen-image" alt="" />
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
51
os/kvm/nginx.conf
Normal file
51
os/kvm/nginx.conf
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
user http;
|
||||||
|
worker_processes 4;
|
||||||
|
|
||||||
|
# error_log /tmp/nginx.error.log;
|
||||||
|
error_log /dev/null crit;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 64;
|
||||||
|
use epoll;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 10;
|
||||||
|
# gzip on;
|
||||||
|
|
||||||
|
server {
|
||||||
|
# access_log /tmp/nginx.access.log;
|
||||||
|
access_log off;
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
client_body_temp_path /tmp/nginx.client_body_temp;
|
||||||
|
fastcgi_temp_path /tmp/nginx.fastcgi_temp;
|
||||||
|
proxy_temp_path /tmp/nginx.proxy_temp;
|
||||||
|
scgi_temp_path /tmp/nginx.scgi_temp;
|
||||||
|
uwsgi_temp_path /tmp/nginx.uwsgi_temp;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /srv/http;
|
||||||
|
index index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /video {
|
||||||
|
rewrite /video/?(.*) /$1 break;
|
||||||
|
proxy_pass http://localhost:8082;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /kvm/ws {
|
||||||
|
rewrite /kvm/ws/?(.*) /ws break;
|
||||||
|
proxy_pass http://localhost:8081;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
os/kvm/run.sh
Executable file
19
os/kvm/run.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
. ../functions.sh
|
||||||
|
|
||||||
|
|
||||||
|
cat config.txt > "$FS/boot/config.txt"
|
||||||
|
pkg_install \
|
||||||
|
python \
|
||||||
|
python-pyaml \
|
||||||
|
python-aiohttp \
|
||||||
|
python-raspberry-gpio \
|
||||||
|
mjpg-streamer-pikvm \
|
||||||
|
nginx
|
||||||
|
|
||||||
|
cp index.html "$FS/srv/http/"
|
||||||
|
cp nginx.conf "$FS/etc/nginx/"
|
||||||
|
rpi systemctl enable nginx
|
||||||
Loading…
x
Reference in New Issue
Block a user