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.

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