+#!/bin/bash
+
+source "helper-functions.sh"
+__this_script=`basename $0`
+__this_script_dir=`dirname $0`
+
+# git definitions
+__git=`which git`
+__git_clone="$__git clone"
+__git_pull="$__git pull"
+__git_clean="$__git clean"
+__git_repo="git://staff.get-e.org/"
+
+# e17 repositories paths
+__e17_libs="e17/libs"
+__e17_proto="e17/proto"
+__e17_python_efl="$__e17_proto/python-efl"
+__users="users"
+
+# modules
+__lib_modules="edb eet evas ecore embryo edje efreet epeg epsilon emotion etk ewl e_dbus exml enhance"
+__python_modules="python-evas python-ecore python-edje python-epsilon python-e_dbus"
+__user_modules="python-etk"
+
+# dpkg definitions
+__uname=`which uname`
+__arch=`$__uname -m`
+__common_build_pkg_options="-rfakeroot -us -uc -D"
+__build_pkg_options="$__common_build_pkg_options -sa"
+if [ "x$__arch" = "xarm" ] ; then
+ __build_pkg_options="$__common_build_pkg_options -B"
+fi
+
+# other definitions
+__date=`which date`
+__today=`$__date +%Y%m%d`
+
+__head=`which head`
+__distro=`$__head -1 /etc/apt/sources.list|cut -d" " -f3`
+
+__base_pkg_dir="$__this_script_dir/packages_$__today"
+__pkg_dir="$__base_pkg_dir/$__distro/$__arch"
+
+__output_file="$__base_pkg_dir/packages_$__today.log"
+
+
+function clone() {
+ local repo
+ repo=$1
+ `$__git_clone $repo 2>&1 >> $__output_file`
+ return $?
+}
+
+function pull() {
+ `$__git_pull 2>&1 >> $__output_file`
+ return $?
+}
+
+function clean() {
+ echo "clean"
+ return $?
+}
+
+function build_pkg() {
+ echo "build_pkg"
+ return $?
+}
+
+function install_pkg() {
+ echo "install_pkg"
+ return $?
+}
+
+function uninstall_pkg() {
+ echo "uninstall_pkg"
+ return $?
+}
+
+function log_to_file() {
+ local now
+ local msg
+ msg=$1
+
+ if [ ! -r $__output_file ]; then
+ error "Log file $__output_file does not exist"
+ fi
+
+ now=`$__date +%H:%M:%S`
+ echo "$now: $msg" >> $__output_file
+}
+
+function start_log() {
+ local now
+ now=`$__date -R`
+
+ if [ ! -r $__output_file ]; then
+ touch $__output_file
+ fi
+
+ if [ $? != 0 ] ; then
+ error "Could not create log file $__output_file"
+ fi
+
+ echo "*********************************************************" >> $__output_file
+ echo "* Started $__this_script: $now *" >> $__output_file
+ echo "*********************************************************" >> $__output_file
+ echo "" >> $__output_file
+ echo "Configuration:" >> $__output_file
+ echo " Distro.: $__distro" >> $__output_file
+ echo " Arch...: $__arch" >> $__output_file
+ echo "" >> $__output_file
+}
+
+function finish_log() {
+ local now
+ now=`$__date -R`
+
+ if [ ! -r $__output_file ]; then
+ error "Log file $__output_file does not exist"
+ fi
+
+ echo "" >> $__output_file
+ echo "* Finished $__this_script: $now" >> $__output_file
+ echo "" >> $__output_file
+}
+
+# Initial checks
+# Check if we're running inside scratchbox
+msg_begin "Checking for scratchbox environment"
+test -r /targets/links/scratchbox.config
+msg_end $?
+
+# Begin
+mkdir -p $__pkg_dir
+start_log
+log_to_file "Created $__pkg_dir"
+
+# Check for fakeroot
+
+# Download official modules
+
+# Build package
+
+# Install package
+
+# Download user modules (python-etk)
+
+# Build package
+
+# Install package
+
+# Uninstall all packages
+
+# END
+finish_log