sup rev 39

Use cook_date in place of build_date
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 28 23:19:14 2017 +0100 (2017-02-28)
parents df5a777521ff
children 642f0fa9f0ff
files README libsup.sh server/sup/sup-admin.cgi server/sup/sup.cgi sup
line diff
     1.1 --- a/README	Tue Feb 28 22:58:14 2017 +0200
     1.2 +++ b/README	Tue Feb 28 23:19:14 2017 +0100
     1.3 @@ -1,7 +1,6 @@
     1.4  README for SliTaz Users Packages (SUP)
     1.5  ================================================================================
     1.6  
     1.7 -CURRENT : cook extract and install work nicely.
     1.8  
     1.9  The goal is to have a user-land packages management system using SHell scripts
    1.10  to pack and install files. The sup packages can install all kind of files such
    1.11 @@ -18,6 +17,7 @@
    1.12  Sup will be also useful in live mode with a persistent home mounted so users
    1.13  will have sup packages installed without having a too big rootfs in RAM.
    1.14  
    1.15 +
    1.16  Quickstart
    1.17  --------------------------------------------------------------------------------
    1.18  
     2.1 --- a/libsup.sh	Tue Feb 28 22:58:14 2017 +0200
     2.2 +++ b/libsup.sh	Tue Feb 28 23:19:14 2017 +0100
     2.3 @@ -7,7 +7,6 @@
     2.4  #
     2.5  . /lib/libtaz.sh
     2.6  
     2.7 -bin="$HOME/.local/bin"
     2.8  config="$HOME/.config"
     2.9  cache="$HOME/.cache/sup"
    2.10  data="$HOME/.local/share"
    2.11 @@ -100,20 +99,30 @@
    2.12  	. receip
    2.13  	
    2.14  	# Install sup deps || exit on missing system deps ?
    2.15 -	newline
    2.16 -	gettext "Checking dependencies for"; echo " $PACKAGE..."
    2.17 +	gettext "Checking package dependencies"
    2.18 +	deps="$(echo $SUP_DEPS $DEPENDS | wc -L)"
    2.19 +	in=$((8 + ${deps}))
    2.20 +	indent $(($(tty_size) - ${in})) "[ $(colorize 033 $deps) ]"
    2.21 +	
    2.22  	for dep in ${SUP_DEPS}; do
    2.23  		if [ ! "$installed/$dep" ]; then
    2.24 -			echo "Missing dependency:"; colorize 35 " $dep"
    2.25 +			gettext "Missing dependency:"; colorize 35 " $dep"
    2.26 +			sup -i "$dep"
    2.27  		fi
    2.28  	done
    2.29  	. /etc/slitaz/slitaz.conf # PKGS_DB
    2.30  	for dep in ${DEPENDS}; do
    2.31  		if [ ! "$PKGS_DB/installed/$dep" ]; then
    2.32 -			echo "Missing dependency:"; colorize 35 " $dep"
    2.33 +			gettext "Missing dependency:"; colorize 31 " $dep"
    2.34  		fi
    2.35  	done
    2.36  	
    2.37 +	# Remove existing package files to avois untracked files
    2.38 +	if [ -d "$wok/$PACKAGE" ]; then
    2.39 +		gettext "Removing existing package files..."
    2.40 +		remove_sup "$PACKAGE" >/dev/null; status
    2.41 +	fi
    2.42 +	
    2.43  	newline
    2.44  	echo -n "$(colorize 33 $(gettext 'Installing package:'))"
    2.45  	colorize 36 " $PACKAGE $VERSION"
     3.1 --- a/server/sup/sup-admin.cgi	Tue Feb 28 22:58:14 2017 +0200
     3.2 +++ b/server/sup/sup-admin.cgi	Tue Feb 28 23:19:14 2017 +0100
     3.3 @@ -93,7 +93,7 @@
     3.4  	website,
     3.5  	sup_deps,
     3.6  	depends,
     3.7 -	build_date,
     3.8 +	cook_date,
     3.9  	md5sum UNIQUE
    3.10  );
    3.11  EOT
    3.12 @@ -136,7 +136,7 @@
    3.13  	"$WEB_SITE",
    3.14  	"$SUP_DEPS",
    3.15  	"$DEPENDS",
    3.16 -	"$build_date",
    3.17 +	"$cook_date",
    3.18  	"$sum"
    3.19  );
    3.20  EOT
     4.1 --- a/server/sup/sup.cgi	Tue Feb 28 22:58:14 2017 +0200
     4.2 +++ b/server/sup/sup.cgi	Tue Feb 28 23:19:14 2017 +0100
     4.3 @@ -80,7 +80,7 @@
     4.4  <div>
     4.5  	<a href="?user=$USER">$(get_gravatar $MAINTAINER 24)</a>
     4.6  	$(gettext "Maintainer:") <a href="?user=$USER">$NAME</a> -
     4.7 -	$(gettext "Build date:") ${build_date} -
     4.8 +	$(gettext "Build date:") ${cook_date} -
     4.9  	$(gettext "License:") $LICENSE
    4.10  </div>
    4.11  EOT
    4.12 @@ -208,7 +208,7 @@
    4.13  			clean_error "Can't source receip"
    4.14  			echo "</pre>" && exit 1
    4.15  		fi
    4.16 -		echo "Build date: <span class='float-right value'>$build_date</span>"
    4.17 +		echo "Build date: <span class='float-right value'>$cook_date</span>"
    4.18  
    4.19  		# README
    4.20  		gettext "Checking for a README file..."
     5.1 --- a/sup	Tue Feb 28 22:58:14 2017 +0200
     5.2 +++ b/sup	Tue Feb 28 23:19:14 2017 +0100
     5.3 @@ -155,9 +155,9 @@
     5.4  			[ -d "files/${dir}" ] && mv files/${dir} files/.${dir}
     5.5  		done
     5.6  		
     5.7 -		# Add $build_date
     5.8 -		sed -i "/^build_date=/"d receip
     5.9 -		echo "build_date=\"$(date "+%Y-%m-%d %H:%M")\"" >> receip
    5.10 +		# Add $cook_date
    5.11 +		sed -i "/^cook_date=/"d receip
    5.12 +		echo "cook_date=\"$(date "+%Y-%m-%d %H:%M")\"" >> receip
    5.13  		
    5.14  		gettext "Creating compressed archive..."
    5.15  		find files | cpio -o -H newc --quiet | lzma e files.lzma -si
    5.16 @@ -173,7 +173,7 @@
    5.17  		# Run sup_install() without any installation to help package creation
    5.18  		pkg="$2"
    5.19  		receip="$wok/$pkg/receip"
    5.20 -		work="$supcook/sup_install"
    5.21 +		workdir="$supcook/sup_install"
    5.22  		
    5.23  		# Sanity check
    5.24  		check_pkg_arg "$1"
    5.25 @@ -184,11 +184,12 @@
    5.26  		newline
    5.27  		echo "$(colorize 33 $(gettext 'Running') sup_install\(\):) $(colorize 35 $pkg)"
    5.28  		separator
    5.29 -		mkdir -p ${work} && cd ${work}
    5.30 +		[ "$clean" ] && rm -rf ${workdir}
    5.31 +		mkdir -p ${workdir} && cd ${workdir}
    5.32  		. ${wok}/${pkg}/receip
    5.33  		sup_install
    5.34  		separator 
    5.35 -		gettext "Working folder:"; echo " $work"
    5.36 +		gettext "Working folder:"; echo " $workdir"
    5.37  		newline ;;
    5.38  	
    5.39  	-n|new)
    5.40 @@ -236,6 +237,7 @@
    5.41  		# Download/extract run install() in $cache/install
    5.42  		pkg="$2"
    5.43  		check_pkg_arg "$1"
    5.44 +		newline
    5.45  		
    5.46  		# Sup pkg in current dir
    5.47  		if [ -f "$pkg" ]; then
    5.48 @@ -258,7 +260,6 @@
    5.49  			vers=$(sqlite3 ${pkgsdb} "SELECT version FROM pkgs WHERE name = '$pkg'")
    5.50  			mkdir -p ${cache}/wget && cd ${cache}/wget
    5.51  			# Download
    5.52 -			newline
    5.53  			download "$pkg" "${mirror}/${pkg}-${vers}.sup"
    5.54  			install_sup "${pkg}-${vers}.sup"
    5.55  			rm -rf ${cache}/wget && exit 0
    5.56 @@ -399,9 +400,9 @@
    5.57  			newline
    5.58  			gettext "Installed package:"; colorize 36 " $PACKAGE $VERSION"
    5.59  			separator
    5.60 -			echo "Short desc: $SHORT_DESC"
    5.61 -			echo ""
    5.62 -			boldify "$(gettext 'Installed files:') ($sup_size)"
    5.63 +			echo "$SHORT_DESC"
    5.64 +			newline
    5.65 +			colorize 036 "$(gettext 'Installed files:') ($sup_size)"
    5.66  			cat ${installed}/${pkg}/files.list
    5.67  			newline
    5.68  		else