Skip to content

Commit

Permalink
Fix upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonym-tsk committed Oct 26, 2024
1 parent b3246c6 commit 1628b69
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 50 deletions.
1 change: 0 additions & 1 deletion web.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ _web-control:
echo "" >> out/$(BUILD_DIR)/control/control

_web-scripts:
cp web/ipk/postrm out/$(BUILD_DIR)/control/postrm
cp web/ipk/postinst out/$(BUILD_DIR)/control/postinst

_web-ipk:
Expand Down
2 changes: 1 addition & 1 deletion web/ipk/postinst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

/opt/etc/init.d/S80uhttpd restart
/opt/etc/init.d/S80uhttpd start

ip_addr=$(ip -f inet addr show dev br0 2>/dev/null | grep inet | sed -n 's/.*inet \([0-9.]\+\).*/\1/p')
echo "NFQWS Web Interface installed: http://$ip_addr:88/nfqws/"
Expand Down
13 changes: 0 additions & 13 deletions web/ipk/postrm

This file was deleted.

37 changes: 2 additions & 35 deletions web/share/www/nfqws/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,39 +101,6 @@ function authenticate($username, $password) {
return false;
}

function opkgUpdate() {
$output = null;
$retval = null;
exec('opkg update', $output, $retval);
return array('output' => $output, 'status' => $retval);
}

function opkgUpgrade() {
$code = <<<'CODE'
<?php
$output = null;
$retval = null;
exec('opkg upgrade nfqws-keenetic nfqws-keenetic-web', $output, $retval);
if (empty($output)) {
$output[] = 'Nothing to upgrade';
}
$response = array('output' => $output, 'status' => $retval);
header('Content-Type: application/json; charset=utf-8');
http_response_code(200);
echo json_encode($response);
unlink('/opt/share/www/nfqws/opkg.php');
exit();
CODE;

$file = fopen('/opt/share/www/nfqws/opkg.php', 'w');
fwrite($file, $code);
fclose($file);

http_response_code(302);
header('Location: opkg.php');
exit();
}

function main() {
if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(302);
Expand Down Expand Up @@ -184,11 +151,11 @@ function main() {
break;

case 'update':
$response = opkgUpdate();
$response = opkgAction('update');
break;

case 'upgrade':
opkgUpgrade();
$response = opkgAction('upgrade nfqws-keenetic nfqws-keenetic-web');
break;

case 'login':
Expand Down

0 comments on commit 1628b69

Please sign in to comment.