From: hackbard Date: Sat, 24 Jul 2004 15:06:17 +0000 (+0000) Subject: improved Helper, Create-Binary and hdw-get script X-Git-Url: https://www.hackdaworld.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=2b6dfb448cf086bb899f505626c9e114e4971bd2;p=hdw-linux%2Fhdw-linux.git improved Helper, Create-Binary and hdw-get script --- diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 3fbf33b..63b4540 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,5 +1,6 @@ *) 2004-07-24 +- improved Helper, Create-Binary and hdw-get script - fixed wine, flite (define const patch needed for flite) - implemented create-cvs-list function to Helper script - updated BUILD file diff --git a/misc/hdw-tools/hdw-get b/misc/hdw-tools/hdw-get index 8be36e2..5cb2e40 100644 --- a/misc/hdw-tools/hdw-get +++ b/misc/hdw-tools/hdw-get @@ -8,10 +8,13 @@ usage() { echo - echo "usage: $0 [install/remove] [directory] [package]" + echo "usage:" + echo "$0 [install/remove] [root] [package]" + echo "$0 [dist-install] [root] [dist file]" echo } package="" ; inst_root="" +d_install="" ; install="" verbose="" while [ "$1" ] ; do @@ -20,6 +23,8 @@ while [ "$1" ] ; do inst_root="$2" ; package="$3" ; shift 3 ;; remove) remove="1" inst_root="$2" ; package="$3" ; shift 3 ;; + dist-install) d_install="1" + inst_root="$2" ; dist_file="$3" ; shift 3 ;; -v) verbose=1 ; shift 1 ;; *) usage ; exit 1 ;; esac @@ -30,7 +35,7 @@ if [ -z "inst_root" -o -z "$package" ] ; then fi # read hdw-get configs -net_addr="" ; bin_dir="" +net_addr="" ; bin_dir="" ; distf_dir="" if [ -f /etc/hdw-get.conf ] ; then . /etc/hdw-get.conf if [ -z "$hdw_version" -o -z "$hdw_arch" -o -z "$hdw_arch_opt" ] ; then @@ -45,11 +50,14 @@ else exit 1 fi +# create temp directory +mkdir -p /tmp/.hdw-get + # remove if [ "$remove" = "1" ] ; then # looking for flist file fl_pris="" - for fl_file in $inst_root/var/adm/flists/$package-*; do + for fl_file in $inst_root/var/adm/flists/$package-[0-9]*; do fl_pris="`echo $fl_file | awk -F- '{ print $NF }'` $fl_pris" done fl_max="0" @@ -66,6 +74,22 @@ if [ "$remove" = "1" ] ; then echo "package $apckage is not installed (moved the flist file?)" exit 1 fi + + # care about info/dir file + rm -f /tmp/.hdw-get/dir* ; modify_info_dir="" + if [ -n "`grep usr/share/info/dir $fl_file`" ] ; then + modify_info_dir="1" + cp $inst_root/usr/share/info/dir /tmp/.hdw-get/ + for info_obj in `grep 'usr/share/info/.*.info' $fl_file | \ + awk -F/ '{ print $4 }'`; do + info_o=`echo $info_obj | sed 's/.info//'` + [ "$verbose" ] && echo "deleting $info_o from info/dir" + grep -v \($info_o\)\. /tmp/.hdw-get/dir > /tmp/.hdw-get/dir~ + mv /tmp/.hdw-get/dir~ /tmp/.hdw-get/dir + done + fi + + # remove the files/dirs ((supposed = 0)) ((counter = 0)) cat $fl_file | while read pkg file; do @@ -85,6 +109,13 @@ if [ "$remove" = "1" ] ; then done echo -en "\ndone.\n" + # reinstall info/dir file + if [ "$modify_info_dir" ] ; then + [ "$verbose" ] && echo "restoring modified info/dir file" + cp /tmp/.hdw-get/dir $inst_root/usr/share/info/dir + rm -f /tmp/.hdw-get/dir* + fi + # install elif [ "$install" = "1" ] ; then # does inst_root exist @@ -94,25 +125,75 @@ elif [ "$install" = "1" ] ; then echo exit 1 fi - # does the package exist + + # store info/dir file + rm -f /tmp/.hdw-get/dir* + if [ -f $inst_root/usr/share/info/dir ] ; then + [ "$verbose" ] && echo "backing up info/dir file" + cp $inst_root/usr/share/info/dir /tmp/.hdw-get/ + fi + + # check/install package if [ -f $package ] ; then echo "extracting `basename $package` to $inst_root ..." tar --use-compress-program=bzip2 -xf $package \ -C $inst_root echo "done" - elif [ ! -z "$bin_dir" -a -f $bin_dir/$package/$package.tar.bz2 ] ; then + elif [ ! -z "$bin_dir" -a -f $bin_dir/${hdw_arch}-${hdw_arch_opt}/$package/$package.tar.bz2 ] ; then echo "extracting $package to $inst_root ..." tar --use-compress-program=bzip2 \ -xf $bin_dir/$package/$package.tar.bz2 -C $inst_root elif [ ! -z "$net_addr" ] ; then #echo "trying to get package $package via net ..." - wget $net_addr/hdw-linux/hdw-linux-$hdw_version/binaries/${hdw_arch}-${hdw_arch_opt}/$package/${package}.tar.bz2 && - tar --use-compress-program=bzip2 \ - -xf ${package}.tar.bz2 -C $inst_root - rm ${package}.tar.bz2 - echo "done" + wget $net_addr/hdw-linux/hdw-linux-$hdw_version/binaries/${hdw_arch}-${hdw_arch_opt}/$package/${package}.tar.bz2 > /dev/null 2>&1 + if [ "$?" ] ; then + echo "package not found at $net_addr, aborting ..." + else + + tar --use-compress-program=bzip2 \ + -xf ${package}.tar.bz2 -C $inst_root + rm ${package}.tar.bz2 + echo "done" + fi else echo "sorry, package $package not found" fi + + # merging info/dir file + fl_file=`ls -A $inst_root/var/adm/flists/$package-[0-9]* | tail -1` + if [ -n "`grep usr/share/info/dir $fl_file`" ] ; then + echo "" >> /tmp/.hdw-get/dir + echo "$package info - added by hdw `date`" >> /tmp/.hdw-get/dir + for info_obj in `grep 'usr/share/info/.*.info' $fl_file | \ + awk -F/ '{ print $4 }'`; do + info_o=`echo $info_obj | sed 's/.info//'` + if [ -z "`grep \($info_o\)\. /tmp/.hdw-get/dir`" ] + then + [ "$verbose" ] && \ + echo "merging $info_o to info/dir" + grep \($info_o\)\. \ + $inst_root/usr/share/info/dir >> \ + /tmp/.hdw-get/dir + fi + done + fi + cp /tmp/.hdw-get/dir $inst_root/usr/share/info/dir + rm -f /tmp/.hdw-get/dir + +# dist-install +elif [ "$dist_install" = "1" ] ; then + # check dist file + if [ ! -f $dist_file ] ; then + echo "$dist_file not found, aborting" + else + # install all distribution related packages + for package in `cat $dist_file`; do + # execute myelf + $0 install $inst_root $package + done + fi fi +# remove temp directory +rm -rf /tmp/.hdw-get + diff --git a/scripts/Create-Binary b/scripts/Create-Binary index 14f9d45..2272327 100755 --- a/scripts/Create-Binary +++ b/scripts/Create-Binary @@ -59,12 +59,8 @@ else echo "creating binary tarball of $package" mkdir -p $hdw_home_dir/binaries/$bin_dir/$package && cd $hdw_build_dir && - # which files do we need? - are we packaging linux? - if [ "$package" = "linux" ] ; then - fl_file="var/adm/flists/$package*" - else - fl_file="var/adm/flists/$package" - fi + # which files do we need? + fl_file="var/adm/flists/$package" cat $fl_file | awk '{ print $2 }' | \ tar --no-recursion --use-compress-program=bzip2 \ -cf $hdw_home_dir/binaries/$bin_dir/$package/$tar_name.tar.bz2 \ @@ -78,14 +74,16 @@ fi elif [ "$package" = "all" ] ; then -((counter=1)) -for pkg in `ls -A $hdw_build_dir/var/adm/flists | grep -v '.stage1'`; do - ./scripts/Create-Binary -package $pkg -root $hdw_build_dir +((counter=0)) +for pkg in `ls -A $hdw_build_dir/var/adm/flists | grep -v '.stage'`; do + tar_name=`echo $pkg | awk -F- '{ print $1 }'` + ./scripts/Create-Binary -package $pkg -root $hdw_build_dir \ + -tar_name $tar_name ((counter+=1)) done # add 00-dirtree, build in stage1 -./scripts/Create-Binary -package 00-dirtree.stage1 -tar-name 00-dirtree +./scripts/Create-Binary -package 00-dirtree.stage0-0 -tar-name 00-dirtree ((counter+=1)) echo "created $counter binaries, done" diff --git a/scripts/Helper b/scripts/Helper index d2c8ea1..90d9bdf 100755 --- a/scripts/Helper +++ b/scripts/Helper @@ -13,15 +13,18 @@ # - create new priorities according to dependencies ccl=0 +cdf=0 while [ "$1" ] ; do case "$1" in -create_cvs_list) ccl=1; shift 1 ;; + -create_dist_files) cdf=1; shift 1 ;; *) echo echo "usage:" echo echo "$0 -create_cvs_list" + echo "$0 -create_dist_files" echo exit 1 ;; esac @@ -40,3 +43,18 @@ if [ "$ccl" = "1" ] ; then done done fi + +if [ "$cdf" = "1" ] ; then + max=`grep '^max=' ./scripts/Build-Distro | awk -F= '{ print $2 }'` + mkdir -p ./distro + . ./Config + echo -en "creating dist file ./distro/$hdw_target ..." + . ./scripts/subroutines + echo "00-dirtree" > ./distro/$hdw_target + create_buildorder '2 3 4' $max > ./distro/$hdw_target.~ + grep -v '^#' ./distro/$hdw_target.~ | awk '{ print $4 }' >> \ + ./distro/$hdw_target + rm ./distro/$hdw_target.~ + echo -en " done\n" +fi +