Changeset 1ad9211 for master.sh


Ignore:
Timestamp:
08/26/2006 10:48:19 AM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
3c96826
Parents:
ce6e009
Message:

Removed cmdline support and config files.
Several envar settings could be moved from master.sh to Config.in to keep it centralized.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • master.sh

    rce6e009 r1ad9211  
    4040fi
    4141
    42      PROGNAME=$(basename $0)
    43    COMMON_DIR="common"
    44   PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z])
    45        MODULE=$PACKAGE_DIR/master.sh
    46 MODULE_CONFIG=$PACKAGE_DIR/config
    47     VERBOSITY=0
    48 
    49 
    50 if [[ -e using_menuconfig ]]; then
    51   [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
    52   source configuration
    53   [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
    54   [[ $VERBOSITY > 0 ]] && echo "OK"
    55 
    56         #--- CONSTANTS
    57   declare -r SVN="svn://svn.linuxfromscratch.org"
    58   declare -r LOG=000-masterscript.log
    59         # --- Server used if the file isn't found in SRC_ARCHIVE.
    60         # As a last resort, the file will dowloaded from upstream, if possible.
    61        SERVER=ftp://ftp.lfs-matrix.net
    62         #--- Working directories
    63   SCRIPT_ROOT=jhalfs
    64     JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
    65        LOGDIR=$JHALFSDIR/logs
    66    TESTLOGDIR=$JHALFSDIR/test-logs
    67        MKFILE=$JHALFSDIR/Makefile
    68         #--- ICA report log directory
    69     ICALOGDIR=$LOGDIR/ICA
    70         #--- farce report log directory
    71   FARCELOGDIR=$LOGDIR/farce
    72           XSL=$PROGNAME.xsl
    73       PKG_LST=unpacked
    74 
    75   case $PROGNAME in
    76     clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
    77         *) LFSVRS=development; TREE=trunk/BOOK             ;;
    78   esac
    79 
    80   if [[ ! -z ${BRANCH_ID} ]]; then
    81     case $BRANCH_ID in
    82      dev* | SVN | trunk )
     42    PROGNAME=$(basename $0)
     43  COMMON_DIR="common"
     44PACKAGE_DIR=$(echo $PROGNAME | tr [a-z] [A-Z])
     45      MODULE=$PACKAGE_DIR/master.sh
     46   VERBOSITY=1
     47
     48
     49[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
     50source configuration
     51[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
     52[[ $VERBOSITY > 0 ]] && echo "OK"
     53
     54      #--- CONSTANTS
     55declare -r SVN="svn://svn.linuxfromscratch.org"
     56declare -r LOG=000-masterscript.log
     57      # --- Server used if the file isn't found in SRC_ARCHIVE.
     58      # As a last resort, the file will dowloaded from upstream, if possible.
     59     SERVER=ftp://ftp.lfs-matrix.net
     60      #--- Working directories
     61SCRIPT_ROOT=jhalfs
     62  JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
     63     LOGDIR=$JHALFSDIR/logs
     64 TESTLOGDIR=$JHALFSDIR/test-logs
     65     MKFILE=$JHALFSDIR/Makefile
     66      #--- ICA report log directory
     67  ICALOGDIR=$LOGDIR/ICA
     68      #--- farce report log directory
     69FARCELOGDIR=$LOGDIR/farce
     70        XSL=$PROGNAME.xsl
     71    PKG_LST=unpacked
     72
     73case $PROGNAME in
     74  clfs2) LFSVRS=development; TREE=branches/clfs-2.0/BOOK ;;
     75      *) LFSVRS=development; TREE=trunk/BOOK             ;;
     76esac
     77
     78if [[ ! -z ${BRANCH_ID} ]]; then
     79  case $BRANCH_ID in
     80    dev* | SVN | trunk )
    8381      case $PROGNAME in
    8482        clfs2 ) TREE=branches/clfs-2.0/BOOK ;;
     
    8886      ;;
    8987    branch-* )
    90        LFSVRS=${BRANCH_ID}
    91        TREE=branches/${BRANCH_ID#branch-}/BOOK
     88      LFSVRS=${BRANCH_ID}
     89      TREE=branches/${BRANCH_ID#branch-}/BOOK
    9290      ;;
    9391    * )
    9492      case $PROGNAME in
    9593        lfs | hlfs )
    96            LFSVRS=${BRANCH_ID}
     94          LFSVRS=${BRANCH_ID}
    9795          TREE=tags/${BRANCH_ID}/BOOK
    98          ;;
     96          ;;
    9997        clfs | clfs2 )
    100            LFSVRS=${BRANCH_ID}
    101            TREE=tags/${BRANCH_ID}
    102          ;;
     98          LFSVRS=${BRANCH_ID}
     99          TREE=tags/${BRANCH_ID}
     100          ;;
    103101      esac
    104102      ;;
    105     esac
    106   fi
    107   # These are boolean vars generated from Config.in.
    108   # ISSUE: If a boolean parameter is not set <true> that
    109   # variable is not defined by the menu app. This can
    110   # cause a headache if you are not careful.
    111   #  The following parameters MUST be created and have a
    112   #  default value.
    113   RUNMAKE=${RUNMAKE:-n}
    114   GETPKG=${GETPKG:-n}
    115   GETKERNEL=${GETKERNEL:-n}
    116   COMPARE=${COMPARE:-n}
    117   RUN_FARCE=${RUN_FARCE:-n}
    118   RUN_ICA=${RUN_ICA:-n}
    119   BOMB_TEST=${BOMB_TEST:-n}
    120   STRIP=${STRIP:=n}
    121   REPORT=${REPORT:=n}
    122   VIMLANG=${VIMLANG:-n}
    123   KEYMAP=${KEYMAP:=none}
    124   GRSECURITY_HOST=${GRSECURITY_HOST:-n}
    125 
    126 else
    127   #
    128   [[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
    129   source $COMMON_DIR/config
    130   [[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
    131   [[ $VERBOSITY > 0 ]] && echo "OK"
    132   #
    133   [[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
    134   source $MODULE_CONFIG
    135   [[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
    136   [[ $VERBOSITY > 0 ]] && echo "OK"
    137   #
    138 fi
     103  esac
     104fi
     105# These are boolean vars generated from Config.in.
     106# ISSUE: If a boolean parameter is not set <true> that
     107# variable is not defined by the menu app. This can
     108# cause a headache if you are not careful.
     109#  The following parameters MUST be created and have a
     110#  default value.
     111RUNMAKE=${RUNMAKE:-n}
     112GETPKG=${GETPKG:-n}
     113GETKERNEL=${GETKERNEL:-n}
     114COMPARE=${COMPARE:-n}
     115RUN_FARCE=${RUN_FARCE:-n}
     116RUN_ICA=${RUN_ICA:-n}
     117BOMB_TEST=${BOMB_TEST:-n}
     118STRIP=${STRIP:=n}
     119REPORT=${REPORT:=n}
     120VIMLANG=${VIMLANG:-n}
     121KEYMAP=${KEYMAP:=none}
     122GRSECURITY_HOST=${GRSECURITY_HOST:-n}
    139123
    140124
     
    155139# to a working doc.. set WC=1, else 'null'
    156140#===========================================================
    157 WC=${BOOK:+1}
     141WC=${BOOK:+y}
    158142#===========================================================
     143
     144#===================================================
     145# Set the document location...
     146#===================================================
     147BOOK=${BOOK:=$PROGNAME-$LFSVRS}
     148#===================================================
    159149
    160150
     
    175165###          MAIN               ###
    176166###################################
    177 
    178 # Evaluate any command line switches
    179 
    180 while test $# -gt 0 ; do
    181   case $1 in
    182   # Common options for {C,H}LFS books
    183     --book | -B )
    184       test $# = 1 && eval "$exit_missing_arg"
    185       shift
    186       case $1 in
    187         dev* | SVN | trunk )
    188           LFSVRS=development
    189           TREE=trunk/BOOK
    190           ;;
    191         branch-* )
    192           LFSVRS=$1
    193           TREE=branches/${1#branch-}/BOOK
    194           ;;
    195         * )
    196           case $PROGNAME in
    197             lfs | hlfs )
    198               LFSVRS=$1
    199               TREE=tags/$1/BOOK
    200               ;;
    201             clfs )
    202               LFSVRS=$1
    203               TREE=tags/$1
    204               ;;
    205           esac
    206           ;;
    207       esac
    208       ;;
    209 
    210     --directory | -D )
    211       test $# = 1 && eval "$exit_missing_arg"
    212       shift
    213       case $1 in
    214         -* )
    215           echo -e "\n$1 isn't a valid build directory."
    216           echo -e "Directory names can't start with - .\n"
    217           exit 1
    218           ;;
    219         * )
    220           BUILDDIR=$1
    221           JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
    222           LOGDIR=$JHALFSDIR/logs
    223           TESTLOGDIR=$JHALFSDIR/test-logs
    224           MKFILE=$JHALFSDIR/Makefile
    225           ;;
    226       esac
    227       ;;
    228 
    229     --get-packages | -G )      GETPKG=y    ;;
    230 
    231     --help | -h )  usage | more && exit  ;;
    232 
    233     --optimize | -O )
    234       test $# = 1 && eval "$exit_missing_arg"
    235       shift
    236       case $1 in
    237         0 | 1 | 2 )
    238           OPTIMIZE=$1
    239           ;;
    240         * )
    241           echo -e "\n$1 isn't a valid optimize level value."
    242           echo -e "You must use 0, 1, or 2.\n"
    243           exit 1
    244           ;;
    245       esac
    246       ;;
    247 
    248     --testsuites | -T )
    249       test $# = 1 && eval "$exit_missing_arg"
    250       shift
    251       case $1 in
    252         0 | 1 | 2 | 3 )
    253           TEST=$1
    254           ;;
    255         * )
    256           echo -e "\n$1 isn't a valid testsuites level value."
    257           echo -e "You must to use 0, 1, 2, or 3.\n"
    258           exit 1
    259           ;;
    260       esac
    261       ;;
    262 
    263     --version | -V )
    264         echo "$version"
    265         exit 0
    266       ;;
    267 
    268     --working-copy | -W )
    269       test $# = 1 && eval "$exit_missing_arg"
    270       shift
    271       case $PROGNAME in # Poor checks. We should find better ones.
    272         lfs)
    273           if [ -d $1/chapter09 ] ; then
    274             WC=1
    275             BOOK=$1
    276           else
    277             echo -e "\nLooks like $1 isn't an LFS working copy."
    278             exit 1
    279           fi
    280           ;;
    281         clfs)
    282           if [ -d $1/cross-tools ] ; then
    283             WC=1
    284             BOOK=$1
    285           else
    286             echo -e "\nLooks like $1 isn't a CLFS working copy."
    287             exit 1
    288           fi
    289           ;;
    290         hlfs)
    291           if [ -f $1/template.xml ] ; then
    292             WC=1
    293             BOOK=$1
    294           else
    295             echo -e "\nLooks like $1 isn't an HLFS working copy."
    296             exit 1
    297           fi
    298           ;;
    299       esac
    300       ;;
    301 
    302     --comparison | -C )
    303       test $# = 1 && eval "$exit_missing_arg"
    304       shift
    305       case $1 in
    306         ICA)    RUN_ICA=y; RUN_FARCE=n; COMPARE=y  ;;
    307         farce)  RUN_ICA=n; RUN_FARCE=y; COMPARE=y  ;;
    308         both)   RUN_ICA=y; RUN_FARCE=y; COMPARE=y  ;;
    309         *)
    310           echo -e "\n$1 is an unknown analysis method."
    311           exit 1
    312           ;;
    313       esac
    314       ;;
    315 
    316     --fstab | -F )
    317       test $# = 1 && eval "$exit_missing_arg"
    318       shift
    319       if [ -f $1 ] ; then
    320         FSTAB=$1
    321       else
    322         echo -e "\nFile $1 not found. Verify your command line.\n"
    323         exit 1
    324       fi
    325       ;;
    326 
    327     --kernel-config | -K )
    328       test $# = 1 && eval "$exit_missing_arg"
    329       shift
    330       if [ -f $1 ] ; then
    331         CONFIG=$1
    332       else
    333         echo -e "\nFile $1 not found. Verify your command line.\n"
    334         exit 1
    335       fi
    336       ;;
    337 
    338     --run-make | -M )      RUNMAKE=y ;;
    339 
    340     --rebuild | -R )       CLEAN=y   ;;
    341 
    342     # CLFS options
    343     --arch | -A )
    344       test $# = 1 && eval "$exit_missing_arg"
    345       shift
    346       case $PROGNAME in
    347         CLFS2)
    348           case $1 in
    349             arm) ARCH=arm; TARGET="arm-unknown-linux-gnu" ;;
    350             x86) ARCH=x86; TARGET="i686-pc-linux-gnu"     ;;
    351               *) echo -e "\n$1 is an unknown or unsupported arch.";  exit 1
    352           esac
    353           ;;
    354         CLFS)
    355           case $1 in
    356             arm )   ARCH=arm;   TARGET="arm-unknown-linux-gnu" ;;
    357             x86 )   ARCH=x86;   TARGET="i686-pc-linux-gnu"     ;;
    358            i486 )   ARCH=x86;   TARGET="i486-pc-linux-gnu"     ;;
    359            i586 )   ARCH=x86;   TARGET="i586-pc-linux-gnu"     ;;
    360             ppc )   ARCH=ppc;   TARGET="powerpc-unknown-linux-gnu"   ;;
    361            mips )   ARCH=mips;  TARGET="mips-unknown-linux-gnu"      ;;
    362            mipsel ) ARCH=mips;  TARGET="mipsel-unknown-linux-gnu"    ;;
    363             sparc ) ARCH=sparc; TARGET="sparcv9-unknown-linux-gnu"   ;;
    364 
    365            x86_64-64 )   ARCH=x86_64-64;  TARGET="x86_64-unknown-linux-gnu"   ;;
    366            mips64-64 )   ARCH=mips64-64;  TARGET="mips-unknown-linux-gnu"     ;;
    367            mipsel64-64 ) ARCH=mips64-64;  TARGET="mipsel-unknown-linux-gnu" ;;
    368            sparc64-64 )  ARCH=sparc64-64; TARGET="sparc64-unknown-linux-gnu" ;;
    369            alpha )       ARCH=alpha;      TARGET="alpha-unknown-linux-gnu"   ;;
    370 
    371            x86_64 )   ARCH=x86_64;  TARGET="x86_64-unknown-linux-gnu";    TARGET32="i686-pc-linux-gnu"        ;;
    372            mips64 )   ARCH=mips64;  TARGET="mips-unknown-linux-gnu";      TARGET32="mips-unknown-linux-gnu"   ;;
    373            mipsel64 ) ARCH=mips64;  TARGET="mipsel-unknown-linux-gnu";    TARGET32="mipsel-unknown-linux-gnu"  ;;
    374            sparc64 )  ARCH=sparc64; TARGET="sparc64-unknown-linux-gnu";   TARGET32="sparcv9-unknown-linux-gnu"  ;;
    375             ppc64 )   ARCH=ppc64;   TARGET="powerpc64-unknown-linux-gnu"; TARGET32="powerpc-unknown-linux-gnu"  ;;
    376 
    377             * )  echo -e "\n$1 is an unknown or unsupported arch.";   exit 1  ;;
    378           esac
    379           ;;
    380       esac
    381       ;;
    382 
    383     --boot-config )
    384       test $# = 1 && eval "$exit_missing_arg"
    385       shift
    386       if [ -f $1 ] ; then
    387         BOOT_CONFIG=$1
    388       else
    389         echo -e "\nFile $1 not found. Verify your command line.\n"
    390         exit 1
    391       fi
    392       ;;
    393 
    394     --method )
    395       test $# = 1 && eval "$exit_missing_arg"
    396       shift
    397       case $1 in
    398         chroot | boot )
    399           METHOD=$1
    400           ;;
    401         * )
    402           echo -e "\n$1 isn't a valid build method."
    403           exit 1
    404           ;;
    405       esac
    406       ;;
    407 
    408     # HLFS options
    409     --model )
    410       test $# = 1 && eval "$exit_missing_arg"
    411       shift
    412       case $1 in
    413         glibc | uclibc )
    414           MODEL=$1
    415           ;;
    416         * )
    417           echo -e "\n$1 isn't a valid libc model."
    418           exit 1
    419           ;;
    420       esac
    421       ;;
    422 
    423     # Unknown options
    424     * )   usage   ;;
    425   esac
    426   shift
    427 done
    428 
    429 
    430 #===================================================
    431 # Set the document location...
    432 # BOOK is either defined in
    433 #   xxx.config
    434 #   comand line
    435 #   default
    436 # If set by conf file or cmd line leave it
    437 # alone otherwise load the default version
    438 #===================================================
    439 BOOK=${BOOK:=$PROGNAME-$LFSVRS}
    440 #===================================================
    441 
    442167
    443168# Check for minimum bash,tar,gcc and kernel versions
     
    512237[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
    513238#
    514 if [[ "$PWD" != "$JHALFSDIR" ]]; then
    515   cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
    516   #
    517   [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
    518   #
    519   if [[ "$COMPARE" = "y" ]]; then
    520     mkdir -p $JHALFSDIR/extras
    521     cp extras/* $JHALFSDIR/extras
    522   fi
    523   #
    524   if [[ -n "$FILES" ]]; then
    525     # pushd/popd necessary to deal with multiple files
    526     pushd $PACKAGE_DIR 1> /dev/null
    527       cp $FILES $JHALFSDIR/
    528     popd 1> /dev/null
    529   fi
    530   #
    531   if [[ "$REPORT" = "y" ]]; then
    532     cp $COMMON_DIR/create-sbu_du-report.sh  $JHALFSDIR/
    533     # After being sure that all looks sane, dump the settings to a file
    534     # This file will be used to create the REPORT header
    535     validate_config > $JHALFSDIR/jhalfs.config
    536   fi
    537   #
    538   [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl  $JHALFSDIR/
    539   #
    540   cp $COMMON_DIR/packages.xsl  $JHALFSDIR/
    541   #
    542   sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
    543   export XSL=$JHALFSDIR/${XSL}
    544 fi
     239cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
     240#
     241[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
     242#
     243if [[ "$COMPARE" = "y" ]]; then
     244  mkdir -p $JHALFSDIR/extras
     245  cp extras/* $JHALFSDIR/extras
     246fi
     247#
     248if [[ -n "$FILES" ]]; then
     249  # pushd/popd necessary to deal with multiple files
     250  pushd $PACKAGE_DIR 1> /dev/null
     251    cp $FILES $JHALFSDIR/
     252  popd 1> /dev/null
     253fi
     254#
     255if [[ "$REPORT" = "y" ]]; then
     256  cp $COMMON_DIR/create-sbu_du-report.sh  $JHALFSDIR/
     257  # After being sure that all looks sane, dump the settings to a file
     258  # This file will be used to create the REPORT header
     259  validate_config > $JHALFSDIR/jhalfs.config
     260fi
     261#
     262[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl  $JHALFSDIR/
     263#
     264cp $COMMON_DIR/packages.xsl  $JHALFSDIR/
     265#
     266sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
     267export XSL=$JHALFSDIR/${XSL}
    545268
    546269get_book
Note: See TracChangeset for help on using the changeset viewer.