From patchwork Tue Jul 13 19:06:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo-Andres Hofmann X-Patchwork-Id: 4521 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4GPVVg1hWYz3xGv for ; Tue, 13 Jul 2021 19:06:51 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4GPVVb75bpz1fG; Tue, 13 Jul 2021 19:06:47 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4GPVVb0xFvz2yxx; Tue, 13 Jul 2021 19:06:47 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4GPVVZ1qltz2xVx for ; Tue, 13 Jul 2021 19:06:46 +0000 (UTC) Received: from arche.uberspace.de (arche.uberspace.de [185.26.156.147]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4GPVVS69TNz9l for ; Tue, 13 Jul 2021 19:06:40 +0000 (UTC) Received: (qmail 28296 invoked from network); 13 Jul 2021 19:06:39 -0000 Received: from localhost (HELO localhost) (127.0.0.1) by arche.uberspace.de with SMTP; 13 Jul 2021 19:06:39 -0000 From: Leo-Andres Hofmann To: development@lists.ipfire.org Subject: [PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button Date: Tue, 13 Jul 2021 21:06:28 +0200 Message-Id: <20210713190629.91-1-hofmann@leo-andres.de> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1626203201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BqtH24Ds004yD0f2hcjB9rkYaXQkE0EgWY914xe+HZo=; b=RlSXfKZegBGw+ICyHah6A9kkGLfCpbzgY7th7WwVfxQUK5E/BHAvQMPnOJh89Jr/oXAdSp pRvaKM7fvQ4nuZ/qOCUCvmW63TTL56vY35ov9Xlv3iaZnBZzbRujupQWvy+Vf12VpgvOKZ reXrej3s1CfUv7yTRyKD3lwFM0Ef3q6bQzv70w337XXccRM/LMmHXLFlAOreLAuVnt56Ge QBS4Ot1FAthiKmM+IKb3pWoKdNF9WoYVODQVYt3dAgOp8pzQCAlcP69LKc0iRlryHv1Sml pqwujQiObbKyE6OvWBJ1L3liFggJemji933zgCMLxbLsRiihvNmGooqOIeZy/g== ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1626203201; a=rsa-sha256; cv=none; b=C9BASA61p5kPd1vwCljjRB0VAxFQDSvHDke7/h6u8NTysbNktszQHASzjisrNr7b5nQmvt +B3uvfTPT5vIuv0EoOe9m9f1sEZuW1D6GXHhFJsjCPsEJNfk3lj74sA/X4pvbUBs8Qye9F ww9kFz4NiMD8HoLBEQoiPG3LtXD2bpRK3Bk7cnFETEqu5Laq0bIVaV+VdPBnPWSCkJzN14 DbNceivJntapdIddY8uTiRHYCJEXavG+q9h/XuGCkoer+dKA6a7306HKiT0+KYDyI7mbBR QxRnnPB+jh6J96KTFtXjC7tlndfKKWRitqBLa40x7TfSvHcWxt9ljbWhYXpDDw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de Authentication-Results: mail01.ipfire.org; dkim=none; dmarc=none; spf=pass (mail01.ipfire.org: domain of hofmann@leo-andres.de designates 185.26.156.147 as permitted sender) smtp.mailfrom=hofmann@leo-andres.de X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-2.57 / 11.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; MX_INVALID(0.50)[]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(-0.76)[-0.75820425564513]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_REPUTATION_HAM(-0.01)[asn: 205766(0.00), country: DE(-0.01), ip: 185.26.156.147(0.00)]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[leo-andres.de]; R_SPF_ALLOW(-0.20)[+mx]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:205766, ipnet:185.26.156.0/24, country:DE]; RCVD_COUNT_TWO(0.00)[2]; BAYES_HAM(-3.00)[99.99%] X-Rspamd-Queue-Id: 4GPVVS69TNz9l X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" ipfirereboot.c is able to force a file system check during reboot. This patch makes this function available in the shutdown GUI. Signed-off-by: Leo-Andres Hofmann --- html/cgi-bin/shutdown.cgi | 79 +++++++++++++++++++++++++++++---------- langs/de/cgi-bin/de.pl | 2 + langs/en/cgi-bin/en.pl | 2 + 3 files changed, 63 insertions(+), 20 deletions(-) diff --git a/html/cgi-bin/shutdown.cgi b/html/cgi-bin/shutdown.cgi index e0a2c9da0..1321e158b 100644 --- a/html/cgi-bin/shutdown.cgi +++ b/html/cgi-bin/shutdown.cgi @@ -1,11 +1,23 @@ #!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2021 IPFire Development Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use strict; @@ -17,6 +29,27 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +###--- HTML HEAD ---### +my $extraHead = < + table#controls { + width: 100%; + border: none; + table-layout: fixed; + } + #controls td { + text-align: center; + } + #controls button { + font-weight: bold; + padding: 0.7em; + min-width: 65%; + } + +END +; +###--- END HTML HEAD ---### + my %cgiparams=(); my $death = 0; my $rebirth = 0; @@ -26,33 +59,39 @@ my $rebirth = 0; $cgiparams{'ACTION'} = ''; &Header::getcgihash(\%cgiparams); -if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) { +if ($cgiparams{'ACTION'} eq "SHUTDOWN") { $death = 1; &General::log($Lang::tr{'shutting down ipfire'}); &General::system('/usr/local/bin/ipfirereboot', 'down'); -} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) { +} elsif ($cgiparams{'ACTION'} eq "REBOOT") { $rebirth = 1; &General::log($Lang::tr{'rebooting ipfire'}); &General::system('/usr/local/bin/ipfirereboot', 'boot'); +} elsif ($cgiparams{'ACTION'} eq "REBOOT_FSCK") { + $rebirth = 1; + &General::log($Lang::tr{'rebooting ipfire fsck'}); + &General::system('/usr/local/bin/ipfirereboot', 'bootfs'); } + if ($death == 0 && $rebirth == 0) { - &Header::openpage($Lang::tr{'shutdown control'}, 1, ''); + &Header::openpage($Lang::tr{'shutdown control'}, 1, $extraHead); &Header::openbigbox('100%', 'left'); + &Header::openbox('100%', 'left'); - print "
\n"; - - &Header::openbox('100%', 'left', ); print < - - - - - + + + + + + + +
+ END - ; +; &Header::closebox(); } else { diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 0d2228ede..76bf0469d 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -2085,11 +2085,13 @@ 'real address' => 'Reale Addresse', 'reboot' => 'Neustart', 'reboot ask' => 'Neustart?', +'reboot fsck' => 'Neustart & Dateisystem-Test', 'reboot question' => 'Extra Abfrage bei neustart und herunterfahren einschalten', 'reboot schedule' => 'Zeitsteuerung für IPFire Neustarts', 'reboot sure' => 'Sind Sie sicher, dass Sie neustarten wollen?', 'rebooting' => 'Starte neu ...', 'rebooting ipfire' => 'Starte IPFire neu', +'rebooting ipfire fsck' => 'Starte IPFire neu, Dateisystem-Test erzwingen', 'received' => 'Empfangen', 'reconnect' => 'Neu Verbinden', 'reconnection' => 'Wiederverbindung', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 2ba6961f3..181dc80b0 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -2120,11 +2120,13 @@ 'real address' => 'Real Address', 'reboot' => 'Reboot', 'reboot ask' => 'Reboot?', +'reboot fsck' => 'Reboot & check filesystem', 'reboot question' => 'Extra query for restart and shutdown', 'reboot schedule' => 'Schedule IPFire reboots', 'reboot sure' => 'Are you sure that you want to reboot?', 'rebooting' => 'Rebooting', 'rebooting ipfire' => 'Rebooting IPFire', +'rebooting ipfire fsck' => 'Rebooting IPFire, forcing filesystem check', 'received' => 'Received', 'reconnect' => 'Reconnect', 'reconnection' => 'Reconnection',