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.

134 lines
3.9 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 $opt $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 $opt -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 -n 1 )"
  64. echo "Using Config-ID <${ROCKCFG_SHORTID:-None}> .."
  65. fi
  66. if [ $startgas = 1 ] ; then
  67. echo
  68. echo "Running: gasgui $gasguiopt \\"
  69. echo " -c '$ROCKCFG_SHORTID' \\"
  70. echo " -t '$root' \\"
  71. echo " -d '$dev' \\"
  72. echo " -s '$dir'"
  73. echo
  74. gasgui $gasguiopt -c "$ROCKCFG_SHORTID" -t "$root" -d "$dev" -s "$dir"
  75. elif [ $startgas = 2 ] ; then
  76. echo
  77. echo "Running: stone gas main \\"
  78. echo " '$ROCKCFG_SHORTID' \\"
  79. echo " '$root' \\"
  80. echo " '$dev' \\"
  81. echo " '$dir'"
  82. $STONE gas main "$ROCKCFG_SHORTID" "$root" "$dev" "$dir"
  83. fi
  84. }
  85. main() {
  86. local startgas=0
  87. while : ; do
  88. cmd="gui_menu packages 'Package Management
  89. Note: You can install, update and remove packages (as well as query
  90. package information) with the command-line tool \"mine\". This is just
  91. a simple frontend for the \"mine\" program.'"
  92. cmd="$cmd 'Mount Options: $opt'"
  93. cmd="$cmd 'gui_input \"Mount Options (e.g. -s -o sync) \" \"\$opt\" opt'"
  94. cmd="$cmd 'Source Device: $dev'"
  95. cmd="$cmd 'gui_input \"Source Device\" \"\$dev\" dev'"
  96. cmd="$cmd 'Mountpoint: $dir'"
  97. cmd="$cmd 'gui_input \"Mountpoint\" \"\$dir\" dir'"
  98. cmd="$cmd 'ROCK Config ID: $ROCKCFG_SHORTID'"
  99. cmd="$cmd 'gui_input \"ROCK Config ID\""
  100. cmd="$cmd \"\$ROCKCFG_SHORTID\" ROCKCFG_SHORTID'"
  101. read_ids
  102. cmd="$cmd '' ''"
  103. type -p gasgui > /dev/null &&
  104. cmd="$cmd 'Start gasgui Package Manager (recommended)' 'startgas=1'"
  105. cmd="$cmd 'Start gastone Package manager (minimal)' 'startgas=2'"
  106. if eval "$cmd" ; then
  107. if [ $startgas != 0 ]; then
  108. startgas $startgas
  109. break
  110. fi
  111. else
  112. break
  113. fi
  114. done
  115. }