-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions
80 lines (66 loc) · 2.04 KB
/
functions
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
#!/bin/bash
executable=/$(pwd)/executable
function heading_start () {
heading="$@"
echo "<li><a href=\"#\" onclick=\"toggleBullet(this)\">${heading}</a><ul>">>${ofile}
}
function sub_start () {
sub_heading="$@"
echo "<li><a href=\"#\" onclick=\"toggleBullet(this)\">${sub_heading}</a><ul><li><PRE>">>${ofile}
}
function sub_end () {
echo "</PRE></li></ul>">>${ofile}
}
function heading_end () {
echo "</ul></li>">>${ofile}
}
function run_command () {
cmd="$@"
bash -c "${cmd}" >>${ofile}
}
function runner_html () {
echo "Generating system stats please wait (can take a few minutes on slow systems)"
echo "File generated at ${ofile} on `date`"
echo "<HTML><HEAD>
<script language=\"javascript1.2\">
function toggleBullet(elm) {
var newDisplay = \"none\";
var e = elm.nextSibling;
while (e != null) {
if (e.tagName == \"UL\" || e.tagName == \"ul\") {
if (e.style.display == \"none\") newDisplay = \"block\";
break;
}
e = e.nextSibling;
}
while (e != null) {
if (e.tagName == \"UL\" || e.tagName == \"ul\") e.style.display = newDisplay;
e = e.nextSibling;
}
}
function collapseAll() {
var lists = document.getElementsByTagName('UL');
for (var j = 0; j < lists.length; j++)
lists[j].style.display = \"none\";
lists = document.getElementsByTagName('ul');
for (var j = 0; j < lists.length; j++)
lists[j].style.display = \"none\";
var e = document.getElementById(\"root\");
e.style.display = \"block\";
}
</script>
</HEAD>
<BODY onload='collapseAll();'>">${ofile}
echo "<H1>System Information</H1>">>${ofile}
echo "File generated on `date`">>${ofile}
echo "<div style=\"border: dashed 1px #000; padding: 3px; margin: 3px;\">">>${ofile}
echo "<ul id=\"root\">">>$ofile
dd if=${txt_cmds} of=${executable} && chmod +x ${executable}
/bin/bash ${executable}
echo "</ul></DIV></BODY></HTML>">>${ofile}
echo "Finished...100%, open up the file in your favourite web browser"
exit 0
}
function runner_html_test () {
echo ${ofile} >> ${ofile}
}