Remove custom func extract_commands from master.sh..
This commit is contained in:
parent
c940100777
commit
7161bc9dcb
1 changed files with 0 additions and 156 deletions
156
CLFS/master.sh
156
CLFS/master.sh
|
@ -5,162 +5,6 @@
|
||||||
### FUNCTIONS ###
|
### FUNCTIONS ###
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
unset extract_commands
|
|
||||||
#----------------------------#
|
|
||||||
extract_commands() { #
|
|
||||||
#----------------------------#
|
|
||||||
|
|
||||||
#Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
|
|
||||||
test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
|
|
||||||
exit 1"
|
|
||||||
|
|
||||||
cd $JHALFSDIR
|
|
||||||
VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
|
|
||||||
|
|
||||||
# Start clean
|
|
||||||
if [ -d ${PROGNAME}-commands ]; then
|
|
||||||
rm -rf ${PROGNAME}-commands
|
|
||||||
else
|
|
||||||
mkdir -v ${PROGNAME}-commands
|
|
||||||
fi
|
|
||||||
echo "Extracting commands... ${BOLD}START${OFF}"
|
|
||||||
|
|
||||||
echo "${tab_}Extracting commands for ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
|
|
||||||
xsltproc --xinclude \
|
|
||||||
--nonet \
|
|
||||||
--output ./${PROGNAME}-commands/ \
|
|
||||||
$BOOK/stylesheets/dump-commands.xsl $BOOK/$ARCH-index.xml
|
|
||||||
|
|
||||||
# Grab the patches and package names.
|
|
||||||
cd $JHALFSDIR
|
|
||||||
|
|
||||||
echo "${tab_}Creating the packages and patches files" ;
|
|
||||||
for i in patches packages ; do rm -f $i ; done
|
|
||||||
|
|
||||||
grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
|
|
||||||
-e 's@">@"@' \
|
|
||||||
-e '/generic/d' >> packages
|
|
||||||
|
|
||||||
# Download the vim-lang package if it must be installed
|
|
||||||
if [ "$VIMLANG" = "1" ] ; then
|
|
||||||
echo `grep "vim" packages | sed 's@vim@&-lang@'` >> packages
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep "^<\!ENTITY" $BOOK/patches.ent | sed -e 's/.* "//' -e 's/">//' >> patches
|
|
||||||
# Needed for Groff patchlevel patch
|
|
||||||
GROFFLEVEL=`grep "groff-patchlevel" $BOOK/general.ent | sed -e 's/groff-patchlevel //' \
|
|
||||||
-e 's/"//g' \
|
|
||||||
-e 's@<!ENTITY @@' \
|
|
||||||
-e 's|>||'`
|
|
||||||
sed -i 's|&groff-patchlevel;|'$GROFFLEVEL'|' patches
|
|
||||||
|
|
||||||
|
|
||||||
# Preprocess the cmd scripts..
|
|
||||||
echo "${tab_}Preprocessing the cmd scripts"
|
|
||||||
#
|
|
||||||
local file this_script package vrs URLs
|
|
||||||
#
|
|
||||||
# Create a list of URLs..
|
|
||||||
echo "${tab_}${tab_}Writing a list of URLs to filelist_.wget "
|
|
||||||
xsltproc --nonet \
|
|
||||||
--xinclude \
|
|
||||||
-o filelist_.wget \
|
|
||||||
$BOOK/stylesheets/wget.xsl \
|
|
||||||
$BOOK/$ARCH-index.xml > /dev/null 2>&1
|
|
||||||
#
|
|
||||||
# Loop through all the command scripts
|
|
||||||
echo "${tab_}${tab_}Modifying the cmd scripts"
|
|
||||||
for file in `ls ${PROGNAME}-commands/*/*`;do
|
|
||||||
#
|
|
||||||
# 1. Compress the script file (remove blank lines)
|
|
||||||
# 2. Add a variable header and a footer to selected scripts
|
|
||||||
this_script=`basename $file`
|
|
||||||
#
|
|
||||||
# DO NOT play with the chroot scripts.. they are used as is later
|
|
||||||
[[ `_IS_ $this_script "chroot"` ]] && continue
|
|
||||||
#
|
|
||||||
# Strip leading index number and misc test.. This is a miserable method
|
|
||||||
package=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
|
||||||
-e 's@-static@@' \
|
|
||||||
-e 's@-final@@' \
|
|
||||||
-e 's@temp-@@' \
|
|
||||||
-e 's@-64bit@@' \
|
|
||||||
-e 's@-64@@' \
|
|
||||||
-e 's@64@@' \
|
|
||||||
-e 's@-n32@@' \
|
|
||||||
-e 's@-build@@' \
|
|
||||||
-e 's@glibc-headers@glibc@'`
|
|
||||||
#
|
|
||||||
# Find the package version of the command files
|
|
||||||
#
|
|
||||||
# A little package name manipulation
|
|
||||||
case $package in
|
|
||||||
bootscripts) package="lfs-bootscripts" ;;
|
|
||||||
kernel) package="linux" ;;
|
|
||||||
esac
|
|
||||||
vrs=`grep "^$package-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
|
||||||
#
|
|
||||||
# If $vrs isn't empty, we've got a package...
|
|
||||||
# NOTE: The included \n causes the separator to be written
|
|
||||||
# on the next line. This is for cosmetic purposes only...
|
|
||||||
#
|
|
||||||
# Set the appropriate 'sha-bang'.. depending of the phase..
|
|
||||||
case $package in
|
|
||||||
*introduction* | \
|
|
||||||
*changingowner* | \
|
|
||||||
*creatingdirs* | \
|
|
||||||
*createfiles* ) sha_bang=''
|
|
||||||
;;
|
|
||||||
*) sha_bang='#!/bin/bash'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
#
|
|
||||||
#
|
|
||||||
if [ "$vrs" != "" ] ; then
|
|
||||||
HEADER_STR="cd \$PKGDIR${nl_}#------------------"
|
|
||||||
FOOTER_STR="#------------------${nl_}exit"
|
|
||||||
else
|
|
||||||
HEADER_STR="#------------------"
|
|
||||||
FOOTER_STR="#------------------${nl_}exit"
|
|
||||||
fi
|
|
||||||
PKG_URL=`grep -e "$package-$vrs.*tar." $JHALFSDIR/filelist_.wget` && true
|
|
||||||
PATCHES=`grep "$package-$vrs.*patch" $JHALFSDIR/filelist_.wget` && true
|
|
||||||
#
|
|
||||||
# There would be no URL for a cmd only script, reset package name
|
|
||||||
if [[ $PKG_URL = "" ]]; then
|
|
||||||
package=""
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
${sha_bang}
|
|
||||||
set -e
|
|
||||||
|
|
||||||
#####################################
|
|
||||||
NAME=${this_script}
|
|
||||||
PACKAGE=${package}
|
|
||||||
VERSION=${vrs}
|
|
||||||
PKG_URL=( ${PKG_URL} )
|
|
||||||
PATCHES=( ${PATCHES} )
|
|
||||||
#####################################
|
|
||||||
|
|
||||||
${HEADER_STR}
|
|
||||||
`grep '.' ${file}`
|
|
||||||
${FOOTER_STR}
|
|
||||||
EOF
|
|
||||||
) > tmp.script
|
|
||||||
mv tmp.script ${file}
|
|
||||||
|
|
||||||
done # for file in `ls $PROGNAME-commands/*/*`
|
|
||||||
#
|
|
||||||
# Make the scripts executable.
|
|
||||||
chmod -R +x $JHALFSDIR/${PROGNAME}-commands
|
|
||||||
|
|
||||||
# Done. Moving on...
|
|
||||||
echo "Extracting commands... ${BOLD}DONE${OFF}"
|
|
||||||
get_sources
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
|
|
Reference in a new issue