initialmakeconf.sh 4.7 KB

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