From patchwork Wed Sep 25 15:55:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1167446 X-Patchwork-Delegate: zajec5@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KVwGxdlj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oGl7DZgu"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46djNB2zg6z9sCJ for ; Thu, 26 Sep 2019 01:56:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=x05pMMUOnoAgn1cbxfYnqp3+6wFBHtOjIFO0k13MGFk=; b=KVwGxdljNeZu0G d0GFgD/t+0DdGsivGYPR/Fua2y0+77AekNTh80We0Tx9yOe9Df4IMi/o2Q8kGjc5AID61FsuWZRWC w/WFH8+PGLuPT7RoODBi6HPuMp7Y/irdFfURqTkHB2gQwAQucENRVxk3t6fj5B5K0PZs7fQZniprg hZU4FSxY7vBd4STfx5k02N5C518EBWZqFek0IAuTHc/Bu6zz6VEVLbuxjNwKR0BzIRPhp1UAxeTwb p3gWZfIOsJFO5PSy44TI9K6nCL8bLqc+EH/N6LimwHNmhQGEd5if9FnHzZH/dAEK3Gh1CiEC2g5PP lz1SX/iQ3BPgvnGNbiDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD9e6-00076e-51; Wed, 25 Sep 2019 15:56:02 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD9e0-00075S-O8 for openwrt-devel@lists.openwrt.org; Wed, 25 Sep 2019 15:55:58 +0000 Received: by mail-lf1-x135.google.com with SMTP id d17so4611769lfa.7 for ; Wed, 25 Sep 2019 08:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9FnRspK42mUNV8iCv9uTRlO0m/cGr5B9hzzNqmeqpFc=; b=oGl7DZguAnLX9YBrMPcm8L1gxQt9mGsk/UP8hsFlZZ/YXVgangqqIBGx2IFul40RUJ gJwiIZ0/yFkCasYVZX0oo57p8YobsOyOHO7tAyTFHt0EdFIpPO7YWZy1yvDf2CZb74VW GkcjxXRCnYAo06POQPChECofEWhDnt9/T02bICeEGm3pRGjvDqhYg5eRgwhRe5DZtKAL ONDFdxBgChh9Iacf8do3AXPiegW6Z+0qzt9sLFT67vZ6mNC3hwuGBgWeD4Pu8IAmboPC 8yRVdtU35l+wg8TT0sPIGBfh04CTCaVkCI4gdcOQ5VOOovl2T2Iep73RzV5KA5vx8gQJ v3qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9FnRspK42mUNV8iCv9uTRlO0m/cGr5B9hzzNqmeqpFc=; b=iv69cIt8y4n55g7I1ggbJAoND5iFZuZSAw06ZII59cKs3uWaWKTjHomQ18e2oPCCfl F2O5zeAX/xrBHVCVw5FUZB+SWp161jmcOgz5bVeR9GxK+h6+p7Z8IdmuKEg5LtqSqt4n xIUFNQWrSRFwBy9c4Es70stv9IazDGiuKobdWCAW3hEf+Od8wRbaAK+cri4UAPCX80wz MlFZyl703rpY6RpF/v9jxNCPtd2LZEqzZw0ahM5wkpfMvo+XDveYPWzYhyVA1kPqLBtT VvEdBkRcoSNiK0wSDkxBsKz6xWQdJxeOuLB0oV8Ul6Bfk4N5pDTQOUR15K74/sbgeWe8 NSUA== X-Gm-Message-State: APjAAAUOTKsKGcqr5GL0CI4FZGz/2Rgwydh5Jy48nKGBbDcxF1ZYvWrb vm/CKWAV2h/1wMGSUoQntgC2wdtA X-Google-Smtp-Source: APXvYqyDNh3UiBRw76R42KsCpsqaV/DI5oYsrprehhvZQ3Wp7bBtigoT+/7jj9sDGOdYSMTC1exW0w== X-Received: by 2002:ac2:5091:: with SMTP id f17mr6745802lfm.107.1569426954512; Wed, 25 Sep 2019 08:55:54 -0700 (PDT) Received: from localhost.localdomain (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id 202sm1282143ljf.75.2019.09.25.08.55.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Sep 2019 08:55:53 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: openwrt-devel@lists.openwrt.org, Jo-Philipp Wich Date: Wed, 25 Sep 2019 17:55:43 +0200 Message-Id: <20190925155543.9061-1-zajec5@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190925_085556_862503_71732044 X-CRM114-Status: GOOD ( 10.64 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:135 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH luci] luci-mod-system: check for sysupgrade with backup possibility X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Rafał Miłecki Some firmware images may not support preserving backup. In such cases display a warning and disable relevant checkbox. Signed-off-by: Rafał Miłecki --- .../resources/view/system/flash.js | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js index 1349fecd4..544deb279 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -359,10 +359,11 @@ return L.view.extend({ .then(function(res) { reply.push(res); return reply; }); }, this, ev.target)) .then(L.bind(function(btn, res) { - var keep = document.querySelector('[data-name="keep"] input[type="checkbox"]'), + var keep = E('input', { type: 'checkbox' }), force = E('input', { type: 'checkbox' }), is_valid = res[1].valid, is_forceable = res[1].forceable, + allow_backup = res[1].allow_backup, is_too_big = (storage_size > 0 && res[0].size > storage_size), body = []; @@ -370,8 +371,7 @@ return L.view.extend({ body.push(E('ul', {}, [ res[0].size ? E('li', {}, '%s: %1024.2mB'.format(_('Size'), res[0].size)) : '', res[0].checksum ? E('li', {}, '%s: %s'.format(_('MD5'), res[0].checksum)) : '', - res[0].sha256sum ? E('li', {}, '%s: %s'.format(_('SHA256'), res[0].sha256sum)) : '', - E('li', {}, keep.checked ? _('Configuration files will be kept') : _('Caution: Configuration files will be erased')) + res[0].sha256sum ? E('li', {}, '%s: %s'.format(_('SHA256'), res[0].sha256sum)) : '' ])); if (!is_valid || is_too_big) @@ -390,6 +390,18 @@ return L.view.extend({ _('The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform.') ])); + if (!allow_backup) + body.push(E('p', { 'class': 'alert-message' }, [ + _('The uploaded firmware does not allow keeping current configuration.') + ])); + if (allow_backup) + keep.checked = true; + else + keep.disabled = true; + body.push(E('p', {}, E('label', { 'class': 'btn' }, [ + keep, ' ', _('Keep settings and retain the current configuration') + ]))); + if ((!is_valid || is_too_big) && is_forceable) body.push(E('p', {}, E('label', { 'class': 'btn alert-message danger' }, [ force, ' ', _('Force upgrade'), @@ -537,15 +549,12 @@ return L.view.extend({ o = s.option(form.SectionValue, 'actions', form.NamedSection, 'actions', 'actions', _('Flash new firmware image'), has_sysupgrade - ? _('Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires a compatible firmware image).') + ? _('Upload a sysupgrade-compatible image here to replace the running firmware.') : _('Sorry, there is no sysupgrade support present; a new firmware image must be flashed manually. Please refer to the wiki for device specific install instructions.')); ss = o.subsection; if (has_sysupgrade) { - o = ss.option(form.Flag, 'keep', _('Keep settings')); - o.default = o.enabled; - o = ss.option(form.Button, 'sysupgrade', _('Image')); o.inputstyle = 'action important'; o.inputtitle = _('Flash image...');