sup rev 27

More intuitive new package command
author Christophe Lincoln <pankso@slitaz.org>
date Mon Feb 27 15:49:36 2017 +0100 (2017-02-27)
parents 32f5aaba49d1
children 3de890dde88b
files sup
line diff
     1.1 --- a/sup	Mon Feb 27 14:48:07 2017 +0100
     1.2 +++ b/sup	Mon Feb 27 15:49:36 2017 +0100
     1.3 @@ -5,10 +5,13 @@
     1.4  # Copyright (C) 2017 SliTaz GNU/Linux - BSD License
     1.5  # Author: Christophe Lincoln <pankso@slitaz.org>
     1.6  #
     1.7 +# Colors: installed 36; wok/package 35; commands/functions 33
     1.8 +#
     1.9 +
    1.10 +# Get system wide libsup.sh or development version if working in Hg folder
    1.11  if [ -f "/usr/lib/slitaz/libsup.sh" ]; then
    1.12  	. /usr/lib/slitaz/libsup.sh
    1.13  fi
    1.14 -# Devel mode
    1.15  if [ -f "./libsup.sh" ]; then
    1.16  	. ./libsup.sh
    1.17  fi
    1.18 @@ -167,19 +170,24 @@
    1.19  	
    1.20  	-n|new)
    1.21  		pkg="$2"
    1.22 -		newline
    1.23  		if [ ! "$pkg" ]; then
    1.24 +			newline
    1.25  			gettext "New package name:"; echo -n " "; read pkg
    1.26  		fi
    1.27 +		newline
    1.28  		[ ! "$pkg" ] && exit 0
    1.29 +		[ ! -d "$wok" ] && cook_init
    1.30  		if [ -d "$wok/$pkg" ]; then
    1.31 -			gettext "Package already exist in wok:"; colorize 36 " $pkg"
    1.32 +			gettext "Package already exist in wok:"; colorize 35 " $pkg"
    1.33  			newline && exit 0
    1.34  		fi
    1.35  		gettext "Creating new package files and tree..."
    1.36  		mkdir -p ${wok}/${pkg}/files
    1.37 -		new_receip "$pkg"
    1.38 -		status && newline ;;
    1.39 +		new_receip "$pkg"; status
    1.40 +		gettext "Executing your favorite editor..."
    1.41 +		editor ${wok}/${pkg}/receip; status 
    1.42 +		gettext "To cook your package:"; colorize 33 " sup cook $pkg"
    1.43 +		newline ;;
    1.44  	
    1.45  	-e|extract)
    1.46  		# Extract package.sup to current dir
    1.47 @@ -223,6 +231,19 @@
    1.48  		
    1.49  		gettext "Can't find sup package:"; colorize 31 " $pkg" ;;
    1.50  	
    1.51 +	-u|update)
    1.52 +		# Update packages
    1.53 +		newline
    1.54 +		colorize 33 $(gettext "SUP Update")
    1.55 +		separator
    1.56 +		
    1.57 +		# Skip HTTP/1.1 404 Not Found: 2>/dev/null
    1.58 +		if ! wget --spider -q ${mirror}/${pkgsdb} 2>/dev/null; then
    1.59 +			gettext "Mirror is unreachable"; echo
    1.60 +		fi
    1.61 +		
    1.62 +		newline ;;
    1.63 +	
    1.64  	-r|remove)
    1.65  		# Remove a package
    1.66  		pkg="$2"