opkginstall.patch 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. --- a/package/feeds/luci/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js
  2. +++ b/package/feeds/luci/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js
  3. @@ -232,7 +232,7 @@ function display(pattern)
  4. var avail = packages.available.pkgs[name],
  5. inst = packages.installed.pkgs[name];
  6. - if (!inst || !inst.installed)
  7. + if (!inst || !inst.installed || pkg.name.includes('opkg') || pkg.name.includes('kmod-') || 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'))
  8. continue;
  9. if (!avail || compareVersion(avail.version, pkg.version) <= 0)
  10. @@ -245,6 +245,7 @@ function display(pattern)
  11. btn = E('div', {
  12. 'class': 'btn cbi-button-positive',
  13. 'data-package': name,
  14. + 'action': 'upgrade',
  15. 'click': handleInstall
  16. }, _('Upgrade…'));
  17. }
  18. @@ -260,6 +261,9 @@ function display(pattern)
  19. }, _('Remove…'));
  20. }
  21. else {
  22. + if (pkg.name.includes('luci-i18n'))
  23. + continue;
  24. +
  25. var inst = packages.installed.pkgs[name];
  26. ver = truncateVersion(pkg.version || '-');
  27. @@ -268,12 +272,14 @@ function display(pattern)
  28. btn = E('div', {
  29. 'class': 'btn cbi-button-action',
  30. 'data-package': name,
  31. + 'action': 'install',
  32. 'click': handleInstall
  33. }, _('Install…'));
  34. - else if (inst.installed && inst.version != pkg.version)
  35. + else if (inst.installed && compareVersion(pkg.version, inst.version) > 0)
  36. btn = E('div', {
  37. 'class': 'btn cbi-button-positive',
  38. 'data-package': name,
  39. + 'action': 'upgrade',
  40. 'click': handleInstall
  41. }, _('Upgrade…'));
  42. else
  43. @@ -370,6 +376,12 @@ function handleMode(ev)
  44. currentDisplayMode = tab.getAttribute('data-mode');
  45. + if (currentDisplayMode == "updates"){
  46. + var filterv = document.querySelector('input[name="filter"]')
  47. + if ( filterv.value == "luci-app-")
  48. + filterv.value = ""
  49. + }
  50. +
  51. display(document.querySelector('input[name="filter"]').value);
  52. ev.target.blur();
  53. @@ -631,6 +643,7 @@ function handleReset(ev)
  54. function handleInstall(ev)
  55. {
  56. var name = ev.target.getAttribute('data-package'),
  57. + action = ev.target.getAttribute('action'),
  58. pkg = packages.available.pkgs[name],
  59. depcache = {},
  60. size;
  61. @@ -687,7 +700,7 @@ function handleInstall(ev)
  62. errs || inst || '',
  63. E('div', { 'class': 'right' }, [
  64. E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
  65. - E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'disabled': isReadonlyView }), ' ',
  66. + E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'checked': 'checked', 'disabled': isReadonlyView }), ' ',
  67. E('label', { 'for': 'overwrite-cb' }), ' ',
  68. _('Overwrite files from other package(s)')
  69. ]),
  70. @@ -697,7 +710,7 @@ function handleInstall(ev)
  71. }, _('Cancel')),
  72. ' ',
  73. E('div', {
  74. - 'data-command': 'install',
  75. + 'data-command': action,
  76. 'data-package': name,
  77. 'class': 'btn cbi-button-action',
  78. 'click': handleOpkg,
  79. @@ -881,6 +894,10 @@ function handleOpkg(ev)
  80. ]);
  81. var argv = [ cmd, '--force-removal-of-dependent-packages' ];
  82. +
  83. + argv.push('--force-checksum');
  84. +
  85. + argv.push('--force-depends');
  86. if (rem && rem.checked)
  87. argv.push('--autoremove');
  88. @@ -1027,7 +1044,7 @@ return view.extend({
  89. E('div', {}, [
  90. E('label', {}, _('Filter') + ':'),
  91. E('span', { 'class': 'control-group' }, [
  92. - E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query, 'keyup': handleKeyUp }),
  93. + E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': 'luci-app-', 'keyup': handleKeyUp }),
  94. E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ])
  95. ])
  96. ]),
  97. @@ -1056,14 +1073,6 @@ return view.extend({
  98. E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode }, E('a', { 'href': '#' }, [ _('Updates') ]))
  99. ]),
  100. - E('div', { 'class': 'controls', 'style': 'display:none' }, [
  101. - E('div', { 'id': 'pager', 'class': 'center' }, [
  102. - E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]),
  103. - E('div', { 'class': 'text' }, [ 'dummy' ]),
  104. - E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ])
  105. - ])
  106. - ]),
  107. -
  108. E('table', { 'id': 'packages', 'class': 'table' }, [
  109. E('tr', { 'class': 'tr cbi-section-table-titles' }, [
  110. E('th', { 'class': 'th col-2 left' }, [ _('Package name') ]),
  111. @@ -1072,6 +1081,14 @@ return view.extend({
  112. E('th', { 'class': 'th col-10 left' }, [ _('Description') ]),
  113. E('th', { 'class': 'th right cbi-section-actions' }, [ '\u00a0' ])
  114. ])
  115. + ]),
  116. +
  117. + E('div', { 'class': 'controls', 'style': 'display:none' }, [
  118. + E('div', { 'id': 'pager', 'class': 'center' }, [
  119. + E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]),
  120. + E('div', { 'class': 'text' }, [ 'dummy' ]),
  121. + E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ])
  122. + ])
  123. ])
  124. ]);
  125. --- a/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call
  126. +++ b/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call
  127. @@ -13,13 +13,13 @@ case "$action" in
  128. lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1)
  129. find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd
  130. ;;
  131. - install|update|remove)
  132. + install|update|upgrade|remove)
  133. (
  134. opkg="opkg"
  135. while [ -n "$1" ]; do
  136. case "$1" in
  137. - --autoremove|--force-overwrite|--force-removal-of-dependent-packages)
  138. + --autoremove|--force-overwrite|--force-removal-of-dependent-packages|--force-checksum|--force-depends)
  139. opkg="$opkg $1"
  140. shift
  141. ;;
  142. @@ -35,8 +35,32 @@ case "$action" in
  143. if flock -x 200; then
  144. $opkg $action "$@" </dev/null >/tmp/opkg.out 2>/tmp/opkg.err
  145. code=$?
  146. - stdout=$(cat /tmp/opkg.out)
  147. + if [[ $@ == luci-app-* && "$(opkg list | grep luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn)" ]]; then
  148. + $opkg $action luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn </dev/null >>/tmp/opkg.out 2>/dev/null
  149. + fi
  150. + case "$action" in
  151. + install|upgrade)
  152. + [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && {
  153. + rm -f /tmp/opkg.err
  154. + }
  155. + ;;
  156. + remove)
  157. + . /etc/profile.d/opkg.sh; opkg save
  158. + [ ! "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && {
  159. + rm -f /tmp/opkg.err
  160. + }
  161. + ;;
  162. + esac
  163. + grep -q "wget returned 8" /tmp/opkg.err && {
  164. + opkg update </dev/null >/tmp/opkg.out 2>/tmp/opkg.err
  165. + $opkg $action "$@" </dev/null >>/tmp/opkg.out 2>>/tmp/opkg.err
  166. + }
  167. stderr=$(cat /tmp/opkg.err)
  168. + [ -n "$stderr" ] || {
  169. + echo "🎉 已完成, 请关闭本窗口~" >>/tmp/opkg.out
  170. + code=0
  171. + }
  172. + stdout=$(cat /tmp/opkg.out)
  173. else
  174. code=255
  175. stderr="Failed to acquire lock"
  176. --- a/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  177. +++ b/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  178. @@ -20,6 +20,7 @@
  179. "/usr/libexec/opkg-call install *": [ "exec" ],
  180. "/usr/libexec/opkg-call remove *": [ "exec" ],
  181. "/usr/libexec/opkg-call update *": [ "exec" ],
  182. + "/usr/libexec/opkg-call upgrade *": [ "exec" ],
  183. "/etc/opkg.conf": [ "write" ],
  184. "/etc/opkg/*.conf": [ "write" ],
  185. "/tmp/upload.ipk": [ "write" ]
  186. --- a/package/base-files/files/sbin/sysupgrade
  187. +++ b/package/base-files/files/sbin/sysupgrade
  188. @@ -232,6 +232,7 @@ do_save_conffiles() {
  189. if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
  190. echo "${INSTALLED_PACKAGES}" >> "$CONFFILES"
  191. + . /etc/profile.d/opkg.sh; opkg save
  192. mkdir -p "$ETCBACKUP_DIR"
  193. # Avoid touching filesystem on each backup
  194. RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)"
  195. v "Saving config files..."
  196. --- a/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
  197. +++ b/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
  198. @@ -261,6 +261,7 @@ return view.extend({
  199. body.push(E('p', {}, E('label', { 'class': 'btn' }, [
  200. opts.backup_pkgs[0], ' ', _('Include in backup a list of current installed packages at /etc/backup/installed_packages.txt')
  201. ])));
  202. + opts.backup_pkgs[0].checked = true;
  203. };
  204. var cntbtn = E('button', {