installpackagemanager.sh 4.9 KB

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