opkginstall.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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('luci-lib-fs') || pkg.name.includes('base-files') || pkg.name.includes('luci-base') || pkg.name.includes('busybox') || 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. btn = E('div', {
  36. 'class': 'btn cbi-button-positive',
  37. 'data-package': name,
  38. + 'action': 'upgrade',
  39. 'click': handleInstall
  40. }, _('Upgrade…'));
  41. else
  42. @@ -370,6 +376,12 @@ function handleMode(ev)
  43. currentDisplayMode = tab.getAttribute('data-mode');
  44. + if (currentDisplayMode == "updates"){
  45. + var filterv = document.querySelector('input[name="filter"]')
  46. + if ( filterv.value == "luci-app-")
  47. + filterv.value = ""
  48. + }
  49. +
  50. display(document.querySelector('input[name="filter"]').value);
  51. ev.target.blur();
  52. @@ -631,6 +643,7 @@ function handleReset(ev)
  53. function handleInstall(ev)
  54. {
  55. var name = ev.target.getAttribute('data-package'),
  56. + action = ev.target.getAttribute('action'),
  57. pkg = packages.available.pkgs[name],
  58. depcache = {},
  59. size;
  60. @@ -687,7 +700,7 @@ function handleInstall(ev)
  61. errs || inst || '',
  62. E('div', { 'class': 'right' }, [
  63. E('label', { 'class': 'cbi-checkbox', 'style': 'float:left' }, [
  64. - E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'disabled': isReadonlyView }), ' ',
  65. + E('input', { 'id': 'overwrite-cb', 'type': 'checkbox', 'name': 'overwrite', 'checked': 'checked', 'disabled': isReadonlyView }), ' ',
  66. E('label', { 'for': 'overwrite-cb' }), ' ',
  67. _('Overwrite files from other package(s)')
  68. ]),
  69. @@ -697,7 +710,7 @@ function handleInstall(ev)
  70. }, _('Cancel')),
  71. ' ',
  72. E('div', {
  73. - 'data-command': 'install',
  74. + 'data-command': action,
  75. 'data-package': name,
  76. 'class': 'btn cbi-button-action',
  77. 'click': handleOpkg,
  78. @@ -881,6 +894,10 @@ function handleOpkg(ev)
  79. ]);
  80. var argv = [ cmd, '--force-removal-of-dependent-packages' ];
  81. +
  82. + argv.push('--force-checksum');
  83. +
  84. + argv.push('--force-depends');
  85. if (rem && rem.checked)
  86. argv.push('--autoremove');
  87. @@ -1027,7 +1044,7 @@ return view.extend({
  88. E('div', {}, [
  89. E('label', {}, _('Filter') + ':'),
  90. E('span', { 'class': 'control-group' }, [
  91. - E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query, 'keyup': handleKeyUp }),
  92. + E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': 'luci-app-', 'keyup': handleKeyUp }),
  93. E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ])
  94. ])
  95. ]),
  96. @@ -1056,14 +1073,6 @@ return view.extend({
  97. E('li', { 'data-mode': 'updates', 'class': 'installed cbi-tab-disabled', 'click': handleMode }, E('a', { 'href': '#' }, [ _('Updates') ]))
  98. ]),
  99. - E('div', { 'class': 'controls', 'style': 'display:none' }, [
  100. - E('div', { 'id': 'pager', 'class': 'center' }, [
  101. - E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]),
  102. - E('div', { 'class': 'text' }, [ 'dummy' ]),
  103. - E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ])
  104. - ])
  105. - ]),
  106. -
  107. E('table', { 'id': 'packages', 'class': 'table' }, [
  108. E('tr', { 'class': 'tr cbi-section-table-titles' }, [
  109. E('th', { 'class': 'th col-2 left' }, [ _('Package name') ]),
  110. @@ -1072,6 +1081,14 @@ return view.extend({
  111. E('th', { 'class': 'th col-10 left' }, [ _('Description') ]),
  112. E('th', { 'class': 'th right cbi-section-actions' }, [ '\u00a0' ])
  113. ])
  114. + ]),
  115. +
  116. + E('div', { 'class': 'controls', 'style': 'display:none' }, [
  117. + E('div', { 'id': 'pager', 'class': 'center' }, [
  118. + E('button', { 'class': 'btn cbi-button-neutral prev', 'aria-label': _('Previous page'), 'click': handlePage }, [ '«' ]),
  119. + E('div', { 'class': 'text' }, [ 'dummy' ]),
  120. + E('button', { 'class': 'btn cbi-button-neutral next', 'aria-label': _('Next page'), 'click': handlePage }, [ '»' ])
  121. + ])
  122. ])
  123. ]);
  124. --- a/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call
  125. +++ b/package/feeds/luci/luci-app-opkg/root/usr/libexec/opkg-call
  126. @@ -13,13 +13,13 @@ case "$action" in
  127. lists_dir=$(sed -rne 's#^lists_dir \S+ (\S+)#\1#p' /etc/opkg.conf /etc/opkg/*.conf 2>/dev/null | tail -n 1)
  128. find "${lists_dir:-/usr/lib/opkg/lists}" -type f '!' -name '*.sig' | xargs -r gzip -cd
  129. ;;
  130. - install|update|remove)
  131. + install|update|upgrade|remove)
  132. (
  133. opkg="opkg"
  134. while [ -n "$1" ]; do
  135. case "$1" in
  136. - --autoremove|--force-overwrite|--force-removal-of-dependent-packages)
  137. + --autoremove|--force-overwrite|--force-removal-of-dependent-packages|--force-checksum|--force-depends)
  138. opkg="$opkg $1"
  139. shift
  140. ;;
  141. @@ -34,6 +34,15 @@ case "$action" in
  142. if flock -x 200; then
  143. $opkg $action "$@" </dev/null >/tmp/opkg.out 2>/tmp/opkg.err
  144. + if [[ $@ == luci-app-* && "$(opkg list-installed | grep luci-i18n-"$(echo $@ | cut -d - -f 3-4)"-zh-cn)"]]; then
  145. + $opkg $action luci-i18n-"$(echo $@ | cut -d - -f 3-4)"-zh-cn </dev/null >>/tmp/opkg.out 2>/dev/null
  146. + fi
  147. + sed -i "/resolve_conffiles/d" /tmp/opkg.err || true
  148. + sed -i "/uci: Entry not found/d" /tmp/opkg.err || true
  149. + sed -i "/Existing conffile/d" /tmp/opkg.err || true
  150. + sed -i "/Couldn't unlink/d" /tmp/opkg.err || true
  151. + sed -i "/cannot find dependency kernel/d" /tmp/opkg.err || true
  152. + [[ "`cat /tmp/opkg.err`" =~ "^Collected errors:(\nCollected errors:){0,}$" ]] && rm -f /tmp/opkg.err || true
  153. code=$?
  154. stdout=$(cat /tmp/opkg.out)
  155. stderr=$(cat /tmp/opkg.err)
  156. @@ -47,6 +56,17 @@ case "$action" in
  157. [ -n "$stdout" ] && json_add_string stdout "$stdout"
  158. [ -n "$stderr" ] && json_add_string stderr "$stderr"
  159. json_dump
  160. +
  161. + case "$action" in
  162. + install)
  163. + [[ "$(opkg list-installed | cut -f 1 -d ' ' | grep $@)" && ! "$(cat /etc/backup/user_installed.opkg | grep ^$@$)" ]] && {
  164. + echo $@ >>/etc/backup/user_installed.opkg
  165. + }
  166. + ;;
  167. + remove)
  168. + sed -i "/^$@$/d" /etc/backup/user_installed.opkg
  169. + ;;
  170. + esac
  171. ) 200>/tmp/opkg.lock
  172. rm -f /tmp/opkg.lock /tmp/opkg.err /tmp/opkg.out
  173. --- a/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  174. +++ b/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  175. @@ -20,6 +20,7 @@
  176. "/usr/libexec/opkg-call install *": [ "exec" ],
  177. "/usr/libexec/opkg-call remove *": [ "exec" ],
  178. "/usr/libexec/opkg-call update *": [ "exec" ],
  179. + "/usr/libexec/opkg-call upgrade *": [ "exec" ],
  180. "/etc/opkg.conf": [ "write" ],
  181. "/etc/opkg/*.conf": [ "write" ],
  182. "/tmp/upload.ipk": [ "write" ]
  183. --- a/package/base-files/files/lib/functions.sh
  184. +++ b/package/base-files/files/lib/functions.sh
  185. @@ -199,6 +199,10 @@ default_prerm() {
  186. fi
  187. done
  188. + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua ||
  189. + sed -i '/_("NAS")/d' /usr/lib/lua/luci/controller/turboacc.lua
  190. + rm -Rf /tmp/luci-*
  191. +
  192. return $ret
  193. }
  194. @@ -250,6 +254,10 @@ default_postinst() {
  195. ret=$?
  196. fi
  197. + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua && ! grep -q '_("NAS")' /usr/lib/lua/luci/controller/*.lua &&
  198. + sed -i 's/local page/local page\nentry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false/' /usr/lib/lua/luci/controller/turboacc.lua
  199. + sed -i 's/ifname/device/' /etc/config/network
  200. +
  201. if [ -d "$root/rootfs-overlay" ]; then
  202. cp -R $root/rootfs-overlay/. $root/
  203. rm -fR $root/rootfs-overlay/
  204. @@ -272,7 +279,7 @@ default_postinst() {
  205. uci commit
  206. fi
  207. - rm -f /tmp/luci-indexcache
  208. + rm -Rf /tmp/luci-*
  209. fi
  210. local shell="$(command -v bash)"
  211. @@ -287,6 +294,8 @@ default_postinst() {
  212. fi
  213. done
  214. + /etc/init.d/ucitrack reload
  215. +
  216. return $ret
  217. }