tazpkg rev 584
Add function from old libtaz only used by tazpkg (we will probably have a libtazpkg.sh used also by tazlito
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Apr 12 16:59:05 2012 +0200 (2012-04-12) |
parents | a18b4a29701b |
children | 3285c8c600e2 |
files | tazpkg |
line diff
1.1 --- a/tazpkg Thu Apr 05 13:27:19 2012 +0200 1.2 +++ b/tazpkg Thu Apr 12 16:59:05 2012 +0200 1.3 @@ -150,6 +150,37 @@ 1.4 echo "================================================================================" 1.5 } 1.6 1.7 +# Check if dir exist 1.8 +check_dir() 1.9 +{ 1.10 + if ! [ -d "$1" ]; then 1.11 + echo -n "Creating $1..." 1.12 + mkdir -p "$1" 1.13 + status 1.14 + return 1 1.15 + fi 1.16 +} 1.17 + 1.18 +# Store -- options in a variable. 1.19 +get_options() 1.20 +{ 1.21 + if echo "$log_command" | fgrep -q ' '--help; then 1.22 + echo "Available options for $(echo `basename "$log_command"` | cut -d ' ' -f 1,2) : $get_options_list" 1.23 + exit 0 1.24 + fi 1.25 + for get_option in $(echo "$log_command" | tr ' ' '\n' | grep ^-- | sed 's/^--//'); do 1.26 + if [ "${get_options_list/${get_option%%=*}}" = "$get_options_list" ]; then 1.27 + echo "Option ${get_option%%=*} is incorrect, valid options are : $get_options_list". >&2 1.28 + exit 1 1.29 + fi 1.30 + if [ "$get_option" = "${get_option/=}" ]; then 1.31 + export $get_option=yes 1.32 + else 1.33 + export $get_option 1.34 + fi 1.35 + done 1.36 +} 1.37 + 1.38 # Check for a package name on cmdline. 1.39 check_for_package_on_cmdline() 1.40 {