initialmakeconf.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ############
  2. ############
  3. # initialmakeconf
  4. # Gentoo's make.conf is in /etc/portage/ and not in /etc/
  5. echo "======================"
  6. EDITOR=$(sed -n '1p' $WITCH/config.txt)
  7. DISTRONAME=$(sed -n '1p' $WITCH/config.base.txt)
  8. echo "Editor: $EDITOR"
  9. echo "(base) Distro name: $DISTRONAME"
  10. METADISTRO=$(sed -n '2p' $WITCH/config.base.txt)
  11. echo "METADISTRO: $METADISTRO"
  12. echo "======================"
  13. ###### ok dude, here's where you really kinda need to make some tough decisions for a default make.conf, and also make options, and manual make.conf editing. ... n seriously, some sembelence of a default for rowan witch, would make sense.
  14. if [ $DIMG_RUN == "true" ]; then
  15. SYSPATH=$WITCH/sys/$DISTRONAME
  16. else
  17. SYSPATH=$/mnt/$DISTRONAME
  18. fi
  19. ## here goes. the variable selection based on different distros
  20. LOCATION="$SYSPATH/etc/make.conf"
  21. case "$METADISTRO" in
  22. "GENTOO") LOCATION="$SYSPATH/etc/portage/make.conf" ;; # look at http://www.gossamer-threads.com/lists/gentoo/dev/259544
  23. esac
  24. # being a nice guy, i'll create a symbolic link for them.
  25. if [ "$LOCATION" != "$SYSPATH/etc/make.conf" ]
  26. then
  27. echo "since your make.conf is in $LOCATION and not $SYSPATH/etc/make.conf we'll create a symbolic link for you."
  28. ln -s $LOCATION $SYSPATH/etc/make.conf
  29. fi
  30. #backup the original one.
  31. BACKUP=${LOCATION}.bk~
  32. if [ -f ${LOCATION}.bk~ ]
  33. then
  34. BACKUP=${LOCATION}.newbk~
  35. cp $LOCATION ${LOCATION}.newbk~
  36. else
  37. cp $LOCATION $BACKUP
  38. fi
  39. echo "made backup make.conf"
  40. echo "the backup is at: $BACKUP"
  41. sleep 1
  42. #put make.conf configuring in own function section too, utilising variables for different bases (gentoo, exherbo, etc)
  43. echo "for help with this, refer to chapter 5c of the gentoo handbook
  44. http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1&chap=5#doc_chap3"
  45. $WITCH/color.sh QUESTION "how do you wanna handle configuring your make.conf file? (or rather, your $LOCATION file, since it might be different)"
  46. $WITCH/color.sh GREEN "
  47. m - manually edit
  48. d - dont care, do it for me, default it. (warning, incomplete! overwrites!)
  49. w - wget from _____
  50. c - copy from _____
  51. v - vanilla - dont touch it!
  52. u - use the fully commented one from $SYSPATH/usr/share/portage/config/make.conf
  53. r - restore your backup"
  54. read
  55. case "$REPLY" in
  56. m)
  57. $EDITOR $LOCATION
  58. ;;
  59. d)
  60. echo "looks like the make.conf default hasnt been made yet. you will probably want to copy back from $SYSPATH/etc/make.conf~rawvanillaoriginal or $SYSPATH/etc/make.conf~wtfanewbackup $SYSPATH/usr/share/portage/config/make.conf or another from somewhere else, or make your own now, and maybe go to #witchlinux on irc.freenode.net and tell digitteknohippie he forgot he left the make.conf section in such a state of disrepair." | tee $LOCATION
  61. ;;
  62. w)
  63. echo "enter the url where your make.conf is located:"
  64. read MAKECONFURL
  65. wget $MAKECONFURL -o $LOCATION
  66. ;;
  67. c)
  68. echo "enter the location where your make.conf is located (e.g. $SYSPATH/usr/share/portage/config/make.conf):"
  69. read MAKECONFLOC
  70. cp $MAKECONFLOC $LOCATION
  71. ;;
  72. v)
  73. echo "well that is easily done. ... done."
  74. ;;
  75. u)
  76. echo "here goes"
  77. echo "cp $SYSPATH/usr/share/portage/config/make.conf $LOCATION"
  78. cp $SYSPATH/usr/share/portage/config/make.conf $LOCATION
  79. ;;
  80. r)
  81. echo "so you want to restore your backup?"
  82. cp $BACKUP $LOCATION
  83. ;;
  84. esac
  85. gentoo_config() {
  86. $WITCH/color.sh QUESTION "not finished with your make.conf yet. wanna pick a fast portage-mirror? "
  87. $WITCH/color.sh GREEN "
  88. m - manually edit
  89. d - choose near mirror(s) with mirrorselect. [recommended]
  90. v - vanilla - dont touch it."
  91. read REPLY
  92. case $REPLY in
  93. m)
  94. echo "forget to do that first time?"
  95. $EDITOR $SYSPATH/etc/make.conf
  96. ;;
  97. d)
  98. echo "now we cleverly do: mirrorselect -i -o >> $SYSPATH/etc/make.conf"
  99. mirrorselect -i -o >> $SYSPATH/etc/make.conf
  100. ;;
  101. v)
  102. echo "well that is easily done. ... done."
  103. ;;
  104. esac
  105. }
  106. if [ "$METADISTRO" == "GENTOO" ]; then
  107. gentoo_config
  108. fi
  109. #might this chunk aught be looped? so multiple checks can be done after edits? or is that just silly?
  110. #no, it is silly as it is now.
  111. echo "look at this and make sure it looks right. press 'q' to exit. press enter when you're ready."
  112. read enter
  113. less $LOCATION
  114. $WITCH/color.sh QUESTION "does that look right? (y/n)"
  115. read
  116. if [ "$REPLY" == "n" ]; then
  117. echo "fix it then:"
  118. sleep 1
  119. $EDITOR $LOCATION
  120. fi
  121. #remove this line if the above suggested looping gets made
  122. echo "well if it is not sorted as you want, you can always tweak it later when we're in the chroot system."
  123. #might wanna consider making that able to be called any time (or at least specific non-borky times)
  124. sleep 1