added basic mode 60/29660/1 accepted/tizen/3.0.2014.q3/common/20141031.105534 submit/tizen_3.0.2014.q3_common/20141031.105401 submit/tizen_common/20141031.094314
authorNicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
Fri, 31 Oct 2014 09:32:48 +0000 (10:32 +0100)
committerNicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
Fri, 31 Oct 2014 09:32:48 +0000 (10:32 +0100)
Change-Id: Idd163be2f3f717205f6b24a524caafbe816f53e5
Signed-off-by: Nicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
packaging/system-installer.spec
scripts/mode-util [new file with mode: 0755]
scripts/system-installer
scripts/url-util

index 1cfb9c643b13102159187e3303af8f519e949de7..666a2f85f04d354278e059ab5ae2536cf16c4972 100644 (file)
@@ -41,6 +41,7 @@ install -m 0775 scripts/disk-util  %{buildroot}/%{_prefix}/lib/%{name}/disk-util
 install -m 0775 scripts/url-util  %{buildroot}/%{_prefix}/lib/%{name}/url-util
 install -m 0775 scripts/wifi-util  %{buildroot}/%{_prefix}/lib/%{name}/wifi-util
 install -m 0775 scripts/keyboard-util  %{buildroot}/%{_prefix}/lib/%{name}/keyboard-util
+install -m 0775 scripts/mode-util  %{buildroot}/%{_prefix}/lib/%{name}/mode-util
 install -m 0775 scripts/system-installer  %{buildroot}/%{_sbindir}/system-installer
 install -m 0644 scripts/.dialogrc  %{buildroot}/root/.dialogrc
 ln -sf ../system-installer.service %{buildroot}/%{_unitdir}/default.target.wants/system-installer.service
@@ -59,4 +60,5 @@ ln -sf ../system-installer.service %{buildroot}/%{_unitdir}/default.target.wants
 %{_prefix}/lib/%{name}/url-util
 %{_prefix}/lib/%{name}/wifi-util
 %{_prefix}/lib/%{name}/keyboard-util
+%{_prefix}/lib/%{name}/mode-util
 /root/.dialogrc
diff --git a/scripts/mode-util b/scripts/mode-util
new file mode 100755 (executable)
index 0000000..63a082a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Select a keyboard layout in a menu
+
+outfile=${1:-/dev/stdout}
+utilspath=/usr/lib/system-installer
+
+. $utilspath/dialog-helper
+
+trap "exit 1" SIGINT
+
+dialog_helper --no-items --item-help --menu "Select your installation mode" 15 70 15 \
+"basic" "Put the whole url of the image that you want to install." \
+"custom" "Browse through the download.tizen.org directories and select the image that you want to install."
+
+cat << EOC > $outfile
+$(echo "$DIALOGRES")
+EOC
+
+exit 0
index 116acba59fdf517dcf206484cb593fc6c78db5c3..461bc8b6b7cf9ddf1be6523d25133d598a72dad9 100755 (executable)
@@ -32,31 +32,24 @@ export HOME="/root"
 # Used to retrieve output of the other scripts
 output_data_file="/tmp/system-installer.$$"
 
-# Configuration file of system-installer
-conf_file="/etc/system-installer.conf"
-
 # Used to signal a bmaptool failure during download/flash
 bmaptool_failure=""
 
-# util executables paths
+# Util executables paths
 utilspath=/usr/lib/system-installer
 url_util=$utilspath/url-util
 wifi_util=$utilspath/wifi-util
 kbd_util=$utilspath/keyboard-util
 disk_util=$utilspath/disk-util
+mode_util=$utilspath/mode-util
 
-. $utilspath/dialog-helper
-
-# Simply read the configuration in $conf_file, exit if not found
-function read_config {
+# Variables for the user
+INSTALL_MODE=
+KEYBOARD_LAYOUT=
+IMAGE_URL=
+OUTDEV=
 
-    if [ ! -e $conf_file ]; then
-        $DIALOG --msgbox "Installation failure, missing $conf_file" 24 70
-           sigint_handler
-    else
-        . $conf_file
-    fi
-}
+. $utilspath/dialog-helper
 
 # Download the raw image, decompress it and write it on the device
 # When the image is written, the partition size is modified
@@ -99,7 +92,7 @@ function test_connection {
 function sigint_handler {
        local txt=""
        if [ "$bmaptool_failure" = "yes" ]; then
-               txt+="Bmaptool failed to flash your device."
+               txt+="Bmaptool failed to flash your device.\n\n\n"
        else
                txt+="The installation was interrupted.\n\n\n"
        fi
@@ -109,22 +102,28 @@ function sigint_handler {
        exec /usr/sbin/system-installer
 }
 
+function select_mode {
+    while :; do
+        $mode_util "$output_data_file" && break
+        [ $? -eq 1 ] && sigint_handler
+    done
+    INSTALL_MODE=$(cat "$output_data_file")
+    rm -f "$output_data_file" 2>/dev/null
+}
+
 trap "sigint_handler" SIGINT
 
-read_config
+[ -z "$INSTALL_MODE" ] && select_mode
 
 [ -z "$KEYBOARD_LAYOUT" ] && select_keyboard_layout
 
 if [ -z "$IMAGE_URL" ]; then
        test_connection
        while :; do
-               $url_util "$output_data_file" && break
+               $url_util "$output_data_file" "$INSTALL_MODE" && break
                [ $? -eq 1 ] && sigint_handler
        done
        IMAGE_URL=$(cat "$output_data_file")
-elif ! curl --fail -I "$IMAGE_URL" > /dev/null ; then
-       echo "The image url couldn't be reached, please verify that the url is correct."
-       exit 1
 fi
 
 if [ -z "$OUTDEV" ]; then
index 68839d4127b20b205f8bb805957838578676bcab..1c541dea2d0ee6d0a81b59c6f6c6477957127514 100755 (executable)
@@ -8,6 +8,7 @@
 #!/bin/bash
 
 outfile=${1:-/dev/stdout}
+mode=${2:-"basic"}
 
 BASE_URL="http://download.tizen.org/"
 IMAGE_URL+=$BASE_URL
@@ -82,28 +83,47 @@ function do_sync() {
     [[ -n "$dialog_pid" ]] && kill $dialog_pid
 }
 
+
+function enter_url() {
+       $DIALOG --stderr --no-cancel --inputbox "Enter the entire url of the image :\n" 24 70 2>$tmpfile
+       IMAGE_URL=$(cat $tmpfile)
+       if ! curl --fail -s -I "$IMAGE_URL" > /dev/null ; then
+               echo "Bad image url !"
+                $DIALOG --msgbox "The image url couldn't be reached, please verify that the url is correct." 15 70
+               exit 1
+       fi
+}
+
 #######################################################
 
-select_topdir || exit 1
-curdir=$DIALOG_RESULT
-
-touch sync.out
-$DIALOG --title "Fetching images locations" --tailbox sync.out 24 70 &
-do_sync $! >>sync.out
-
-initial_dir=$curdir
-while [ 1 ]; do
-    select_image $curdir || exit 1
-    if [[ "$DIALOG_RESULT" == "${BACK_STRING}" ]]; then
-        curdir=$(dirname $curdir)
-    elif [[ -z "$DIALOG_RESULT" ]]; then
-        break
-    else
-        curdir="$curdir/$DIALOG_RESULT"
-    fi
-done
 
-IMAGE_URL+=$(echo $curdir/*.raw.*)
+if [ "$mode" = "custom" ]; then
+       IMAGE_URL+=$BASE_URL
+
+       select_topdir || exit 1
+
+       curdir=$DIALOG_RESULT
+       touch sync.out
+       $DIALOG --title "Fetching images locations" --tailbox sync.out 24 70 &
+       do_sync $! >>sync.out
+
+       initial_dir=$curdir
+       while [ 1 ]; do
+               select_image $curdir || exit 1
+               if [[ "$DIALOG_RESULT" == "${BACK_STRING}" ]]; then
+                       curdir=$(dirname $curdir)
+               elif [[ -z "$DIALOG_RESULT" ]]; then
+                       break
+               else
+                       curdir="$curdir/$DIALOG_RESULT"
+               fi
+       done
+
+       IMAGE_URL+=$(echo $curdir/*.raw.*)
+
+elif [ "$mode" = "basic" ]; then
+       enter_url
+fi
 
 popd &>/dev/null