pakfire: Refactor dblist seperating UI and logic - Removed UI code from dblist function and refactor it making it return a hash representing the pak db for easier handling of this data. - Moved core update check in dblist to new seperate dbcoreinfo function making it return a hash with current and possibly available core version info. - Update existing calls to dblist - Bring UI parts previously in dblist to pakfire program itself, pakfire.cgi and index.cgi with a few small enhancements: - Translations for 'Core-Update', 'Release', 'Update' and 'Version' - Add currently installed version numbers to installed paks list in pakfire.cgi - Add 'Installed: yes/no' to pakfire list output so people not using colors have this information too. (Partly fixes Bug #12868) - Add update available details to pakfire list output if package has updates available. Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
pakfire.cgi: Implement Post/Redirect/Get pattern Refreshing the Pakfire page may cause a command to be executed multiple times and induce odd errors. This patch implements a HTTP 303 redirect after form processing, which causes the browser to discard the POST form data. Navigating backward or reloading the page now does not trigger multiple executions anymore. Fixes: #12781 Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Acked-by: Peter Müller <peter.muelle@ipfire.org>
pakfire.cgi: Show error and log messages earlier The main page cannot be used while an installation is running. Therefore it makes more sense to generate the log output first. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Acked-by: Peter Müller <peter.muelle@ipfire.org>
pakfire.cgi: Separate command processing and HTML generation Move most of the command execution away from the HTML output. This makes it easier to modify or extend individual commands. Also load Pakfire settings earlier to ensure that they are available during command execution. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Acked-by: Peter Müller <peter.muelle@ipfire.org>
pakfire.cgi: Cosmetic fix The two text passages for 'pakfire install...' and 'pakfire uninstall...' under 'Available' and 'Installed Addons:' are so close together that the first line appears as a single line. This patch separates these two areas a bit from each other so that they are better readable. Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
pakfire.cgi: Improve HTML output and layout Add missing closing tags, indentation and CSS styling. Add link to reboot notice, left-align info list and resize packages lists for better readability. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Acked-by: Peter Müller <peter.mueller@ipfire.org>
pakfire: Implement feedback from mailing list discussion - Improve lockfile test: Return immediately if lockfile is present, to prevent unnecessary and expensive "pidof" calls - Add better explanation to the log file reading command and JS - Change user interface: If no errors occurred, the page returns to the main screen (after a short delay). If an error occurred, the log output remains and a message is shown. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de> Acked-by: Peter Müller <peter.mueller@ipfire.org>
pakfire.cgi: Remove "sleep" after running Pakfire command The extended lockfile test seems to be sufficient to detect a running Pakfire process and display the logs. "Sleep" even proved to be counterproductive, as fast processes can finish in under a second and are then again not detected. Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
pakfire.cgi: Implement JavaScript log message display Currently the page becomes unresponsive while Pakfire is busy. This patch implements a AJAX/JSON driven log output, to provide continuous information to the user while Pakfire is running. The output is updated 1x per second, if the load should be too high, the interval can be change by writing to "pakfire.refreshInterval". Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
pakfire.cgi: Extend the lockfile test This implements a function to determine if Pakfire is already running. It tests the PID and lockfile and can be expanded easily later. 'pidof' checks the full path to avoid confusion. Removes the unreachable function "refreshpage". Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
pakfire.cgi: Bring back old logic for log displaying Trying to get rid of the system backpipe check if a pakfire is running does not work very well. It simply makes the code more complex and only introduced some new problems. This commit switches back to the old logic which worked well in the past. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
pakfire.cgi: Implement logic to lock the page until pakfire has been fully launched. When performing any action which requires pakfire, the page gets locked with an message informing the user that pakfire is working. The page will be reloaded when pakfire has been launched and is doing the requested operation - showing the well known log output. This also happens when pakfire has been launched via any kind of terminal or SSH session and the CGI gets accessed. Internally before pakfire gets started a variable called page_lock will be set to lock the page. An while loop will keep the page locked until pakfire is launched fully and has written it's lock_file. This approach will prevent us from any kind of required time intervall or race conditions. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>