--- a/package/feeds/luci/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js +++ b/package/feeds/luci/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js @@ -232,7 +232,7 @@ function display(pattern) var avail = packages.available.pkgs[name], inst = packages.installed.pkgs[name]; - if (!inst || !inst.installed) + if (!inst || !inst.installed || pkg.name.includes('opkg') || pkg.name.includes('luci-lib-fs') || pkg.name.includes('base-files') || pkg.name.includes('luci-base') || pkg.name.includes('busybox') || pkg.name.includes('nginx-') || pkg.name == "nginx" || pkg.name.includes('dnsmasq-full') || pkg.name.includes('firewall') || pkg.name.includes('miniupnpd') || pkg.name.includes('coremark') || pkg.name.includes('luci-mod-network') || pkg.name.includes('luci-mod-status') || pkg.name.includes('luci-mod-system')) continue; if (!avail || compareVersion(avail.version, pkg.version) <= 0) @@ -245,6 +245,7 @@ function display(pattern) btn = E('div', { 'class': 'btn cbi-button-positive', 'data-package': name, + 'action': 'upgrade', 'click': handleInstall }, _('Upgrade…')); } @@ -260,6 +261,9 @@ function display(pattern) }, _('Remove…')); } else { + if (pkg.name.includes('luci-i18n')) + continue; + var inst = packages.installed.pkgs[name]; ver = truncateVersion(pkg.version || '-'); @@ -268,12 +272,14 @@ function display(pattern) btn = E('div', { 'class': 'btn cbi-button-action', 'data-package': name, + 'action': 'install', 'click': handleInstall }, _('Install…')); else if (inst.installed && inst.version != pkg.version) btn = E('div', { 'class': 'btn cbi-button-positive', 'data-package': name, + 'action': 'upgrade', 'click': handleInstall }, _('Upgrade…')); else @@ -370,6 +376,12 @@ function handleMode(ev) currentDisplayMode = tab.getAttribute('data-mode'); + if (currentDisplayMode == "updates"){ + var filterv = document.querySelector('input[name="filter"]') + if ( filterv.value == "luci-app-") + filterv.value = "" + } + display(document.querySelector('input[name="filter"]').value); ev.target.blur(); @@ -631,6 +643,7 @@ function handleReset(ev) function handleInstall(ev) { var name = ev.target.getAttribute('data-package'), + action = ev.target.getAttribute('action'), pkg = packages.available.pkgs[name], depcache = {}, size; @@ -687,7 +700,7 @@ function handleInstall(ev) errs || inst || '', E('div', { 'class': 'right' }, [ E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [ - E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'disabled': isReadonlyView }), ' ', + E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'checked': 'checked', 'disabled': isReadonlyView }), ' ', E('label', { 'for': 'overwrite-cb' }), ' ', _('Overwrite files from other package(s)') ]), @@ -697,7 +710,7 @@ function handleInstall(ev) }, _('Cancel')), ' ', E('div', { - 'data-command': 'install', + 'data-command': action, 'data-package': name, 'class': 'btn cbi-button-action', 'click': handleOpkg, @@ -881,6 +894,10 @@ function handleOpkg(ev) ]); var argv = [ cmd, '--force-removal-of-dependent-packages' ]; + + argv.push('--force-checksum'); + + argv.push('--force-depends'); if (rem && rem.checked) argv.push('--autoremove'); @@ -1027,7 +1044,7 @@ return view.extend({ E('div', {}, [ E('label', {}, _('Filter') + ':'), E('span', { 'class': 'control-group' }, [ - E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query, 'keyup': handleKeyUp }), + E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': 'luci-app-', 'keyup': handleKeyUp }), E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ]) ]) ]), @@ -1056,14 +1073,6 @@ return view.extend({ E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode }, E('a', { 'href': '#' }, [ _('Updates') ])) ]), - E('div', { 'class': 'controls', 'style': 'display:none' }, [ - E('div', { 'id': 'pager', 'class': 'center' }, [ - E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]), - E('div', { 'class': 'text' }, [ 'dummy' ]), - E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ]) - ]) - ]), - E('table', { 'id': 'packages', 'class': 'table' }, [ E('tr', { 'class': 'tr cbi-section-table-titles' }, [ E('th', { 'class': 'th col-2 left' }, [ _('Package name') ]), @@ -1072,6 +1081,14 @@ return view.extend({ E('th', { 'class': 'th col-10 left' }, [ _('Description') ]), E('th', { 'class': 'th right cbi-section-actions' }, [ '\u00a0' ]) ]) + ]), + + E('div', { 'class': 'controls', 'style': 'display:none' }, [ + E('div', { 'id': 'pager', 'class': 'center' }, [ + E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]), + E('div', { 'class': 'text' }, [ 'dummy' ]), + E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ]) + ]) ]) ]); --- a/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call +++ b/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call @@ -13,13 +13,13 @@ case "$action" in lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1) find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd ;; - install|update|remove) + install|update|upgrade|remove) ( opkg="opkg" while [ -n "$1" ]; do case "$1" in - --autoremove|--force-overwrite|--force-removal-of-dependent-packages) + --autoremove|--force-overwrite|--force-removal-of-dependent-packages|--force-checksum|--force-depends) opkg="$opkg $1" shift ;; @@ -35,8 +35,36 @@ case "$action" in if flock -x 200; then $opkg $action "$@" /tmp/opkg.out 2>/tmp/opkg.err code=$? - stdout=$(cat /tmp/opkg.out) + if [[ $@ == luci-app-* && "$(opkg list | grep luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn)" ]]; then + $opkg $action luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn >/tmp/opkg.out 2>/dev/null + fi + case "$action" in + install) + [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && { + rm -f /tmp/opkg.err + } + [[ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" && ! "$(cat /etc/backup/user_installed.opkg | grep -w $@)" ]] && { + echo $@ >>/etc/backup/user_installed.opkg + } + ;; + upgrade) + [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && { + rm -f /tmp/opkg.err + } + ;; + remove) + [ ! "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && { + rm -f /tmp/opkg.err + } + sed -i "/^$@$/d" /etc/backup/user_installed.opkg + ;; + esac stderr=$(cat /tmp/opkg.err) + [ -n "$stderr" ] || { + echo "🎉 已完成, 请关闭本窗口~" >>/tmp/opkg.out + code=0 + } + stdout=$(cat /tmp/opkg.out) else code=255 stderr="Failed to acquire lock" --- a/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json +++ b/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json @@ -20,6 +20,7 @@ "/usr/libexec/opkg-call install *": [ "exec" ], "/usr/libexec/opkg-call remove *": [ "exec" ], "/usr/libexec/opkg-call update *": [ "exec" ], + "/usr/libexec/opkg-call upgrade *": [ "exec" ], "/etc/opkg.conf": [ "write" ], "/etc/opkg/*.conf": [ "write" ], "/tmp/upload.ipk": [ "write" ] --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -199,6 +199,10 @@ default_prerm() { fi done + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua || + sed -i '/_("NAS")/d' /usr/lib/lua/luci/controller/turboacc.lua + rm -Rf /tmp/luci-* + return $ret } @@ -250,6 +254,10 @@ default_postinst() { ret=$? fi + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua && ! grep -q '_("NAS")' /usr/lib/lua/luci/controller/*.lua && + sed -i 's/local page/local page\nentry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false/' /usr/lib/lua/luci/controller/turboacc.lua + sed -i 's/ifname/device/' /etc/config/network + if [ -d "$root/rootfs-overlay" ]; then cp -R $root/rootfs-overlay/. $root/ rm -fR $root/rootfs-overlay/ @@ -272,7 +279,7 @@ default_postinst() { uci commit fi - rm -f /tmp/luci-indexcache + rm -Rf /tmp/luci-* fi local shell="$(command -v bash)" @@ -287,6 +294,8 @@ default_postinst() { fi done + /etc/init.d/ucitrack reload + return $ret } --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -232,6 +232,7 @@ do_save_conffiles() { if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then echo "${INSTALLED_PACKAGES}" >> "$CONFFILES" + echo "${ETCBACKUP_DIR}/user_installed.opkg" >> "$CONFFILES" mkdir -p "$ETCBACKUP_DIR" # Avoid touching filesystem on each backup RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)" --- a/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js +++ b/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js @@ -261,6 +261,7 @@ return view.extend({ body.push(E('p', {}, E('label', { 'class': 'btn' }, [ opts.backup_pkgs[0], ' ', _('Include in backup a list of current installed packages at /etc/backup/installed_packages.txt') ]))); + opts.backup_pkgs[0].checked = true; }; var cntbtn = E('button', {