diff options
author | Nicolas Zingilé <nicolas.zingile@open.eurogiciel.org> | 2014-10-31 10:32:48 +0100 |
---|---|---|
committer | Nicolas Zingilé <nicolas.zingile@open.eurogiciel.org> | 2014-10-31 10:32:48 +0100 |
commit | c2c03dbe1de88dc65e03b2b1ce9e0147bdd40242 (patch) | |
tree | 8105e79e5beef7c46692a12514f421b8d1c555e2 | |
parent | 46e869c9b915a23aa387ab7d870228a876907522 (diff) | |
download | system-installer-c2c03dbe1de88dc65e03b2b1ce9e0147bdd40242.tar.gz system-installer-c2c03dbe1de88dc65e03b2b1ce9e0147bdd40242.tar.bz2 system-installer-c2c03dbe1de88dc65e03b2b1ce9e0147bdd40242.zip |
added basic modesubmit/tizen_common/20141031.094314submit/tizen_3.0.2014.q3_common/20141031.105401accepted/tizen/3.0.2014.q3/common/20141031.105534
Change-Id: Idd163be2f3f717205f6b24a524caafbe816f53e5
Signed-off-by: Nicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
-rw-r--r-- | packaging/system-installer.spec | 2 | ||||
-rwxr-xr-x | scripts/mode-util | 20 | ||||
-rwxr-xr-x | scripts/system-installer | 41 | ||||
-rwxr-xr-x | scripts/url-util | 58 |
4 files changed, 81 insertions, 40 deletions
diff --git a/packaging/system-installer.spec b/packaging/system-installer.spec index 1cfb9c6..666a2f8 100644 --- a/packaging/system-installer.spec +++ b/packaging/system-installer.spec @@ -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 index 0000000..63a082a --- /dev/null +++ b/scripts/mode-util @@ -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 diff --git a/scripts/system-installer b/scripts/system-installer index 116acba..461bc8b 100755 --- a/scripts/system-installer +++ b/scripts/system-installer @@ -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 diff --git a/scripts/url-util b/scripts/url-util index 68839d4..1c541de 100755 --- a/scripts/url-util +++ b/scripts/url-util @@ -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 |