slitaz-dev-tools rev 174

Add help command to tazdev
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 24 00:07:57 2012 +0200 (2012-04-24)
parents bbb2501583d6
children cab409f94b91
files tazdev/tazdev tazdev/tazdev.conf
line diff
     1.1 --- a/tazdev/tazdev	Thu Apr 12 22:02:29 2012 +0200
     1.2 +++ b/tazdev/tazdev	Tue Apr 24 00:07:57 2012 +0200
     1.3 @@ -11,20 +11,22 @@
     1.4  #     Christophe Lincoln <pankso@slitaz.org>
     1.5  #     Pascal Bellard <bellard@slitaz.org>
     1.6  #
     1.7 +. /lib/libtaz.sh
     1.8  
     1.9  [ -f /etc/slitaz/tazdev.conf ] && . /etc/slitaz/tazdev.conf
    1.10  [ -f tazdev.conf ] && . ./tazdev.conf
    1.11  
    1.12 -if [ -z "$SLITAZ" ]; then
    1.13 +if [ -z "$SLITAZ_HOME" ]; then
    1.14  	echo -e "\nNo config file found\n" && exit 1
    1.15  fi
    1.16  
    1.17  usage()
    1.18  {
    1.19  	echo -e "\nSliTaz developers and build host tool\n
    1.20 -\033[1mUsage: \033[0m `basename $0` [command] [user] [stable|cooking|undigest|path]
    1.21 -\033[1mCommands: \033[0m\n
    1.22 +$(boldify "Usage:") $(basename $0) [command] [user|tool] [release|path]
    1.23 +$(boldify "Commands:")
    1.24   usage               Print this short usage and command list
    1.25 + help                Give help on a SliTaz tool or library.
    1.26   projects-stats|-ps  Display statistics about your projects
    1.27   chroot              Mount virtual fs if needed and chroot into the build env
    1.28   gen-chroot|-gs      Generate a chroot using the last cooking base rootfs
    1.29 @@ -41,26 +43,6 @@
    1.30   reliso|-ri          Create all main flavors (not loram)\n"
    1.31  }
    1.32  
    1.33 -# Be sure we root.
    1.34 -check_root() {
    1.35 -	[ $(id -u) != 0 ] && \
    1.36 -		echo -e "\nYou must be root to use: $(basename $0) $@\n" && exit 0
    1.37 -}
    1.38 -
    1.39 -separator() {
    1.40 -	echo "================================================================================"
    1.41 -}
    1.42 -
    1.43 -status() {
    1.44 -	echo -en "\\033[70G[ "
    1.45 -	if [ $? = 0 ]; then
    1.46 -		echo -en "\\033[1;32mOK"
    1.47 -	else
    1.48 -		echo -en "\\033[1;31mFailed"
    1.49 -	fi
    1.50 -	echo -e "\\033[0;39m ]"
    1.51 -}
    1.52 -
    1.53  get_version()
    1.54  {
    1.55  	if [ "$2" = "stable" ]; then
    1.56 @@ -69,7 +51,7 @@
    1.57  	elif [ -n "$2" ]; then
    1.58  		# Undigest - custom ?
    1.59  		version=$2
    1.60 -		slitaz=$SLITAZ/$2
    1.61 +		slitaz=$SLITAZ_HOME/$2
    1.62  	else
    1.63  		version=cooking
    1.64  		slitaz=$COOKING
    1.65 @@ -129,7 +111,7 @@
    1.66  	# But do it only if it's a slitaz developement chroot.
    1.67  	fs=$rootfs/home/slitaz
    1.68  	if [ -d "$slitaz" ]; then
    1.69 -		bind_chroot_dir $SLITAZ/src $fs/src
    1.70 +		bind_chroot_dir $SLITAZ_HOME/src $fs/src
    1.71  		# Now mount package dir so they are in /home/slitaz/$version
    1.72  		# We may not mount cache wok or others it has no point and if
    1.73  		# one wants to use a shared wok he can bind it manually.
    1.74 @@ -365,8 +347,10 @@
    1.75  		echo -n "Do you wish to update $pkg in wok [N/y] ? "
    1.76  		read update
    1.77  		if [ "$update" = "y" ]; then
    1.78 +			echo "Updating $pkg: $version"
    1.79  			cd $PROJECTS/wok
    1.80  			sed -i s"/VERSION=.*/VERSION=\"$version\"/" $pkg*/receipt
    1.81 +			status
    1.82  		fi ;;
    1.83  	reliso|-ri)
    1.84  		# Generate all official images iso at once for a specific version.
    1.85 @@ -389,6 +373,19 @@
    1.86  		done
    1.87  		# Clean up slitaz working directory.
    1.88  		rm *.flavor tazlito.conf ;;
    1.89 +	help)
    1.90 +		[ ! "$2" ] && echo "Missing tool/library name" && exit 0
    1.91 +		echo ""
    1.92 +		boldify "Help for: $2"
    1.93 +		separator
    1.94 +		case $2 in
    1.95 +			libtaz.sh) libtaz ;;
    1.96 +			httphelper.sh) 
    1.97 +				. /usr/lib/slitaz/httphelper.sh 
    1.98 +				httphelper ;;
    1.99 +			*) echo "No help found" ;;
   1.100 +		esac
   1.101 +		separator && echo "" ;;
   1.102  	usage|*)
   1.103  		usage ;;
   1.104  esac
     2.1 --- a/tazdev/tazdev.conf	Thu Apr 12 22:02:29 2012 +0200
     2.2 +++ b/tazdev/tazdev.conf	Tue Apr 24 00:07:57 2012 +0200
     2.3 @@ -2,10 +2,11 @@
     2.4  #
     2.5  
     2.6  # Path for the wok, chroot and packages directory of each version.
     2.7 -SLITAZ="/home/slitaz"
     2.8 -COOKING="$SLITAZ/cooking"
     2.9 -STABLE="$SLITAZ/stable"
    2.10 -UNDIGEST="$SLITAZ/undigest"
    2.11 +# We we use main slitaz.conf in time.
    2.12 +SLITAZ_HOME="/home/slitaz"
    2.13 +COOKING="$SLITAZ_HOME/cooking"
    2.14 +STABLE="$SLITAZ_HOME/stable"
    2.15 +UNDIGEST="$SLITAZ_HOME/undigest"
    2.16  
    2.17  # Path to all own and copy projects.
    2.18  PROJECTS="$HOME/Projects"