-
-
Client settings
-
-
-
- 2 ) {
- exec( 'wpa_passphrase '.$ssid. ' ' . $psk,$network );
- foreach($network as $b) {
- $config .= "$b
-";
- }
- }
- }
- exec( "echo '$config' > /tmp/wifidata", $return );
- system( 'sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval );
- if( $returnval == 0 ) {
- echo '
Wifi settings updated successfully
-
';
- } else {
- echo '
Wifi settings failed to be updated
-
';
- }
-
- // scan networks
- } elseif( isset($_POST['Scan']) ) {
- $return = '';
- exec( 'sudo wpa_cli scan',$return );
- sleep(3);
- exec( 'sudo wpa_cli scan_results',$return );
- for( $shift = 0; $shift < 4; $shift++ ) {
- array_shift($return);
- }
- // display output
- echo '
- 'Model B Revision 1.0',
+ '0003' => 'Model B Revision 1.0 + ECN0001',
+ '0004' => 'Model B Revision 2.0 (256 MB)',
+ '0005' => 'Model B Revision 2.0 (256 MB)',
+ '0006' => 'Model B Revision 2.0 (256 MB)',
+ '0007' => 'Model A',
+ '0008' => 'Model A',
+ '0009' => 'Model A',
+ '000d' => 'Model B Revision 2.0 (512 MB)',
+ '000e' => 'Model B Revision 2.0 (512 MB)',
+ '000f' => 'Model B Revision 2.0 (512 MB)',
+ '0010' => 'Model B+',
+ '0013' => 'Model B+',
+ '0011' => 'Compute Module',
+ '0012' => 'Model A+',
+ 'a01041' => 'a01041',
+ 'a21041' => 'a21041',
+ '900092' => 'PiZero',
+ 'a02082' => 'Pi 3 Model B',
+ 'a22082' => 'Pi 3 Model B'
+ );
+ exec('cat /proc/cpuinfo', $cpuinfo_array);
+ $rev = trim(array_pop(explode(':',array_pop(preg_grep("/^Revision/", $cpuinfo_array)))));
+ if (array_key_exists($rev, $revisions)) {
+ return $revisions[$rev];
+ } else {
+ return 'Unknown Pi';
+ }
+}
+
+/**
+*
+*
+*/
+function DisplaySystem(){
+
+ // hostname
+ exec("hostname -f", $hostarray);
+ $hostname = $hostarray[0];
+
+ // uptime
+ $uparray = explode(" ", exec("cat /proc/uptime"));
+ $seconds = round($uparray[0], 0);
+ $minutes = $seconds / 60;
+ $hours = $minutes / 60;
+ $days = floor($hours / 24);
+ $hours = floor($hours - ($days * 24));
+ $minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
+ $uptime= '';
+ if ($days != 0) { $uptime .= $days . ' day' . (($days > 1)? 's ':' '); }
+ if ($hours != 0) { $uptime .= $hours . ' hour' . (($hours > 1)? 's ':' '); }
+ if ($minutes != 0) { $uptime .= $minutes . ' minute' . (($minutes > 1)? 's ':' '); }
+
+ // mem used
+ exec("free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { print used/total*100}'", $memarray);
+ $memused = floor($memarray[0]);
+ if ($memused > 90) { $memused_status = "danger"; }
+ elseif ($memused > 75) { $memused_status = "warning"; }
+ elseif ($memused > 0) { $memused_status = "success"; }
+
+ // cpu load
+ $cores = exec("grep -c ^processor /proc/cpuinfo");
+ $loadavg = exec("awk '{print $1}' /proc/loadavg");
+ $cpuload = floor(($loadavg * 100) / $cores);
+ if ($cpuload > 90) { $cpuload_status = "danger"; }
+ elseif ($cpuload > 75) { $cpuload_status = "warning"; }
+ elseif ($cpuload > 0) { $cpuload_status = "success"; }
+
+ ?>
+
+
+
+
System
+
+
+ System Rebooting Now!
';
+ $result = shell_exec("sudo /sbin/reboot");
+ }
+ if (isset($_POST['system_shutdown'])) {
+ echo '
System Shutting Down Now!
';
+ $result = shell_exec("sudo /sbin/shutdown -h now");
+ }
+ ?>
+
+
+
+
+
+
System Information
+
Hostname
+
Pi Revision
+
Uptime
+
Memory Used
+
+
CPU Load
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.php b/index.php
index 9bbaf3db..3eeb5289 100755
--- a/index.php
+++ b/index.php
@@ -44,6 +44,8 @@ include_once( 'includes/authenticate.php' );
include_once( 'includes/admin.php' );
include_once( 'includes/dhcp.php' );
include_once( 'includes/hostapd.php' );
+include_once( 'includes/system.php' );
+include_once( 'includes/configure_client.php' );
$output = $return = 0;
$page = $_GET['page'];
diff --git a/installers/common.sh b/installers/common.sh
index dbf1695e..917f3e43 100644
--- a/installers/common.sh
+++ b/installers/common.sh
@@ -97,7 +97,7 @@ function move_config_file() {
function patch_system_files() {
install_log "Patching system sudoers file"
# patch /etc/sudoers file
- sudo bash -c 'echo "www-data ALL=(ALL) NOPASSWD:/sbin/ifdown wlan0,/sbin/ifup wlan0,/bin/cat /etc/wpa_supplicant/wpa_supplicant.conf,/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_supplicant.conf,/sbin/wpa_cli scan_results, /sbin/wpa_cli scan,/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf, /etc/init.d/hostapd start,/etc/init.d/hostapd stop,/etc/init.d/dnsmasq start, /etc/init.d/dnsmasq stop,/bin/cp /tmp/dhcpddata /etc/dnsmasq.conf, /sbin/shutdown -h now, /sbin/reboot" | (EDITOR="tee -a" visudo)' \
+ sudo bash -c 'echo "www-data ALL=(ALL) NOPASSWD:/sbin/ifdown wlan0,/sbin/ifup wlan0,/bin/cat /etc/wpa_supplicant/wpa_supplicant.conf,/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_supplicant.conf,/sbin/wpa_cli scan_results, /sbin/wpa_cli scan,/sbin/wpa_cli reconfigure:/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf, /etc/init.d/hostapd start,/etc/init.d/hostapd stop,/etc/init.d/dnsmasq start, /etc/init.d/dnsmasq stop,/bin/cp /tmp/dhcpddata /etc/dnsmasq.conf, /sbin/shutdown -h now, /sbin/reboot" | (EDITOR="tee -a" visudo)' \
|| install_error "Unable to patch /etc/sudoers"
}
@@ -124,4 +124,4 @@ function install_raspap() {
move_config_file
patch_system_files
install_complete
-}
\ No newline at end of file
+}