opkginstall.patch 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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('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. 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. @@ -35,8 +35,36 @@ case "$action" in
  142. if flock -x 200; then
  143. $opkg $action "$@" </dev/null >/tmp/opkg.out 2>/tmp/opkg.err
  144. code=$?
  145. - stdout=$(cat /tmp/opkg.out)
  146. + if [[ $@ == luci-app-* && "$(opkg list | grep luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn)" ]]; then
  147. + $opkg $action luci-i18n-"$(echo $@ | cut -d - -f 3-)"-zh-cn </dev/null >>/tmp/opkg.out 2>/dev/null
  148. + fi
  149. + case "$action" in
  150. + install)
  151. + [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && {
  152. + rm -f /tmp/opkg.err
  153. + }
  154. + [[ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" && ! "$(cat /etc/backup/user_installed.opkg | grep -w $@)" ]] && {
  155. + echo $@ >>/etc/backup/user_installed.opkg
  156. + }
  157. + ;;
  158. + upgrade)
  159. + [ "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && {
  160. + rm -f /tmp/opkg.err
  161. + }
  162. + ;;
  163. + remove)
  164. + [ ! "$(opkg list-installed | cut -f 1 -d ' ' | grep -w $@)" ] && {
  165. + rm -f /tmp/opkg.err
  166. + }
  167. + sed -i "/^$@$/d" /etc/backup/user_installed.opkg
  168. + ;;
  169. + esac
  170. stderr=$(cat /tmp/opkg.err)
  171. + [ -n "$stderr" ] || {
  172. + echo "🎉 已完成, 请关闭本窗口~" >>/tmp/opkg.out
  173. + code=0
  174. + }
  175. + stdout=$(cat /tmp/opkg.out)
  176. else
  177. code=255
  178. stderr="Failed to acquire lock"
  179. --- a/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  180. +++ b/package/feeds/luci/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json
  181. @@ -20,6 +20,7 @@
  182. "/usr/libexec/opkg-call install *": [ "exec" ],
  183. "/usr/libexec/opkg-call remove *": [ "exec" ],
  184. "/usr/libexec/opkg-call update *": [ "exec" ],
  185. + "/usr/libexec/opkg-call upgrade *": [ "exec" ],
  186. "/etc/opkg.conf": [ "write" ],
  187. "/etc/opkg/*.conf": [ "write" ],
  188. "/tmp/upload.ipk": [ "write" ]
  189. --- a/package/base-files/files/lib/functions.sh
  190. +++ b/package/base-files/files/lib/functions.sh
  191. @@ -199,6 +199,10 @@ default_prerm() {
  192. fi
  193. done
  194. + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua ||
  195. + sed -i '/_("NAS")/d' /usr/lib/lua/luci/controller/turboacc.lua
  196. + rm -Rf /tmp/luci-*
  197. +
  198. return $ret
  199. }
  200. @@ -250,6 +254,10 @@ default_postinst() {
  201. ret=$?
  202. fi
  203. + grep -q '"nas",' /usr/lib/lua/luci/controller/*.lua && ! grep -q '_("NAS")' /usr/lib/lua/luci/controller/*.lua &&
  204. + sed -i 's/local page/local page\nentry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false/' /usr/lib/lua/luci/controller/turboacc.lua
  205. + sed -i 's/ifname/device/' /etc/config/network
  206. +
  207. if [ -d "$root/rootfs-overlay" ]; then
  208. cp -R $root/rootfs-overlay/. $root/
  209. rm -fR $root/rootfs-overlay/
  210. @@ -272,7 +279,7 @@ default_postinst() {
  211. uci commit
  212. fi
  213. - rm -f /tmp/luci-indexcache
  214. + rm -Rf /tmp/luci-*
  215. fi
  216. local shell="$(command -v bash)"
  217. @@ -287,6 +294,8 @@ default_postinst() {
  218. fi
  219. done
  220. + /etc/init.d/ucitrack reload
  221. +
  222. return $ret
  223. }
  224. --- a/package/base-files/files/sbin/sysupgrade
  225. +++ b/package/base-files/files/sbin/sysupgrade
  226. @@ -232,6 +232,7 @@ do_save_conffiles() {
  227. if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then
  228. echo "${INSTALLED_PACKAGES}" >> "$CONFFILES"
  229. + echo "${ETCBACKUP_DIR}/user_installed.opkg" >> "$CONFFILES"
  230. mkdir -p "$ETCBACKUP_DIR"
  231. # Avoid touching filesystem on each backup
  232. RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)"
  233. --- a/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
  234. +++ b/package/feeds/luci/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
  235. @@ -261,6 +261,7 @@ return view.extend({
  236. body.push(E('p', {}, E('label', { 'class': 'btn' }, [
  237. opts.backup_pkgs[0], ' ', _('Include in backup a list of current installed packages at /etc/backup/installed_packages.txt')
  238. ])));
  239. + opts.backup_pkgs[0].checked = true;
  240. };
  241. var cntbtn = E('button', {