OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.0 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../stone/stone_mod_gas.sh
  5. # Copyright (C) 2008 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. select_packages() {
  17. local namever installed uninstalled
  18. for (( ; ; )) ; do
  19. cmd="gui_menu gastone 'Install/Remove packages: $5
  20. Note: any (un)installations are done immediately'"
  21. installed=
  22. uninstalled=
  23. for (( i=${#pkgs[@]} - 1; i >= 0; i-- )) ; do
  24. if echo "${cats[$i]}" | grep -q -F "$5" ; then
  25. namever="${pkgs[$i]}-${vers[$i]}"
  26. if [ -f $2/var/adm/packages/${pkgs[$i]} ] ; then
  27. cmd="$cmd '[*] $namever' '$packager -r -R $2 ${pkgs[$i]}'"
  28. installed="$installed ${pkgs[$i]}"
  29. elif [ -f "$4/$1/pkgs/$namever$ext" ] ; then
  30. cmd="$cmd '[ ] $namever' '$packager -i -R $2 $4/$1/pkgs/$namever$ext'"
  31. uninstalled="$uninstalled $namever$ext"
  32. elif [ -f "$4/$1/pkgs/${pkgs[$i]}$ext" ] ; then
  33. cmd="$cmd '[ ] $namever' '$packaher -i -R $2 $4/$1/pkgs/${pkgs[$i]}$ext'"
  34. uninstalled="$uninstalled ${pkgs[$i]}$ext"
  35. fi
  36. fi
  37. done
  38. [ "$uninstalled$installed" ] && cmd="$cmd '' ''"
  39. [ "$uninstalled" ] && \
  40. cmd="$cmd 'Install all packages marked as [ ]' '(cd $4/$1/pkgs ; $packager -i -R $2 $uninstalled)'"
  41. [ "$installed" ] && \
  42. cmd="$cmd 'Uninstall all packages marked as [*]' '$packager -r -R $2 $installed'"
  43. eval "$cmd" || break
  44. done
  45. }
  46. main() {
  47. if ! [ -f $4/$1/pkgs/packages.db ] ; then
  48. gui_message "gas: package database not accessible."
  49. return
  50. fi
  51. if ! [ -d $2 ] ; then
  52. gui_message "gas: target directory not accessible."
  53. return
  54. fi
  55. if [ $2 = "${2#/}" ] ; then
  56. gui_message "gas: target directory not absolute."
  57. return
  58. fi
  59. local packager ext
  60. if type -p bize > /dev/null && ! type -p mine > /dev/null ; then
  61. packager=bize
  62. ext=.tar.bz2
  63. else
  64. packager=mine
  65. ext=.gem
  66. fi
  67. declare -a pkgs vers cats
  68. local a b category
  69. unset package
  70. while read a b ; do
  71. if [ "$a" = "[C]" ] ; then cats[${#pkgs[@]}]="${cats[${#pkgs[@]}]} $b"
  72. elif [ "$a" = "[V]" ] ; then vers[${#pkgs[@]}]="$b"
  73. elif [ -z "$b" ] ; then
  74. pkgs[${#pkgs[@]}]="$package"
  75. vers[${#pkgs[@]}]="0.0"
  76. cats[${#pkgs[@]}]="all/all"
  77. package="$a"
  78. else
  79. gui_message "gas: invalid package database input '$a $b'."
  80. return
  81. fi
  82. done < <( gzip -d < $4/$1/pkgs/packages.db | grep "^[a-zA-Z0-9_+.-]\+$\|^\[[CV]\]")
  83. [ "$package" ] && pkgs[${#pkgs[@]}]="$package"
  84. category="gui_menu category 'Select category'"
  85. for i in `echo ${cats[@]} | sed -e 's/ /\n/g' | sort -u` ; do
  86. category="$category $i 'select_packages $1 $2 $3 $4 $i'"
  87. done
  88. while eval "$category" ; do : ; done
  89. }