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.

135 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 */{,ROCK/}pkgs 2> /dev/null | sed -e 's,/pkgs$,,'`
  51. do
  52. cmd="$cmd '$x' 'ROCKCFG_SHORTID=\"$x\"'"
  53. done
  54. umount $mnt
  55. else
  56. cmd="$cmd 'The medium could not be mounted!' ''"
  57. fi
  58. rmdir $mnt
  59. }
  60. startgas() {
  61. [ -z "$( cd $dir; ls )" ] && mount $opt -v -o ro $dev $dir
  62. if [ "$ROCKCFG_SHORTID" = "Automatically choose first" ]; then
  63. ROCKCFG_SHORTID="$( cd $dir; ls -d */{,ROCK/}pkgs 2> /dev/null | \
  64. sed -e 's,/pkgs$,,' | head -n 1 )"
  65. echo "Using Config-ID <${ROCKCFG_SHORTID:-None}> .."
  66. fi
  67. if [ $startgas = 1 ] ; then
  68. echo
  69. echo "Running: gasgui $gasguiopt \\"
  70. echo " -c '$ROCKCFG_SHORTID' \\"
  71. echo " -t '$root' \\"
  72. echo " -d '$dev' \\"
  73. echo " -s '$dir'"
  74. echo
  75. gasgui $gasguiopt -c "$ROCKCFG_SHORTID" -t "$root" -d "$dev" -s "$dir"
  76. elif [ $startgas = 2 ] ; then
  77. echo
  78. echo "Running: stone gas main \\"
  79. echo " '$ROCKCFG_SHORTID' \\"
  80. echo " '$root' \\"
  81. echo " '$dev' \\"
  82. echo " '$dir'"
  83. $STONE gas main "$ROCKCFG_SHORTID" "$root" "$dev" "$dir"
  84. fi
  85. }
  86. main() {
  87. local startgas=0
  88. while : ; do
  89. cmd="gui_menu packages 'Package Management
  90. Note: You can install, update and remove packages (as well as query
  91. package information) with the command-line tool \"mine\". This is just
  92. a simple frontend for the \"mine\" program.'"
  93. cmd="$cmd 'Mount Options: $opt'"
  94. cmd="$cmd 'gui_input \"Mount Options (e.g. -s -o sync) \" \"\$opt\" opt'"
  95. cmd="$cmd 'Source Device: $dev'"
  96. cmd="$cmd 'gui_input \"Source Device\" \"\$dev\" dev'"
  97. cmd="$cmd 'Mountpoint: $dir'"
  98. cmd="$cmd 'gui_input \"Mountpoint\" \"\$dir\" dir'"
  99. cmd="$cmd 'ROCK Config ID: $ROCKCFG_SHORTID'"
  100. cmd="$cmd 'gui_input \"ROCK Config ID\""
  101. cmd="$cmd \"\$ROCKCFG_SHORTID\" ROCKCFG_SHORTID'"
  102. read_ids
  103. cmd="$cmd '' ''"
  104. type -p gasgui > /dev/null &&
  105. cmd="$cmd 'Start gasgui Package Manager (recommended)' 'startgas=1'"
  106. cmd="$cmd 'Start gastone Package manager (minimal)' 'startgas=2'"
  107. if eval "$cmd" ; then
  108. if [ $startgas != 0 ]; then
  109. startgas $startgas
  110. break
  111. fi
  112. else
  113. break
  114. fi
  115. done
  116. }