show_installed_version_diffs.sh 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. #called from ui_Classic and ui_Ziggy, after running findnames.sh.
  3. #120908 script created.
  4. #130511 pkg_chooser.sh has created layers-installed-packages (use instead of woof-installed-packages).
  5. export TEXTDOMAIN=petget___versiondiffs
  6. export OUTPUT_CHARSET=UTF-8
  7. #created by findnames.sh...
  8. [ ! -s /tmp/petget/filterpkgs.results.installed ] && exit
  9. #120908 "ALREADY INSTALLED" may not be helpful, as the versions may differ. display these...
  10. DIFFVERITEMS=""
  11. for ONEALREADYINSTALLED in `cut -f 1,2,3 -d '|' /tmp/petget/filterpkgs.results.installed`
  12. do
  13. #ex: langpack_de-20120718|langpack_de|20120718
  14. ONEPKG="$(echo -n "$ONEALREADYINSTALLED" | cut -f 1 -d '|')"
  15. ONENAMEONLY="$(echo -n "$ONEALREADYINSTALLED" | cut -f 2 -d '|')"
  16. ONEVERSION="$(echo -n "$ONEALREADYINSTALLED" | cut -f 3 -d '|')"
  17. onoPTN="|${ONENAMEONLY}|"
  18. INSTALLEDPKGS="$(cat /root/.packages/layers-installed-packages /root/.packages/user-installed-packages | grep "$onoPTN" | cut -f 1,3 -d '|' | tr '\n' ' ')"
  19. for AINSTALLEDPKG in $INSTALLEDPKGS
  20. do
  21. AIPKG="$(echo -n "$AINSTALLEDPKG" | cut -f 1 -d '|')"
  22. AIVER="$(echo -n "$AINSTALLEDPKG" | cut -f 2 -d '|')"
  23. if ! vercmp $AIVER eq $ONEVERSION;then
  24. DIFFVERITEMS="${DIFFVERITEMS}<item>${ONEPKG}|${AIPKG}</item>"
  25. fi
  26. done
  27. done
  28. [ "$DIFFVERITEMS" = "" ] && exit
  29. export ppm_versions='<window title="PPM: '$(gettext 'Version differences')'" icon-name="gtk-about">
  30. <vbox space-expand="true" space-fill="true">
  31. <frame>
  32. <vbox space-expand="false" space-fill="false">
  33. <hbox homogeneous="true">
  34. '"`/usr/lib/gtkdialog/xml_pixmap "dialog-info" popup`"'
  35. </hbox>
  36. <text xalign="0" use-markup="true" space-expand="true" space-fill="true">
  37. <label>"<b>'$(gettext "Version differences")'</b>"</label>
  38. </text>
  39. <text xalign="0" space-expand="true" space-fill="true">
  40. <label>'$(gettext "Normally in the PPM main window, if a package, regardless of version, is already installed, it will not be listed. HOWEVER, the output of a search lists all matching packages, including installed, and identifies already-installed packages with the text 'ALREADY INSTALLED' and a 'tick' icon.")'</label>
  41. </text>
  42. <text xalign="0" space-expand="true" space-fill="true">
  43. <label>'$(gettext "If a package found by a search is a different version than already installed, it is listed below. Please do not install such packages unless there is a particular reason to do so.")'</label>
  44. </text>
  45. </vbox>
  46. <vbox space-expand="true" space-fill="true">
  47. <table space-expand="true" space-fill="true">
  48. <label>'$(gettext 'Found package')'|'$(gettext 'Installed package')'</label>
  49. '${DIFFVERITEMS}'
  50. </table>
  51. </vbox>
  52. </frame>
  53. <hbox space-expand="false" space-fill="false">
  54. <button can-default="true" has-default="true">
  55. <variable>BUTTON_OK</variable>
  56. <label>'$(gettext 'Ok')'</label>
  57. <input file stock="gtk-ok"></input>
  58. <action type="exit">ok</action>
  59. </button>
  60. </hbox>
  61. </vbox>
  62. <action signal="show">grabfocus:BUTTON_OK</action>
  63. </window>'
  64. gtkdialog -p ppm_versions