Update the HardwareChecker script

to work post-PM, however nothing makes any use of it yet.
This commit is contained in:
François Revol
2014-03-05 02:06:55 +01:00
parent 75d4568c15
commit 8e8f7748d3
+25 -6
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# HardwareChecker.sh for Haiku # HardwareChecker.sh for Haiku
# #
# Copyright 2011, François Revol <[email protected]>. # Copyright 2011-2014, François Revol <[email protected]>.
# #
# Distributed under the MIT License # Distributed under the MIT License
# #
@@ -12,6 +12,7 @@
netcat=netcat netcat=netcat
report_site=fake.haikuware.com report_site=fake.haikuware.com
report_cgi=http://haikuware.com/hwreport.php report_cgi=http://haikuware.com/hwreport.php
packages="dmidecode"
do_notify () do_notify ()
{ {
@@ -22,12 +23,21 @@ do_notify ()
notify --type progress \ notify --type progress \
--messageID hwck_$$ \ --messageID hwck_$$ \
--icon /system/apps/Devices \ --icon /system/apps/Devices \
--app HardwareChecker \ --group HardwareChecker \
--title "progress:" --progress "$p" "$m" "$@" --title "progress:" --progress "$p" "$m" "$@"
} }
try_install_packages ()
{
which pkgman >/dev/null 2>&1 || return
for p in $packages; do
pkgman install "$p" || alert "Unable to install package '$p'" "Ok"
done
}
start_fake_httpd () start_fake_httpd ()
{ {
report_port=8989 report_port=8989
@@ -35,7 +45,7 @@ start_fake_httpd ()
report_ack="<html><head></head><body><h1>Done! You can close this window now.</h1></body></html>" report_ack="<html><head></head><body><h1>Done! You can close this window now.</h1></body></html>"
report_cgi=http://127.0.0.1:$report_port/hwreport report_cgi=http://127.0.0.1:$report_port/hwreport
( (
# force a previous isntance to close # force a previous instance to close
$netcat 127.0.0.1 8989 < /dev/null > /dev/null $netcat 127.0.0.1 8989 < /dev/null > /dev/null
echo "listening on port $report_port" echo "listening on port $report_port"
# #
@@ -273,10 +283,16 @@ check_utils ()
ifconfig ifconfig
echo "</textarea>" echo "</textarea>"
echo "<h3><tt>installoptionalpackage -l</tt></h3>" echo "<h3><tt>pkgman list-repos</tt></h3>"
echo "<i>(list of configured package repositories)</i><br />"
echo "<textarea style='font-family: monospace' rows='10' cols='80' name='pkgman_list_repos_output' id='pkgman_list_repos_output' readonly='readonly'>"
pkgman list-repos
echo "</textarea>"
echo "<h3><tt>pkgman search -a</tt></h3>"
echo "<i>(list of installed packaged)</i><br />" echo "<i>(list of installed packaged)</i><br />"
echo "<textarea style='font-family: monospace' rows='10' cols='80' name='installoptpkg_l_output' id='installoptpkg_l_output' readonly='readonly'>" echo "<textarea style='font-family: monospace' rows='10' cols='80' name='pkgman_search_a_output' id='pkgman_search_a_output' readonly='readonly'>"
installoptionalpackage -l pkgman search -a
echo "</textarea>" echo "</textarea>"
echo "<br />" echo "<br />"
@@ -360,6 +376,9 @@ tf=/tmp/hw_checker_$$.html
do_notify 0.0 "Checking for network..." do_notify 0.0 "Checking for network..."
detect_network detect_network
do_notify 0.0 "Checking for needed packages..."
try_install_packages
check_all > "$tf" check_all > "$tf"
open "$tf" open "$tf"