mirror of the now-defunct rocklinux.org
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.

119 lines
3.3 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/sysfiles/stone_mod_packages.sh
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  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; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. #
  23. # [MAIN] 90 packages Package Management (Install, Update and Remove)
  24. if [ -n "$ROCK_INSTALL_SOURCE_DEV" ] ; then
  25. dev="$ROCK_INSTALL_SOURCE_DEV"
  26. dir="/mnt/source" ; root="/mnt/target"
  27. gasguiopt="-F"
  28. ROCKCFG_SHORTID="Automatically choose first"
  29. elif [ -n "$ROCK_INSTALL_SOURCE_URL" ] ; then
  30. dev="NETWORK INSTALL"
  31. dir="$ROCK_INSTALL_SOURCE_URL"
  32. root="/mnt/target"
  33. gasguiopt="-F"
  34. ROCKCFG_SHORTID="$( grep '^export ROCKCFG_SHORTID=' \
  35. /etc/ROCK-CONFIG/config 2> /dev/null | cut -f2- -d= )"
  36. ROCKCFG_SHORTID="${ROCKCFG_SHORTID//\'/}"
  37. else
  38. dev="/dev/cdroms/cdrom0"
  39. dir="/mnt/cdrom" ; root="/"
  40. gasguiopt=""
  41. ROCKCFG_SHORTID="$( grep '^export ROCKCFG_SHORTID=' \
  42. /etc/ROCK-CONFIG/config 2> /dev/null | cut -f2- -d= )"
  43. ROCKCFG_SHORTID="${ROCKCFG_SHORTID//\'/}"
  44. fi
  45. read_ids() {
  46. mnt="`mktemp`"
  47. rm -f $mnt ; mkdir $mnt
  48. cmd="$cmd '' ''"
  49. if mount $dev $mnt ; then
  50. for x in `cd $mnt; ls -d */pkgs | cut -f1 -d/` ; do
  51. cmd="$cmd '$x' 'ROCKCFG_SHORTID=\"$x\"'"
  52. done
  53. umount $mnt
  54. else
  55. cmd="$cmd 'The medium could not be mounted!' ''"
  56. fi
  57. rmdir $mnt
  58. }
  59. startgas() {
  60. [ -z "$( cd $dir; ls )" ] && mount -v -o ro $dev $dir
  61. if [ "$ROCKCFG_SHORTID" = "Automatically choose first" ]; then
  62. ROCKCFG_SHORTID="$( cd $dir; ls -d */pkgs | \
  63. cut -f1 -d/ | head -1 )"
  64. echo "Using Config-ID <${ROCKCFG_SHORTID:-None}> .."
  65. fi
  66. echo
  67. echo "Running: gasgui $gasguiopt \\"
  68. echo " -c '$ROCKCFG_SHORTID' \\"
  69. echo " -t '$root' \\"
  70. echo " -d '$dev' \\"
  71. echo " -s '$dir'"
  72. echo
  73. gasgui $gasguiopt -c "$ROCKCFG_SHORTID" -t "$root" -d "$dev" -s "$dir"
  74. }
  75. main() {
  76. local startgas=0
  77. while : ; do
  78. cmd="gui_menu packages 'Package Management
  79. Note: You can install, update and remove packages (as well as query
  80. package information) with the command-line tool \"mine\". This is just
  81. a simple frontend for the \"mine\" program.'"
  82. cmd="$cmd 'Source Device: $dev'"
  83. cmd="$cmd 'gui_input \"Source Device\" \"\$dev\" dev'"
  84. cmd="$cmd 'Mountpoint: $dir'"
  85. cmd="$cmd 'gui_input \"Mountpoint\" \"\$dir\" dir'"
  86. cmd="$cmd 'ROCK Config ID: $ROCKCFG_SHORTID'"
  87. cmd="$cmd 'gui_input \"ROCK Config ID\""
  88. cmd="$cmd \"\$ROCKCFG_SHORTID\" ROCKCFG_SHORTID'"
  89. read_ids
  90. cmd="$cmd '' ''"
  91. cmd="$cmd 'Start Package Manager' 'startgas=1'"
  92. if eval "$cmd" ; then
  93. if [ $startgas = 1 ]; then
  94. startgas
  95. break
  96. fi
  97. else
  98. break
  99. fi
  100. done
  101. }