Revert "Trying and catching"

This reverts commit 23a1e7a1d4.
This commit is contained in:
ehpersonal38
2022-06-01 17:10:43 -04:00
parent fb6ffee404
commit 4670a68533
2 changed files with 2 additions and 16 deletions
+1 -8
View File
@@ -4,14 +4,7 @@ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
$home = trim($home);
if(!isset($_SESSION['behind'])) {
$fetch = shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi fetch 2>&1");
// some kind of error
if(strlen($fetch) > 0) {
$fetch = shell_exec("sudo git -C ".$home."/BirdNET-Pi fetch 2>&1");
$_SESSION['behind'] = trim(shell_exec("sudo git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
} else {
$_SESSION['behind'] = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
}
$_SESSION['behind'] = trim(shell_exec("sudo -u$user git -C ".$home."/BirdNET-Pi fetch > /dev/null 2>&1 && sudo -u$user git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
}
if(intval($_SESSION['behind']) >= 99) {?>
<style>
+1 -8
View File
@@ -3,14 +3,7 @@ session_start();
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
$home = trim($home);
$fetch = shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi fetch 2>&1");
// some kind of error
if(strlen($fetch) > 0) {
$fetch = shell_exec("sudo git -C ".$home."/BirdNET-Pi fetch 2>&1");
$_SESSION['behind'] = trim(shell_exec("sudo git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
} else {
$_SESSION['behind'] = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
}
$_SESSION['behind'] = trim(shell_exec("sudo -u$user git -C ".$home."/BirdNET-Pi fetch > /dev/null 2>&1 && sudo -u$user git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
?><html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<br>