From cf569a1a6c07655beb95b9192b1e2f0b5cf4f9e1 Mon Sep 17 00:00:00 2001 From: soumenganguly Date: Wed, 25 Mar 2015 14:50:55 +0530 Subject: Added the installation details --- backup-restore-tool/recovery.sh | 104 +++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 34 deletions(-) diff --git a/backup-restore-tool/recovery.sh b/backup-restore-tool/recovery.sh index 1fe76cd..fed7d74 100644 --- a/backup-restore-tool/recovery.sh +++ b/backup-restore-tool/recovery.sh @@ -1,3 +1,15 @@ +#! /bin/sh + +#Enviroment variables +boot_part=/dev/mtd4 +rootfs_mtd_num=5 +rootfs_part=/dev/mtd${rootfs_mtd_num} +ubuntu_dir=ubuntu_rootfs +ubuntu_file=/mnt/mmcblk0p1/recovery_images/ubuntu14.04.tar +kernel_image=/mnt/mmcblk0p1/recovery_images/uzImage.bin +ramdisk_image=/mnt/mmcblk0p1/recovery_images/initrd.img + + #This is the recovery script used to re-install or recover the FOSSEE-OS. #This is initial function which is called, also this is the first screen that comes up in this process. @@ -5,24 +17,24 @@ init() { -echo "------------------------------------------------------------------------------------------------------------------------------------" -echo "| | " -echo "| FOSSEE NOTEBOOK | " -echo "| INSTALLER | " -echo "| | " -echo "| | " -echo "| | " -echo "------------------------------------------------------------------------------------------------------------------------------------ " -echo "\n" -echo "\n" -echo "\n" +echo "-----------------------------------------------------------------------------------------------------------------" +echo "| |" +echo "| FOSSEE NOTEBOOK |" +echo "| INSTALLER |" +echo "| |" +echo "| |" +echo "| |" +echo "------------------------------------------------------------------------------------------------------------------" +echo "" +echo "" +echo "" printf "Press [A/a] to go to advanced options or [I/i] to re-install the FOSSEE-OS?" read choose_key -if [ $choose_key == "A" ] || [ $choose_key == "a" ]; then +if [ $choose_key = "A" ] || [ $choose_key = "a" ]; then advanced -elif [ $choose_key == "I" ] || [ $choose_key == "i" ]; then - echo "Installing a fresh copy of FOSSEE-OS operating system in ... \t" #Include the time remaining - for i in {5..1} +elif [ $choose_key = "I" ] || [ $choose_key = "i" ]; then + echo "Installing a fresh copy of FOSSEE-OS operating system in ..." #Include the time remaining + for i in 5 4 3 2 1; do echo "$i secs" sleep 1 @@ -40,12 +52,12 @@ fi install() { echo "" -printf " Do you want to continue with the installation? Press [Y/y] to continue, [N/n] to go back to the previous menu.\t" +printf " Do you want to continue with the installation? Press [Y/y] to continue, [N/n] to go back to the previous menu." read key -if [ $key == "Y" ] || [ $key == "y" ]; then +if [ $key = "Y" ] || [ $key = "y" ]; then installation -elif [ $key == "N" ] || [ $key == "n" ]; then - init +elif [ $key = "N" ] || [ $key = "n" ]; then + init else echo "Please enter a valid choice" install @@ -58,31 +70,48 @@ fi installation() { - echo "The installation will take place here" + # echo "The installation will take place here" + # exit 0 + flash_erase $rootfs_part 0 0 + ubiattach /dev/ubi_ctrl -m $rootfs_mtd_num + ubimkvol /dev/ubi0 -N rootfs -m + mount -t ubifs ubi0_0 $ubuntu_dir + tar xvvf $ubuntu_file -C $ubuntu_dir + sync + mode=$(fbset | grep geometry | cut -c5- | cut -d\ -f2,3 | tr \ x) + sed -i "s/MODE_ANY/$mode/g" ${ubuntu_dir}/etc/X11/xorg.conf + sync + + umount $ubuntu_dir } - #This functions presents the user with advanecd options where he/she can backup their data from previous installation or repair the current installation through shell prompt. #Seq- 1->A->2 advanced() { - clear - echo "\tTrying to access previous installation" - printf "\tMounting SD card" - for i in {1..10} - do - printf "." - sleep 1 - done +echo "Trying to access previous installation" +printf "Mounting SD card" +mkdir /sd_card +mount /dev/mmcblk0p1 /sd_card +for i in `seq 1 10` + do + printf "." + sleep 1s + done echo "" echo "You may backup your essential files and folders or repair your previous installation. This will now fallback to a command prompt" +#This will take the user to his previous installation. +mkdir /nand_previous +ubiattach /dev/ubi_ctrl -m 5 +mount -t ubifs ubi0_0 /nand_previous sleep 7 -echo "fallback to terminal" +/bin/sh +umount /nand_previous reinstall } -#This function is used for re-installating the OS after successfully backing-up the user's data. +#This function is used for re-installating the OS after successfully backing-up the users data. #Seq- 1->A->2->3 reinstall() @@ -92,11 +121,18 @@ read RET if [ "$RET" = "Y" ] || [ "$RET" = "y" ]; then install elif [ "$RET" = "N" ] || [ "$RET" = "n" ]; then - echo "Remove SD card and try your old installation" - exit + printf "Remove SD card. This machine will reboot in..." + for i in 4 3 2 1 + do + echo "$i secs" + sleep 1 + done + reboot else echo "Please enter a valid choice" + reinstall fi } -init +init + -- cgit