3 ###########################################################
4 # Maemo-efl building script
5 # Enviroment setup functions definitions
7 # Note: var-definitions.sh, log-functions.sh
8 # and helper-functions.sh needed.
9 ###########################################################
13 local sources_list_file
14 local target_conf_file
17 sources_list_file=$__sbox_path/users/$USER/targets/$target/etc/apt/sources.list
18 target_conf_file=$__sbox_path/users/$USER/targets/$target.config
21 log_to_file "setup_distro(): Target $target"
22 log_to_file "setup_distro(): sources.list file : $sources_list_file"
23 log_to_file "setup_distro(): config file: $target_conf_file"
25 if [ "x$target" != "x" ] && [ -r $sources_list_file ] && [ -r $target_conf_file ]; then
26 # XXX: FIXME Figure out a better way to get the distro string
27 __distro=`$__head -1 $sources_list_file | cut -d" " -f3 | cut -d"/" -f1`
28 __arch=`$__grep SBOX_CPU= $target_conf_file | cut -d= -f2`
29 if [ "x$__arch" == "xi686" ]; then
31 elif [ "x$__arch" == "xarm" ]; then
34 __pkg_dir="$__base_pkg_dir/$__distro/$__arch"
35 if [ "x$__arch" = "xarmel" ] ; then
36 __build_pkg_options="$__common_build_pkg_options -B"
38 __build_pkg_options="$__common_build_pkg_options -I.svn -I.git -I.gitignore -I.cvsignore -sa"
43 if [ $ret -eq 0 ]; then
44 log_to_file "setup_distro(): Configuration:"
45 log_to_file "setup_distro(): distro...........: $__distro"
46 log_to_file "setup_distro(): arch.............: $__arch"
47 log_to_file "setup_distro(): build options....: $__build_pkg_options"
48 log_to_file "setup_distro(): pkg_dir..........: $__pkg_dir"
55 if [ ! -d $__sbox_path ]; then
56 error "Invalid scratchbox path: $__sbox_path"
59 __sbox="$__sbox_path/login"
60 __sbox_tools_bin_path="$__sbox_path/tools/bin"
61 __sbox_sb_conf="$__sbox_tools_bin_path/sb-conf"
63 __sbox_maemo3_debian_bin_path="/scratchbox/devkits/maemo3-debian/bin"
64 __sbox_dpkg="$__sbox_maemo3_debian_bin_path/dpkg"
65 __sbox_dpkg_buildpackage="$__sbox_dpkg-buildpackage"
66 __sbox_dpkg_parsechangelog="$__sbox_dpkg-parsechangelog"
67 __sbox_dpkg_checkbuilddeps="$__sbox_dpkg-checkbuilddeps"
69 __sbox_debian_sarge_bin_path="/scratchbox/devkits/debian-sarge/bin"
70 __sbox_dch="$__sbox_debian_sarge_bin_path/dch"
72 __sbox_targets=`$__sbox_sb_conf list --targets`
75 change_sbox_target () {
79 $__sbox_sb_conf select $target >> $__output_file 2>&1
85 if [ x$USER == xroot ]; then
86 error "You should not run this script as root"
89 if [ -r /targets/links/scratchbox.config ]; then
90 error "You should run this script outside the scratchbox environment."$
95 if [ ! -d $__base_pkg_dir ]; then
96 msg_begin "Creating base packages dir $__base_pkg_dir"
97 $__mkdir -p $__base_pkg_dir
102 if [ ! -d $__tmp_dir ]; then
103 msg_begin "Creating tmp dir $__tmp_dir"
104 $__mkdir -p $__tmp_dir