installpackagemanager.sh 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # Needs some changes. METADISTRO has been included for usage.
  2. # REQUIRES FIXING
  3. #MIX ... this is where the addaption from gentoo to poly-distro develops
  4. #once this is "if"ed up, it will make much more sense for the mix... many distro bases will effectively skip this, having their package manager need no "installation", already present with their "stage" equivalent.
  5. echo "======================"
  6. BROWSER=$(sed -n '2p' $WITCH/config.txt)
  7. PROX=$(sed -n '3p' $WITCH/config.txt)
  8. DISTRONAME=$(sed -n '1p' $WITCH/config.base.txt)
  9. PACKAGEMGR=$(sed -n '4p' $WITCH/config.base.txt)
  10. echo "Browser: $BROWSER"
  11. echo "Proxy: $PROX"
  12. echo "Package manager: $PACKAGEMGR"
  13. echo "Distro name: $DISTRONAME"
  14. METADISTRO=$(sed -n '2p' $WITCH/config.base.txt)
  15. echo "Metadistro: $METADISTRO"
  16. echo "======================"
  17. if [ $DIMG_RUN == "true" ]; then
  18. SYSPATH=$WITCH/sys/$DISTRONAME
  19. else
  20. SYSPATH=/mnt/$DISTRONAME
  21. fi
  22. function howdlpkg {
  23. echo
  24. $WITCH/color.sh QUESTION "how would you like to fetch your package manager"
  25. echo
  26. $WITCH/color.sh GREEN "
  27. A. get it same way as in gentoo handbook (instructive)
  28. B. enter a direct URL to the package manager (INCOMPLETE)
  29. C. enter a location in the file system (already have downloaded)(INCOMPLETE)
  30. D. already extracted"
  31. read Stage3dlmethod
  32. case $Stage3dlmethod in
  33. A|a)
  34. echo "$Stage3dlmethod was selected."
  35. sleep 1
  36. browserpkg
  37. ;;
  38. B|b)
  39. echo "$Stage3dlmethod was selected."
  40. sleep 4
  41. urlpkg
  42. ;;
  43. C|c)
  44. echo "$Stage3dlmethod was selected."
  45. sleep 4
  46. locpkg
  47. ;;
  48. D|d)
  49. echo "Proceeding..."
  50. sleep 2
  51. ;;
  52. esac
  53. }
  54. # as with stage download above, this needs to be put in a more automated and option-able method. likely using "case - esac" or using earlier defined packagemanager choice. ... so likely will warrant a refunctionising, creating a separate installportage and installpaludis, and... other?
  55. # also, variablise it to be basedistro-savvy, so sensible defaults can be chosen, if ya like.
  56. #read -p "that is as much as we can do for that now. are you enjoying this so far?"
  57. #[ "$REPLY" == "y" ] echo "well good then. now we\'ll carry on getting your package manager too" && sleep 2
  58. # Let's make this automated first, then we can unify it easily with case statements.
  59. function browserpkg {
  60. echo "Now that the stage is installed, we continue to installing your package manager. READ CAREFULLY:"
  61. sleep 2
  62. echo "Press y to use \" $BROWSER \" to navigate http://www.gentoo.org/main/en/mirrors2.xml to the snapshots directory in a mirror close to you.
  63. in /snapshots/, download the latest Portage snapshot (portage-latest.tar.bz2 NOT portage-latest.tar.xz) by selecting it and pressing D. When it finishes downloading, exit the browser by pressing q."
  64. #we'll add ability to use any format later. or maybe ye who is reading this can. :P
  65. $WITCH/color.sh YELLOW "make sure it's in the $SYSPATH path"
  66. echo ""
  67. $WITCH/color.sh QUESTION "ready to download your portage (y - yes) (p - yes, with proxy support)"
  68. read
  69. case $REPLY in
  70. y|Y)
  71. $BROWSER http://www.gentoo.org/main/en/mirrors.xml
  72. $WITCH/color.sh QUESTION "ready to continue? (y)"
  73. read REPLY
  74. if [ "$REPLY" == "y" ]; then
  75. echo "proceeding"
  76. echo "so what's your package manager filename? (e.g. portage-latest.tar.bz2)"
  77. read FILENAME
  78. if [ -f $SYSPATH/$FILENAME ]
  79. then
  80. echo "excellent you seem to have got your package manager downloaded successfully."
  81. extractpkg $SYSPATH/$FILENAME
  82. else
  83. echo "sorry, it didnt seem like you got a package manager then... er... wtf do we do now? carry on n presume it\'s there? give up and run away crying? try again? well, it\'s up to you."
  84. sleep 2
  85. $WITCH/cauldren.sh
  86. fi
  87. fi
  88. ;;
  89. p|P)
  90. $BROWSER -http-proxy $PROX http://www.gentoo.org/main/en/mirrors.xml
  91. read -p "ready to continue? (y):"
  92. if [ "$REPLY" == "y" ]; then
  93. echo "proceeding"
  94. echo "so what's your package manager filename?"
  95. read FILENAME
  96. if [ -f $SYSPATH/$FILENAME ]; then
  97. echo "excellent you seem to have got your package manager downloaded successfully."
  98. sleep 2
  99. extractpkg $SYSPATH/$FILENAME
  100. else
  101. echo "sorry, it didnt seem like you got a package manager then... er... wtf do we do now? carry on n presume it\'s there? give up and run away crying? try again? well, it\'s up to you."
  102. sleep 2
  103. $WITCH/cauldren.sh
  104. fi
  105. fi
  106. ;;
  107. esac
  108. #sort this bit out FIXME
  109. #md5sum -c portage-latest.tar.bz2.md5sum
  110. }
  111. function urlpkg {
  112. echo "where are you getting your package manager compressed-tarball from? what's the exact url?"
  113. read PKGURL
  114. cd $SYSPATH/usr
  115. wget $PKGURL
  116. extractpkg $PKGURL
  117. }
  118. function locpkg {
  119. echo "where is your package manager compressed-tarball located at? what's the exact file path adress?"
  120. read PKGLOC
  121. extractpkg $PKGLOC
  122. }
  123. function extractpkg {
  124. echo "unpacking your stage3 ($FILE) to $SYSPATH/usr/. this may take some time, please wait."
  125. echo "extracting $1 to $SYSPATH/usr/"
  126. tar xvf $1 -C $SYSPATH/usr
  127. }
  128. howdlpkg