=== modified file 'adas/Makefile.in'
--- adas/Makefile.in	2007-12-12 20:53:05 +0000
+++ adas/Makefile.in	2021-01-15 01:10:52 +0000
@@ -10,7 +10,7 @@
 
 
 LIBDS_INCLUDES = -I/usr/include/libds `xml2-config --cflags`
-LIBDS_LIBS = -lds -lm
+LIBDS_LIBS = -lds -lm -lxml2
 
 CONNECTION_OBJECTS = connection.o comconnection.o netconnection.o
 CONNECTION_HEADERS = connection.h comconnection.h netconnection.h

=== modified file 'clients/Makefile'
--- clients/Makefile	2006-07-27 10:38:28 +0000
+++ clients/Makefile	2021-01-15 01:48:39 +0000
@@ -3,7 +3,7 @@
 all:	simple
 
 simple:	tools.o simple.o cli.o
-	gcc -o adas-simple -l curses -lm simple.o cli.o tools.o
+	gcc -o adas-simple simple.o cli.o tools.o -lcurses -lm
 
 cli.o:	cli.c display.h tools.h
 	gcc -c -I$(ADAS_PATH) -O1 cli.c

=== added file 'misc/adas-ubuntu.cron'
--- misc/adas-ubuntu.cron	1970-01-01 00:00:00 +0000
+++ misc/adas-ubuntu.cron	2021-01-15 04:43:30 +0000
@@ -0,0 +1,52 @@
+#! /bin/bash
+
+# Configure
+# apt install build-essential ncurses-dev libxml2-dev apache2 libapache2-mod-php php-xml ntp
+# cpan install Switch DateTime DateTime::Format::ISO8601
+
+# Install
+# 0. Copy web directory to /var/www/localhost
+# 1. Put configuration /etc/adas.cfg
+# 2. adas-ntp.pl & adas-ubuntu.cron to /etc/cron.hourly
+# 3. Install adas.pl adas_*. to /usr/bin
+# 4. Install adas-srv to /usr/bin
+# 5. Install clients/adas-simple to /usr/bin
+# 6. Install tools/nettest to /usr/bin
+# 7. Install namt/emu/namt-emu to /usr/bin
+# 8. Install emu/ascii.pl /usr/bin/adas-emu-ascii.pl
+# 9. Enable short-open-tags in php configs
+# 10. Set 'AllowOverride All' for /var/www/ in apache2.conf
+# 11. Set PrivateTmp=false in /lib/systemd/system/apache2.service (do systemctl daemon-reload)
+# 12. sudoers file
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/adas-srv, /usr/bin/adas.pl
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/killall
+    #www-data ALL=(ALL) NOPASSWD: /etc/init.d/adas, /etc/init.d/adas-eden, /etc/init.d/ntp-client, /etc/init.d/ntpd
+    #www-data ALL=(ALL) NOPASSWD: /sbin/halt, /sbin/reboot
+    #www-data ALL=(ALL) NOPASSWD: /etc/cron.hourly/adas-clean
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/chgrp -R adas /var/www/localhost/htdocs/data/
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/chmod -R g+w /var/www/localhost/htdocs/data/
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/chgrp adas /etc/adas.cfg
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/chmod g+w /etc/adas.cfg
+    #www-data ALL=(ALL) NOPASSWD: /usr/bin/touch /etc/adas.cfg
+    #www-data ALL=(ALL) NOPASSWD: /sbin/udevcontrol reload_rules
+    #www-data ALL=(ALL) NOPASSWD: /sbin/udevstart
+
+mkdir -p /tmp/adas
+
+mkdir -p /var/www/localhost
+mkdir -p /var/www/html/conf/flags
+chown www-data:www-data /var/www/html/conf/
+
+[ -L /home/ftp ] || rm -rf /home/ftp/
+[ -L /home/ftp ] || ln -sf /var/www/html/data /home/ftp
+[ -L /var/www/localhost/htdocs ] || ln -sf /var/www/html /var/www/localhost/htdocs
+
+b=`ps xa | grep adas.pl | grep -v grep`
+if [ -z "$b" ]; then
+    /usr/bin/adas.pl &> /dev/null &
+fi
+
+a=`ps xa | grep adas-srv | grep -v grep`
+if [ -z "$a" ]; then
+    /usr/bin/adas-srv daemon &> /dev/null
+fi

=== modified file 'misc/adas.pl'
--- misc/adas.pl	2008-11-05 19:56:26 +0000
+++ misc/adas.pl	2021-01-15 03:22:08 +0000
@@ -454,7 +454,10 @@
 
 my ($LOGSOCK, $ILOGSOCK, $NEWSOCK);
 my ($rhandle, $dhandle);
-my ($login, $pass, $uid, $gid) = getpwnam("apache") or die "Apache not installed!";
+
+my $apache_user;
+if (getpwnam("apache")) { $apache_user = "apache"; } elsif (getpwnam("www-data")) { $apache_user="www-data"; }
+my ($login, $pass, $uid, $gid) = getpwnam($apache_user) or die "Apache not installed!";
 
 if (! -d "/tmp/adas") { 
     mkdir "/tmp/adas";

=== modified file 'web/.htpasswd'
--- web/.htpasswd	2006-06-04 18:49:25 +0000
+++ web/.htpasswd	2021-01-15 02:44:40 +0000
@@ -1,1 +1,1 @@
-adas:F3jQoW5FvXE8g
+adas:F3X1J8G1nHLQQ

=== modified file 'web/about.php'
--- web/about.php	2008-04-06 20:02:18 +0000
+++ web/about.php	2021-01-15 03:44:44 +0000
@@ -91,7 +91,7 @@
 		echo "$rec[3]MB";
 		if ($rec[3]<50) { echo "</strong></span>"; }
 	    }
-	    else if (preg_match("/log/", $rec[5])) {
+	    else if (preg_match("/log$/", $rec[5])) {
 		if ($printed) echo ", ";
 		else $printed = 1;
 		echo "Log FS ~ ";
@@ -99,7 +99,7 @@
 		echo "$rec[3]MB";
 		if ($rec[3]<10) { echo "</strong></span>"; }
 	    }
-	    else if (preg_match("/ftp/", $rec[5])) {
+	    else if (preg_match("/ftp$/", $rec[5])) {
 		if ($printed) echo ", ";
 		else $printed = 1;
 		echo "FTP FS ~ ";
@@ -107,7 +107,15 @@
 		echo "$rec[3]MB";
 		if ($rec[3]<10) { echo "</strong></span>"; }
 	    }
-    
+	    else if (preg_match("/\/$/", $rec[5])) {
+		if ($printed) echo ", ";
+		else $printed = 1;
+		echo "ROOT FS ~ ";
+		if ($rec[3]<1024) { echo "<span class=\"highlight\"><strong>"; }
+		$rsize=round($rec[3]/1024);
+		echo "${rsize}GB";
+		if ($rec[3]<1024) { echo "</strong></span>"; }
+	    }
 	}
 	pclose($fp);	
     } else echo "Unknown";?><br/>
@@ -129,7 +137,7 @@
     if ($sock) {
 	while (!feof($sock)) {
 	    $record = fgets($sock);
-	    $rec = split(" ", $record, 3);
+	    $rec = explode(" ", $record, 3);
 	    
 	    if ($rec) {
 		$unixtime = strtotime($rec[0]);

=== modified file 'web/adjustconfig.php'
--- web/adjustconfig.php	2006-11-19 22:21:14 +0000
+++ web/adjustconfig.php	2021-01-15 04:14:22 +0000
@@ -42,7 +42,7 @@
 	} 
     }
     if ($notfound) {
-	if (function_exists("config_list_category")) $voltages .= config_list_category($catname, &$configured_voltages);
+	if (function_exists("config_list_category")) $voltages .= config_list_category($catname, $configured_voltages);
     }
     $voltages .= "</" . $catname . "s>";
 

=== modified file 'web/curdata.php'
--- web/curdata.php	2008-04-06 20:02:18 +0000
+++ web/curdata.php	2021-01-15 04:11:31 +0000
@@ -160,11 +160,13 @@
 	    }
 	}
     }
-    
-    $dirname = preg_replace("/\/\/+/","/",$tempdir);
-    $dirname = preg_replace("/\/+$/", "", $dirname);
-    if (!in_array($dirname, $pdirs)) {
-	$printed += curdata_dir($dirname, $today);
+
+    if (realpath($tempdir) != realpath($permdir)) {
+        $dirname = preg_replace("/\/\/+/","/",$tempdir);
+	$dirname = preg_replace("/\/+$/", "", $dirname);
+	if (!in_array($dirname, $pdirs)) {
+	    $printed += curdata_dir($dirname, $today);
+	}
     }
 } 
 

=== modified file 'web/log.php'
--- web/log.php	2006-11-08 01:05:51 +0000
+++ web/log.php	2021-01-15 04:48:27 +0000
@@ -8,11 +8,11 @@
 
     $sock = @fsockopen("/tmp/adas/logserv.socket");
     if (!$sock) $sock = @fsockopen("unix:///tmp/adas/logserv.socket");
-    
+
     if ($sock) {
 	while (!feof($sock)) {
 	    $record = fgets($sock);
-	    $rec = split(" ", $record, 3);
+	    $rec = explode(" ", $record, 3);
 	    if ($rec) {
 		$unixtime = strtotime($rec[0]);
 		$level = is_error($rec[1]);

=== modified file 'web/start.php'
--- web/start.php	2006-08-16 01:58:39 +0000
+++ web/start.php	2021-01-15 04:39:10 +0000
@@ -1,7 +1,7 @@
 <?
 if (!$authenticated) {
     echo $unauthorized;
-} else {
+} else if (file_exists("/etc/init.d/adas")) {
     $fp = popen("sudo /etc/init.d/adas start 2>&1", "r");
     if ($fp) {
 	while (!feof($fp)) {
@@ -11,5 +11,8 @@
     } 
 
     if (isset($_GET["redirect"])) redirect($_GET["redirect"], 0);    
-}    
+} else {
+    echo shell_exec("sudo adas-srv daemon >/dev/null 2>/dev/null &");
+    if (isset($_GET["redirect"])) redirect($_GET["redirect"], 0);
+}
 ?>
\ No newline at end of file

=== modified file 'web/stop.php'
--- web/stop.php	2006-08-16 01:58:39 +0000
+++ web/stop.php	2021-01-15 04:41:05 +0000
@@ -1,7 +1,7 @@
 <?
 if (!$authenticated) {
     echo $unauthorized;
-} else {
+} else if (file_exists("/etc/init.d/adas")) {
     $fp = popen("sudo /etc/init.d/adas stop 2>&1", "r");
     if ($fp) {
 	while (!feof($fp)) {
@@ -11,5 +11,8 @@
     } 
 
     if (isset($_GET["redirect"])) redirect($_GET["redirect"], 0);    
-}    
+} else {
+    echo shell_exec("sudo killall -9 adas-srv");
+    if (isset($_GET["redirect"])) redirect($_GET["redirect"], 0);
+}
 ?>
\ No newline at end of file

=== modified file 'web/tools.php'
--- web/tools.php	2013-07-09 03:19:50 +0000
+++ web/tools.php	2021-01-15 03:45:01 +0000
@@ -1422,7 +1422,7 @@
     if ($sock) {
 	while (!feof($sock)) {
 	    $record = fgets($sock);
-	    $rec = split(" ", $record, 3);
+	    $rec = explode(" ", $record, 3);
 	    
 	    if ($rec) {
 		$unixtime = strtotime($rec[0]);

