__this_script=`basename $0`
__this_script_dir=`dirname $0`
-# git definitions
+# Binaries
+__date=`which date`
__git=`which git`
+__head=`which head`
+__mkdir=`which mkdir`
+__sed=`which sed`
+__uname=`which uname`
+
+# git definitions
__git_clone="$__git clone"
__git_pull="$__git pull"
__git_clean="$__git clean"
__python_etk_module="python-etk"
# dpkg definitions
-__uname=`which uname`
__arch=`$__uname -m`
__common_build_pkg_options="-rfakeroot -us -uc -D -tc"
__build_pkg_options="$__common_build_pkg_options -sa"
__build_pkg_options="$__common_build_pkg_options -B"
fi
-# other definitions
-__sed=`which sed`
-__mkdir=`which mkdir`
-__date=`which date`
-__today=`$__date +%Y%m%d`
-
-__head=`which head`
+# Distro
__distro=`$__head -1 /etc/apt/sources.list|cut -d" " -f3`
+# Packages dirs and log file
+__today=`$__date +%Y%m%d`
__base_pkg_dir="$__this_script_dir/packages_$__today"
__pkg_dir="$__base_pkg_dir/$__distro/$__arch"
-
__output_file="$PWD/$__base_pkg_dir/packages_$__today.log"
+# Scratchbox definitions
+__scratchbox=/scratchbox
+
# Function definitions
+function usage() {
+ cat << EOF
+
+Usage: $__this_script [OPTIONS]
+
+Build script for EFL debian packages for Maemo.
+
+Options:
+ -h Show this usage guide.
+ -s PATH Specify alternate scratchbox path (default: $__scratchbox).
+
+EOF
+}
+
function log_to_file() {
local now
local msg
error "start_log(): Could not create $__output_file file"
fi
-cat << EOF >> $__output_file
+ cat << EOF >> $__output_file
*********************************************************
* Started $__this_script: $now *
*********************************************************
error "finish_log(): Log file does not exist"
fi
-cat << EOF >> $__output_file
+ cat << EOF >> $__output_file
* Finished $__this_script: $now
EOF
done
}
+# Verify options
+while getopts "hs" opt ; do
+ case "$opt" in
+ h)
+ usage
+ exit 0
+ ;;
+ s)
+ __scratchbox=$OPTARG
+ ;;
+ [?])
+ usage
+ exit 1
+ ;;
+ esac
+done
+
# Initial checks
# Distro variable must not be empty
test -r /targets/links/scratchbox.config
msg_end $?
-# Begin
+# Create packages dir and log file
$__mkdir -p $__pkg_dir
start_log
log_to_file "Created $__pkg_dir"