From 659aa3972e4ba06526fd4390168cf747fa943a68 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sat, 31 Jul 2004 11:20:59 +0000 Subject: [PATCH] last 0.3 fixes --- Config | 4 +- doc/CHANGELOG | 11 ++ doc/FAI | 19 ++++ doc/INSTALL | 2 +- doc/README | 91 +++++++-------- misc/hdw-tools/hdw-get | 246 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 318 insertions(+), 55 deletions(-) create mode 100644 misc/hdw-tools/hdw-get diff --git a/Config b/Config index c548bed..261c813 100644 --- a/Config +++ b/Config @@ -7,7 +7,7 @@ # start -export hdw_version="cvs" # version of hdw-linux +export hdw_version="0.3" # version of hdw-linux export hdw_target="default" # which target to build # currently: @@ -28,7 +28,7 @@ export hdw_arch="ia32" # which architecture to build for # sparc64 - 64bit sparc # ppc - powerpc's -export hdw_arch_opt="" # choose optimization +export hdw_arch_opt="i686" # choose optimization # currently: ia32 : i[3-6]86 # sparc64 : sparc_v9 # sparc : sparc_v[7-8] diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 84d9ebf..22676bb 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,3 +1,14 @@ +*) 2004-07-31 + +## last 0.3 fixes ## + +- updated doc/README +- default optimization i686 +- Config -> version 0.3 +- final hdw-get fixes / changed modes -> 750 +- adapted INSTALL file +- small updates to FAI file + *) 2004-07-28 - turned to cvs development version again diff --git a/doc/FAI b/doc/FAI index 9a36c49..9f65bcf 100644 --- a/doc/FAI +++ b/doc/FAI @@ -14,3 +14,22 @@ files: ./doc/FAI [not finished yet] + +procedure +--------- + + 1) install mnimal nfsroot binaries + (as described in INSTALL chapter 2.) + + vi Config [enter default as a target, specify arch*] + + note: default target is enough. you dont need to specify fai-server. + we are just going to install the nfsroot which will automate + the install process. fai-server is actually the target you will + need as a running system to have pxeboot/nfsutils and stuff. + + ./scripts/Helper -create_dist_files + ./misc/hdw-tools/hdw-get dist-install /mnt/fai-root \ + ./distro/default + + [to be continued] diff --git a/doc/INSTALL b/doc/INSTALL index 082aad6..c8c30d2 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -86,7 +86,7 @@ in the ./misc/hdw-tools directory. EOF ./scripts/Helper -create_dist_file - . misc/hdw-tools/hdw-get dist-install /mnt/hdw-target \ + ./misc/hdw-tools/hdw-get dist-install /mnt/hdw-target \ ./distro/ you may edit the distribution file, hdw-get should actually warn you diff --git a/doc/README b/doc/README index 31b487a..77a1fec 100644 --- a/doc/README +++ b/doc/README @@ -1,71 +1,58 @@ - -Welcome to hdw - linux +welcome to hdw - linux ---------------------- -HDW - Linux is not just another Linux distribution, it is a Distribution -Building Tool, made of some powerfull scripts that make the whole -download, build and install procedures very simple... even for newbies. -Base packages are specially focused on networking, security and development -which is really convinient for intermidiate / advanced users, but without -forgetting about packages like XFree86, games, multimedia and office, so -it's a distribution for Users and Administrators :) - -Files in doc/ directory. ------------------------- - -README - explains some general things and how to obtain the sources +hdw-linux is mainly a collection of shell scripts automating the process of +building a linux distribution from scratch. after setting up an appropriate +toolchain a minimal bases system is build. in case of not crosscompiling target +specific software is rebuild by doing a chroot to the prepared base system. + +additionaly the scripts may help building packages on your working system. file +and dependency lists are generated after each build. this allows easy and clean +removement of installed software also caring for dependencies. the tool used for +that is called hdw-get which aims to be a simple packet manager of the hdw +distributions. + +the intention is to get a scaleable build system and to provide a toolkit +especially for developing on embedded/foreign - architecture systems. to put it +in a nutshell, hdw is a 'build from scratch' distribution. as i started my linux +experiences trying to automate lfs running aross rocklinux (one of the best +dsitro and 'hacker/s' i ever met) be prepared to hit a mixture of the lfs build +methods and a rock-like script structure (though not far as advanced as +rocklinux). + +files in doc/ directory +----------------------- + +README - this file BUILD - instructions how to build hdw-linux (you want to read this!) +INSTALL - instructions how to install hdw-linux (read this one too!) TODO - developer's todo list CHANGELOG - changes made to the hdw-linux tree Developers - file keeping all the hdw-linux developers VERSION - containing the current version number License - the GPL -- GNU Public License +CROSSBUILD - some instructions on crossbuilding hdw-linux +FAI - instructions how to set up an fully automated instll server -Getting hdw - linux +getting hdw - linux ------------------- -To get the hdw-linux sources you have two ways: - -- Download it from our website: - -http://hackdaworld.dyndns.org - -Stable tree: - -The tarballs: -http://www.hackdaworld.dyndns.org/download/hdw-linux/hdw-linux-0.2/snapshots/ - -Get it using cvs: -cvs -d :pserver:anonymous@hackdaworld.dyndns.org:/hdw-linux login -cvs -d :pserver:anonymous@hackdaworld.dyndns.org:/hdw-linux co hdw-linux-0.2 +have a look at: +http://www.hackdaworld.dyndns.org/hdw-linux/ -Development tree: - -The tarballs: -http://www.hackdaworld.dyndns.org/download/hdw-linux/hdw-linux-0.3-dev/snapshots/ - -Get it using cvs: -cvs -d :pserver:anonymous@hackdaworld.dyndns.org:/hdw-linux login -cvs -d :pserver:anonymous@hackdaworld.dyndns.org:/hdw-linux co hdw-linux-0.3-dev - -You may also fetch the sources from a mirror: - - - -If you want to add a mirror, please send an email to mike@hackdaworld.dyndns.org or hackbard@hackdaworld.dyndns.org. - -hdw - linux Community +hdw - linux community --------------------- -We have an IRC server, so you can join our channel and get help online, or just talk with other users. +there is an irc server, so you can join our channel and get help online, or +just talk with other users. -irc server: hackdaworld.dyndns.org +irc server: irc.hackdaworld.dyndns.org channel: #hackdaworld -Also we have a mailing list, to join it, send an email to -minimalist@hackdaworld.dyndns.org with the Subject: subscribe hackdaworld - -We hope to hear from you soon. +there is a mailing list, join it sending an email to +minimalist@hackdaworld.dyndns.org +with the subject: subscribe hackdaworld -hdw - linux Staff +regards, +hdw - linux staff diff --git a/misc/hdw-tools/hdw-get b/misc/hdw-tools/hdw-get new file mode 100644 index 0000000..6c9987c --- /dev/null +++ b/misc/hdw-tools/hdw-get @@ -0,0 +1,246 @@ +#!/bin/sh +# +# author: hackbard@hackdaworld.dyndns.org +# +# hdw-tools: +# this is hdw-get script, used to install/remove/(update) binary packages +# + +usage() { + echo + echo "usage:" + echo "$0 [install/remove] [root] [package]" + echo "$0 [dist-install] [root] [dist file]" + echo + echo "options:" + echo "-v tell me whats going on" + echo "-a auto resolve deps, do not prompt user" + echo "-no-dep do not care for dependencies (used by hdw-get itself)" + echo +} + +package="" ; inst_root="" +d_install="" ; install="" +verbose="" ; no_dep="" +auto_resolve_deps="" + +while [ "$1" ] ; do + case "$1" in + install) install="1" + inst_root="$2" ; package="$3" ; shift 3 ;; + remove) remove="1" + inst_root="$2" ; package="$3" ; shift 3 ;; + dist-install) d_install="1" ; package="fake" + inst_root="$2" ; dist_file="$3" ; shift 3 ;; + -v) verbose=1 ; shift 1 ;; + -a) auto_resolve_deps="1" ; shift 1 ;; + -no-dep) no_dep="1" ; shift 1 ;; + *) usage ; exit 1 ;; + esac +done + +if [ -z "inst_root" -o -z "$package" ] ; then + usage ; exit 1 +fi + +# read hdw-get configs +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 + echo "version, arch and arch_opt need to be specified." + echo "adjust /etc/hdw-get.conf file" + exit + else + [ "$verbose" ] && echo "hdw-get.conf file looks good ..." + fi +else + echo "/etc/hdw-get.conf file not found, aborting" + 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-[0-9]*; do + fl_pris="`echo $fl_file | awk -F- '{ print $NF }'` $fl_pris" + done + fl_max="0" + for pri in $fl_pris; do + if [ "$pri" = "x" ] ; then + fl_max="x" + break + fi + [ "$pri" -gt "$fl_max" ] && fl_max=$pri + done + fl_file="$inst_root/var/adm/flists/$package-$fl_max" + [ "$verbose" ] && echo "expecting flist file $fl_file" + if [ ! -f $fl_file ] ; 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 | \ + grep -v ^$package\ info\ -\ added\ by\ hdw > \ + /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 + ((supposed += 1)) + if [ -e $inst_root/$file ] ; then + if [ "$file" != "tmp" ] ; then + if [ -d $inst_root/$file ] ; then + rmdir -p $inst_root/$file > /dev/null 2>&1 + else + rm -f $inst_root/$file > /dev/null 2>&1 + rmdir -p `dirname $file` > /dev/null 2>&1 + fi + ((counter += 1)) + fi + fi + echo -en "\rremoved $counter from $supposed supposed files" + 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 + if [ ! -d $inst_root ] ; then + echo + echo "the install directory doesnt exist, create it first" + echo + exit 1 + fi + + # does package exist? + pkg=`basename $package | sed 's/.tar.bz2//'` + if [ -f $inst_root/var/adm/flists/${pkg}-[0-9]* ] ; then + echo "$pkg seems to be installed, candidates:" + for i in $inst_root/var/adm/flists/${pkg}-[0-9]*; do + echo "-> $i" + done + exit 1 + fi + + # 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/${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 "getting package $package via net ..." + wget $net_addr/hdw-linux/hdw-linux-$hdw_version/binaries/${hdw_arch}-${hdw_arch_opt}/$package/${package}.tar.bz2 > /dev/null 2>&1 + retval=$? + if [ "$retval" != "0" ] ; then + echo "package not found at $net_addr, aborting ..." + else + echo "extracting $package to $inst_root ..." + 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" + exit 1 + fi + + # merging info/dir file + if [ "$pkg" != "00-dirtree" ] ; then + fl_file=`ls -A $inst_root/var/adm/flists/$pkg-[0-9]* | tail -1` + if [ -n "`grep usr/share/info/dir $fl_file`" ] ; then + echo "" >> /tmp/.hdw-get/dir + echo "$pkg 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 + fi + [ -f /tmp/.hdw-get/dir ] && \ + cp /tmp/.hdw-get/dir $inst_root/usr/share/info/dir + rm -f /tmp/.hdw-get/dir + + # check for runtime deps + #if [ -z $no_deps ] ; then + # alldeps=`get_all_deps $pkg` + # echo "$pkg depends on the following packages:" + # for i in $alldeps; do + # echo "-> $i" + # done + # echo "continue? [y,n]" + # if [ -z $auto_resolve_deps ] ; then + # read answer + # if [ "$answer" = "y" ] ; then + # for i in $alldeps; do + # $0 -no-dep install $inst_root $pkg + # done + # else + # echo -n "install dependencies on your own," + # echo " things will not work without." + # fi + # fi + #fi + +# dist-install +elif [ "$d_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 + -- 2.39.2