-
Notifications
You must be signed in to change notification settings - Fork 6
/
info.sh
executable file
·90 lines (73 loc) · 1.92 KB
/
info.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
set -eu
dmesg=$(mktemp)
sysctl=$(mktemp)
ifconfig=$(mktemp)
usbdevs=$(mktemp)
pcidump=$(mktemp)
ssh root@$machine "sed -n '/^OpenBSD/{x;d;};H;\${x;p;}' /var/run/dmesg.boot" \
> $dmesg
ssh root@$machine sysctl > $sysctl
ssh root@$machine ifconfig -a inet hwfeatures > $ifconfig
ssh root@$machine 'usbdevs -vv' > $usbdevs
ssh root@$machine 'pcidump -v' > $pcidump
htmlescape() {
sed 's/&/\&/g;s/</\</g;s/>/\>/g;' $1
}
cat << EOF
<!doctype html>
<!-- DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED -->
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/style.css">
<style>
pre {
white-space: pre-wrap;
width: 80ch;
word-wrap: anywhere;
}
</style>
<title>$machine info</title>
</head>
<body>
<h1><em>Open</em>BSDLab - $machine info</h1>
<nav>
<a href="/index.html">Home</a>
<a href="/otx-config.html">otx config</a>
<a href="/newuser.html">new user</a>
<a href="/ssh_config.html">ssh_config</a>
<a href="/upgrade.html">upgrade</a>
<a href="/hw-setup.html">hardware setup</a>
<a href="/faq.html">faq</a>
<a href="/state.html">state</a>
<hr>
</nav>
<p>Automatically gathered information on $machine.<br>
<em>last updated: $(date "+%Y-%m-%d %H:%M:%S")</em></p>
<nav>
<a href="#dmesg">dmesg</a>
<a href="#sysctl">sysctl</a>
<a href="#ifconfig">ifconfig</a>
<a href="#usbdevs">usbdevs</a>
<a href="#pcidump">pcidump</a>
</nav>
<h2 id="dmesg">dmesg</h2>
<pre>$(htmlescape $dmesg)</pre>
<h2 id="sysctl">sysctl</h2>
<pre>$(htmlescape $sysctl)</pre>
<h2 id="ifconfig">ifconfig</h2>
<pre>$(htmlescape $ifconfig)</pre>
<h2 id="usbdevs">usbdevs</h2>
<pre>$(htmlescape $usbdevs)</pre>
<h2 id="pcidump">pcidump</h2>
<pre>$(htmlescape $pcidump)</pre>
<footer>
<hr>
<a href="https://www.genua.de/impressum.html">Impressum</a>
</footer>
</body>
</html>
EOF
rm $dmesg $sysctl $ifconfig $usbdevs $pcidump