[fe30c61] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | #----------------------------#
|
---|
| 6 | get_book() { #
|
---|
| 7 | #----------------------------#
|
---|
| 8 | cd $JHALFSDIR
|
---|
| 9 |
|
---|
| 10 | if [ -z $WORKING_COPY ] ; then
|
---|
[7bd0866] | 11 | # Check for Subversion instead of just letting the script hit 'svn' and fail.
|
---|
[fe30c61] | 12 | test `type -p svn` || eval "echo \"This feature requires Subversion.\"
|
---|
| 13 | exit 1"
|
---|
| 14 | echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
|
---|
| 15 |
|
---|
| 16 | case $PROGNAME in
|
---|
| 17 | lfs) svn_root="LFS" ;;
|
---|
| 18 | hlfs) svn_root="HLFS" ;;
|
---|
[d68eb1b] | 19 | clfs*) ;;
|
---|
[fe30c61] | 20 | *) echo "BOOK not defined in function <get_book>"
|
---|
| 21 | exit 1 ;;
|
---|
| 22 | esac
|
---|
| 23 | # Grab a fresh book if it's missing, otherwise, update it from the
|
---|
| 24 | # repo. If we've already extracted the commands, move on to getting the
|
---|
| 25 | # sources.
|
---|
[7bd0866] | 26 | if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] &&
|
---|
| 27 | [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
|
---|
[92b7cb8] | 28 | svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
[7bd0866] | 29 | elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] ||
|
---|
| 30 | [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
|
---|
[92b7cb8] | 31 | echo $TREE
|
---|
| 32 | git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
|
---|
| 33 | if [ ! $TREE == "development" ]; then
|
---|
| 34 | cd ${PROGNAME}-$LFSVRS
|
---|
| 35 | echo "Checking out $LFSVRS at $PWD in $TREE"
|
---|
[ad4ff97] | 36 | git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
---|
[92b7cb8] | 37 | fi
|
---|
[1cf621b] | 38 | else
|
---|
| 39 | cd ${PROGNAME}-$LFSVRS
|
---|
[92b7cb8] | 40 | case $PROGNAME in
|
---|
[ad4ff97] | 41 | clfs*) git pull >>$LOGDIR/$LOG 2>&1
|
---|
[7ce6de2] | 42 | if [ ! $TREE == "development" ]; then
|
---|
| 43 | git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
|
---|
| 44 | fi
|
---|
| 45 | ;;
|
---|
[92b7cb8] | 46 | lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
|
---|
| 47 | *) ;;
|
---|
| 48 | esac
|
---|
[fe30c61] | 49 | fi
|
---|
[1cf621b] | 50 | echo -ne "done\n"
|
---|
[fe30c61] | 51 |
|
---|
| 52 | else
|
---|
| 53 | echo -ne "Using $BOOK as book's sources ...\n"
|
---|
| 54 | fi
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | #----------------------------#
|
---|
| 58 | extract_commands() { #
|
---|
| 59 | #----------------------------#
|
---|
| 60 |
|
---|
| 61 | cd $JHALFSDIR
|
---|
| 62 | case $PROGNAME in
|
---|
[92b7cb8] | 63 | clfs*)
|
---|
[a1dd968] | 64 | VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
[7bd0866] | 65 | lfs)
|
---|
| 66 | if [ "$INITSYS" = "sysv" ] ; then
|
---|
| 67 | VERSION=$(grep 'ENTITY version ' $BOOK/general.ent| cut -d\" -f2)
|
---|
| 68 | else
|
---|
| 69 | VERSION=$(grep 'ENTITY versiond' $BOOK/general.ent| cut -d\" -f2)
|
---|
| 70 | fi
|
---|
| 71 | ;;
|
---|
[fe30c61] | 72 | *)
|
---|
| 73 | VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
| 74 | esac
|
---|
| 75 |
|
---|
[d68eb1b] | 76 | # Clean
|
---|
| 77 | rm -rf ${PROGNAME}-commands
|
---|
[fe30c61] | 78 |
|
---|
[d68eb1b] | 79 | # Extract the commands
|
---|
| 80 | echo -n "Extracting commands for"
|
---|
[fe30c61] | 81 | case ${PROGNAME} in
|
---|
| 82 | clfs)
|
---|
[b11c10b] | 83 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[7bd0866] | 84 | xsltproc --nonet \
|
---|
| 85 | --xinclude \
|
---|
| 86 | --stringparam method $METHOD \
|
---|
| 87 | --stringparam testsuite $TEST \
|
---|
[fe30c61] | 88 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
[7bd0866] | 89 | --stringparam vim-lang $VIMLANG \
|
---|
| 90 | --stringparam timezone $TIMEZONE \
|
---|
| 91 | --stringparam page $PAGE \
|
---|
| 92 | --stringparam lang $LANG \
|
---|
| 93 | --stringparam sparc $SPARC64_PROC \
|
---|
| 94 | --stringparam x86 $TARGET \
|
---|
| 95 | --stringparam mips $TARGET \
|
---|
| 96 | -o ./${PROGNAME}-commands/ \
|
---|
| 97 | $XSL \
|
---|
| 98 | $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[fe30c61] | 99 | ;;
|
---|
| 100 |
|
---|
| 101 | clfs2)
|
---|
[b11c10b] | 102 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[7bd0866] | 103 | xsltproc --nonet \
|
---|
| 104 | --xinclude \
|
---|
| 105 | --stringparam vim-lang $VIMLANG \
|
---|
[fe30c61] | 106 | --stringparam timezone $TIMEZONE \
|
---|
[7bd0866] | 107 | --stringparam page $PAGE \
|
---|
| 108 | --stringparam lang $LANG \
|
---|
| 109 | --output ./${PROGNAME}-commands/ \
|
---|
| 110 | $XSL \
|
---|
| 111 | $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[fe30c61] | 112 | ;;
|
---|
| 113 |
|
---|
| 114 | clfs3)
|
---|
[b11c10b] | 115 | echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
|
---|
[7bd0866] | 116 | xsltproc --nonet \
|
---|
| 117 | --xinclude \
|
---|
| 118 | --stringparam endian x$ENDIAN \
|
---|
[fe30c61] | 119 | --stringparam timezone $TIMEZONE \
|
---|
[7bd0866] | 120 | --stringparam page $PAGE \
|
---|
| 121 | --stringparam lang $LANG \
|
---|
| 122 | --output ./${PROGNAME}-commands/ \
|
---|
| 123 | $XSL \
|
---|
| 124 | $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[fe30c61] | 125 | ;;
|
---|
| 126 |
|
---|
| 127 | hlfs)
|
---|
[139c34e] | 128 | echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
|
---|
[7bd0866] | 129 | xsltproc --nonet \
|
---|
| 130 | --xinclude \
|
---|
| 131 | --stringparam model $MODEL \
|
---|
| 132 | --stringparam kernel $KERNEL \
|
---|
| 133 | --stringparam testsuite $TEST \
|
---|
| 134 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 135 | --stringparam features \
|
---|
| 136 | x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
|
---|
| 137 | --stringparam timezone $TIMEZONE \
|
---|
| 138 | --stringparam page $PAGE \
|
---|
| 139 | --stringparam lang $LANG \
|
---|
| 140 | --stringparam grsecurity_host $GRSECURITY_HOST \
|
---|
| 141 | --output ./${PROGNAME}-commands/ \
|
---|
| 142 | $XSL \
|
---|
| 143 | $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
---|
[fe30c61] | 144 | ;;
|
---|
| 145 | lfs)
|
---|
[b11c10b] | 146 | echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
|
---|
[f21dff8] | 147 | pushd $BOOK > /dev/null
|
---|
[66c09d0] | 148 | if [ -f process-scripts.sh ]; then
|
---|
[f0a31de] | 149 | bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
|
---|
| 150 | fi
|
---|
[f21dff8] | 151 | popd > /dev/null
|
---|
[7bd0866] | 152 |
|
---|
| 153 | xsltproc --nonet \
|
---|
| 154 | --xinclude \
|
---|
| 155 | --output /tmp/lfs-full.xml \
|
---|
| 156 | --stringparam profile.revision $INITSYS \
|
---|
| 157 | $BOOK/stylesheets/lfs-xsl/profile.xsl \
|
---|
| 158 | $BOOK/index.xml
|
---|
| 159 |
|
---|
[df42c7c] | 160 | xsltproc --nonet \
|
---|
| 161 | --stringparam testsuite $TEST \
|
---|
| 162 | --stringparam bomb-testsuite $BOMB_TEST \
|
---|
| 163 | --stringparam vim-lang $VIMLANG \
|
---|
| 164 | --stringparam full-locale $FULL_LOCALE \
|
---|
| 165 | --stringparam timezone $TIMEZONE \
|
---|
| 166 | --stringparam page $PAGE \
|
---|
| 167 | --stringparam lang $LANG \
|
---|
| 168 | --stringparam pkgmngt $PKGMNGT \
|
---|
| 169 | --stringparam wrap-install $WRAP_INSTALL \
|
---|
| 170 | --stringparam hostname $HOSTNAME \
|
---|
| 171 | --stringparam interface $INTERFACE \
|
---|
| 172 | --stringparam ip $IP_ADDR \
|
---|
| 173 | --stringparam gateway $GATEWAY \
|
---|
| 174 | --stringparam prefix $PREFIX \
|
---|
| 175 | --stringparam broadcast $BROADCAST \
|
---|
| 176 | --stringparam domain $DOMAIN \
|
---|
| 177 | --stringparam nameserver1 $DNS1 \
|
---|
| 178 | --stringparam nameserver2 $DNS2 \
|
---|
| 179 | --output ./${PROGNAME}-commands/ \
|
---|
| 180 | $XSL \
|
---|
[7bd0866] | 181 | /tmp/lfs-full.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 182 |
|
---|
| 183 | rm /tmp/lfs-full.xml
|
---|
[fe30c61] | 184 | ;;
|
---|
[d68eb1b] | 185 | *) echo -n " ${L_arrow}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
---|
[fe30c61] | 186 | exit 1 ;;
|
---|
| 187 | esac
|
---|
| 188 |
|
---|
[b11c10b] | 189 | echo "done"
|
---|
[fe30c61] | 190 |
|
---|
| 191 | # Make the scripts executable.
|
---|
| 192 | chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
---|
| 193 |
|
---|
| 194 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 195 | create_package_list
|
---|
[d68eb1b] | 196 | create_chroot_scripts
|
---|
[fe30c61] | 197 |
|
---|
| 198 | # Done. Moving on...
|
---|
| 199 | get_sources
|
---|
| 200 |
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | #----------------------------#
|
---|
| 204 | create_package_list() { #
|
---|
| 205 | #----------------------------#
|
---|
| 206 |
|
---|
| 207 | # Create the packages file. We need it for proper Makefile creation
|
---|
| 208 | rm -f pkg_tarball_list
|
---|
[b11c10b] | 209 | echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
|
---|
| 210 | if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
---|
| 211 | echo -n "... "
|
---|
[fe30c61] | 212 | case ${PROGNAME} in
|
---|
[92b7cb8] | 213 | clfs*)
|
---|
[7bd0866] | 214 | xsltproc --nonet --xinclude \
|
---|
| 215 | -o pkg_tarball_list \
|
---|
| 216 | packages.xsl \
|
---|
[92b7cb8] | 217 | $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
|
---|
[fe30c61] | 218 | ;;
|
---|
| 219 | hlfs)
|
---|
[7bd0866] | 220 | xsltproc --nonet --xinclude \
|
---|
| 221 | --stringparam model $MODEL \
|
---|
[139c34e] | 222 | --stringparam kernel $KERNEL \
|
---|
[7bd0866] | 223 | --output pkg_tarball_list \
|
---|
| 224 | packages.xsl \
|
---|
[fe30c61] | 225 | $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 226 | ;;
|
---|
| 227 | lfs)
|
---|
[7bd0866] | 228 | xsltproc --nonet --xinclude \
|
---|
| 229 | --stringparam pkgmngt $PKGMNGT \
|
---|
| 230 | --stringparam revision $INITSYS \
|
---|
| 231 | --output pkg_tarball_list \
|
---|
| 232 | packages.xsl \
|
---|
[fe30c61] | 233 | $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
|
---|
| 234 | ;;
|
---|
[92b7cb8] | 235 | *)
|
---|
[fe30c61] | 236 | esac
|
---|
| 237 |
|
---|
[b11c10b] | 238 | echo "done"
|
---|
[fe30c61] | 239 |
|
---|
| 240 | }
|
---|
| 241 |
|
---|
[d68eb1b] | 242 | #----------------------------#
|
---|
| 243 | create_chroot_scripts() { #
|
---|
| 244 | #----------------------------#
|
---|
| 245 |
|
---|
| 246 | rm -rf chroot_scripts
|
---|
| 247 | echo -n "Creating chroot commands scripts from $BOOK"
|
---|
| 248 | if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
|
---|
| 249 | echo -n "... "
|
---|
| 250 | case ${PROGNAME} in
|
---|
| 251 | clfs*)
|
---|
| 252 | xsltproc --nonet --xinclude \
|
---|
| 253 | -o chroot-scripts/ chroot.xsl \
|
---|
| 254 | $BOOK/BOOK/${ARCH}-index.xml >> $LOGDIR/$LOG 2>&1
|
---|
| 255 | ;;
|
---|
| 256 | hlfs)
|
---|
| 257 | xsltproc --nonet --xinclude \
|
---|
| 258 | -o chroot-scripts/ chroot.xsl \
|
---|
| 259 | $BOOK/index.xml >> $LOGDIR/$LOG 2>&1
|
---|
| 260 | ;;
|
---|
| 261 | lfs)
|
---|
| 262 | xsltproc --nonet --xinclude \
|
---|
| 263 | -o chroot-scripts/ chroot.xsl \
|
---|
| 264 | $BOOK/chapter06/chapter06.xml >> $LOGDIR/$LOG 2>&1
|
---|
| 265 | ;;
|
---|
| 266 | *)
|
---|
| 267 | esac
|
---|
| 268 | echo "done"
|
---|
| 269 |
|
---|
| 270 | }
|
---|