# HG changeset patch # User Christophe Lincoln # Date 1334242745 -7200 # Node ID 0c7e4875ea3cd9fcd13fa821e031a99db6ad868d # Parent a18b4a29701b00d8b6e738030fd89c695228a1b6 Add function from old libtaz only used by tazpkg (we will probably have a libtazpkg.sh used also by tazlito diff -r a18b4a29701b -r 0c7e4875ea3c tazpkg --- a/tazpkg Thu Apr 05 13:27:19 2012 +0200 +++ b/tazpkg Thu Apr 12 16:59:05 2012 +0200 @@ -150,6 +150,37 @@ echo "================================================================================" } +# Check if dir exist +check_dir() +{ + if ! [ -d "$1" ]; then + echo -n "Creating $1..." + mkdir -p "$1" + status + return 1 + fi +} + +# Store -- options in a variable. +get_options() +{ + if echo "$log_command" | fgrep -q ' '--help; then + echo "Available options for $(echo `basename "$log_command"` | cut -d ' ' -f 1,2) : $get_options_list" + exit 0 + fi + for get_option in $(echo "$log_command" | tr ' ' '\n' | grep ^-- | sed 's/^--//'); do + if [ "${get_options_list/${get_option%%=*}}" = "$get_options_list" ]; then + echo "Option ${get_option%%=*} is incorrect, valid options are : $get_options_list". >&2 + exit 1 + fi + if [ "$get_option" = "${get_option/=}" ]; then + export $get_option=yes + else + export $get_option + fi + done +} + # Check for a package name on cmdline. check_for_package_on_cmdline() {