From 1628b699f6672c491323b7436c4cfa5e4838375c Mon Sep 17 00:00:00 2001 From: Nikolay Vasilchuk Date: Sat, 26 Oct 2024 21:09:02 +0300 Subject: [PATCH] Fix upgrade --- web.mk | 1 - web/ipk/postinst | 2 +- web/ipk/postrm | 13 ------------ web/share/www/nfqws/index.php | 37 ++--------------------------------- 4 files changed, 3 insertions(+), 50 deletions(-) delete mode 100755 web/ipk/postrm diff --git a/web.mk b/web.mk index 691cd0e..d5dcd9e 100644 --- a/web.mk +++ b/web.mk @@ -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: diff --git a/web/ipk/postinst b/web/ipk/postinst index 8ea2b35..faad1ea 100755 --- a/web/ipk/postinst +++ b/web/ipk/postinst @@ -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/" diff --git a/web/ipk/postrm b/web/ipk/postrm deleted file mode 100755 index ee4e3bf..0000000 --- a/web/ipk/postrm +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -case "$1" in - upgrade) - # Do nothing - ;; - *) - /opt/etc/init.d/S80uhttpd stop - echo "Uninstallation successful" - ;; -esac - -exit 0 diff --git a/web/share/www/nfqws/index.php b/web/share/www/nfqws/index.php index 39ce786..3e880da 100644 --- a/web/share/www/nfqws/index.php +++ b/web/share/www/nfqws/index.php @@ -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' - $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); @@ -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':