Hi,
I have made the following changes to installer-shell in project
Trunk:Testing. Please review and accept ASAP.
Thank You,
itachi
[This message was auto-generated]
---
Request #21537:
submit:
home:itachi:branches:Trunk:Testing/installer-shell(r3)(cleanup) ->
Trunk:Testing/installer-shell
Message:
* Mon Jun 27 2011 - Chengwei Yang<[email protected]> - 0.5
- Add a patch to fix partition failed when the device is busy.
(BMC#19866)
- porting workaround-for-creating-btrfs-fs.patch. (BMC#19565)
State: new 2011-06-27T01:48:27 itachi
Comment: None
changes files:
--------------
--- installer-shell.changes
+++ installer-shell.changes
@@ -0,0 +1,4 @@
+* Mon Jun 27 2011 - Chengwei Yang<[email protected]> - 0.5
+- Add a patch to fix partition failed when the device is busy.
(BMC#19866)
+- porting workaround-for-creating-btrfs-fs.patch. (BMC#19565)
+
new:
----
installer-shell-fix-partitioning-failed.patch
workaround-for-creating-btrfs-fs.patch
spec files:
-----------
--- installer-shell.spec
+++ installer-shell.spec
@@ -18,12 +18,14 @@
Source100: installer-shell.yaml
Patch0: add-more-check-for-imagetype.patch
Patch1: installer-shell-fix-mtab.patch
+Patch2: installer-shell-fix-partitioning-failed.patch
+Patch3: workaround-for-creating-btrfs-fs.patch
Requires: parted
Requires: rsync
Requires: system-logos
Requires: e2fsprogs
Requires: btrfs-progs
-Requires: util-linux
+Requires: util-linux-ng
Requires: syslinux-extlinux
@@ -40,6 +42,10 @@
%patch0 -p1
# installer-shell-fix-mtab.patch
%patch1 -p1
+# installer-shell-fix-partitioning-failed.patch
+%patch2 -p1
+# workaround-for-creating-btrfs-fs.patch
+%patch3 -p1
#>> setup
#<< setup
other changes:
--------------
++++++ installer-shell-fix-partitioning-failed.patch (new)
--- installer-shell-fix-partitioning-failed.patch
+++ installer-shell-fix-partitioning-failed.patch
+diff -Naru a/installer-shell b/installer-shell
+--- a/installer-shell 2011-06-27 11:10:12.504970002 +0800
++++ b/installer-shell 2011-06-27 14:45:42.694970001 +0800
+@@ -1,5 +1,6 @@
+ #!/bin/bash
+
++SFDISK_FORCE=""
+ # Configuration variables
+ INSTALL_DIR=/tmp/sysimage
+ LOGFILE=/tmp/install.log
+@@ -63,7 +64,7 @@
+ }
+
+ pre_partition () {
+- partprobe /dev/$DEV>> $LOGFILE 2>&1&& sleep 1
++ partprobe /dev/$DEV>> $LOGFILE 2>&1&& sleep 1&& sync
+ }
+
+ post_partition () {
+@@ -116,6 +117,39 @@
+ dbglg_exec "rm -rf $INSTALL_DIR"
+ }
+
++
++sfdisk_loop () {
++ local STR INTERVAL OLD_FLAG
++ if [ ! -z $2 -a -f $2 ]; then
++ STR="$(cat $2)\n"
++ else
++ STR=$2
++ fi
++ INTERVAL=1
++ while true;
++ do
++ dbglg "sfdisk_loop($1) \"$2\" \"$SFDISK_FORCE $3\""
++ tmp_str="$(echo -ne "$STR" |sfdisk $SFDISK_FORCE /dev/$DEV
$3 2>&1 |tee -a $LOGFILE |
++ sed -n -e '/Checking that no-one is using this disk right
now/{N;/Device or resource busy/p}' -e '/Warning:.*cylinder
boundary/{N;N;/sfdisk: I don/p}')"
++ if echo $tmp_str |grep "Device or resource busy">
/dev/null 2>&1; then
++ output "Device is busy, sleep a while and try again,
please wait..."
++ sleep $INTERVAL
++ INTERVAL=$(($INTERVAL+1))
++ if [ $INTERVAL -ge 10 ]; then
++ fail_exit "sfdisk failed."
++ fi
++ sync
++ elif echo $tmp_str |grep "Warning:.*cylinder
boundary">/dev/null 2>&1; then
++ OLD_FLAG=$SFDISK_FORCE
++ SFDISK_FORCE="--force"
++ else
++ break
++ fi
++ unset tmp_str
++ done
++ SFDISK_FORCE=$OLD_FLAG
++}
++
+ run_fsck () {
+ if [ $IMAGE_TYPE = "liveimg" ]; then
+ if [ -x $(which fsck) ]; then
+@@ -242,7 +276,7 @@
+ else
+ output "Rollback disk partition table, please wait..."
+ pre_partition
+- sfdisk /dev/$DEV>/dev/null 2>&1< $PART_BACKUP
++ sfdisk_loop "rollback" $PART_BACKUP ""
+ post_partition
+ fail_exit "Rollback partition finished."
+ fi
+@@ -283,16 +317,9 @@
+ output "Create default partition layout, please wait..."
+ pre_partition
+ if [ $IMAGE_TYPE = "liveimg" ]; then
+- sfdisk -uM /dev/$DEV>> $LOGFILE 2>&1<<-EOF
+- ,$BOOT_SIZE,L,*
+- ,$ROOT_SIZE,L
+- ,,S
+- EOF
++ sfdisk_loop "whole disk, liveimg"
",$BOOT_SIZE,L,*\n,$ROOT_SIZE,L\n,,S\n" "-uM"
+ elif [ $IMAGE_TYPE = "nandfs" ]; then
+- sfdisk -uM /dev/$DEV>> $LOGFILE 2>&1<<-EOF
+- ,$ROOT_SIZE,L,*
+- ,,S
+- EOF
++ sfdisk_loop "whole disk, nandfs"
",$ROOT_SIZE,L,*\n,,S\n" "-uM"
+ fi
+ post_partition
+ # Use free space, it's a little complicated
+@@ -375,10 +402,7 @@
+ fail_exit "Never should be here."
+ fi
+ pre_partition
+- sfdisk -uM /dev/$DEV -N$EXTENDED_NR>> $LOGFILE 2>&1<<-EOF
+- $(($HOLE_START+1)),$(($HOLE_MAX-10)),E,
+- y
+- EOF
++ sfdisk_loop "free space, no extended"
"$(($HOLE_START+1)),$(($HOLE_MAX-10)),E,\ny\n" "-uM -N$EXTENDED_NR"
+ post_partition
+ # If has extended partition
+ elif [ $HAS_EXTENDED -eq 1 ]; then
+@@ -448,7 +472,8 @@
+ EOF
+ fi
+ fi
+- post_partition
++ # fdisk will warning when the device is busy, that will
cuased post_partition failed.
++ sleep 3&& sync
+ else
+ fail_exit "Never should be here."
+ fi
+@@ -472,18 +497,14 @@
+ # toggle the old boot partition doesn't bootable
+ pre_partition
+ old_bootdev=$(sfdisk -l /dev/$DEV 2>/dev/null |grep
"^/dev/" |grep "\*" |awk '{print $1}' |grep -o "[1-9]\|[1-9][0-9]")
+- if [ -n $old_bootdev ]; then
+- sfdisk -N$old_bootdev /dev/$DEV>> $LOGFILE 2>&1<<-EOF
+- ,,,-
+- EOF
++ if [ ! -z $old_bootdev ]; then
++ sfdisk_loop "disable old bootdev" ",,,-\n"
"-N$old_bootdev"
+ post_partition
+ fi
+ unset old_bootdev
+ # toggle the new boot partition bootable
+ pre_partition
+- sfdisk -N$LOGICAL_BOOT /dev/$DEV>> $LOGFILE 2>&1<<-EOF
+- ,,,*
+- EOF
++ sfdisk_loop "enable new bootdev" ",,,*\n" "-N$LOGICAL_BOOT"
+ post_partition
+ if [ $IMAGE_TYPE = "liveimg" ]; then
+ ROOTDEV=/dev/${DEV}${PART_PREFIX}$(($LOGICAL_BOOT+1))
+@@ -498,9 +519,9 @@
+ fi
+ pre_partition
+ if [ $IMAGE_TYPE = "liveimg" ]; then
+- sfdisk -c /dev/$DEV $(($LOGICAL_BOOT+2)) 82
++ sfdisk_loop "liveimg, swap" "" "-c
$(($LOGICAL_BOOT+2)) 82"
+ elif [ $IMAGE_TYPE = "nandfs" ]; then
+- sfdisk -c /dev/$DEV $(($LOGICAL_BOOT+1)) 82
++ sfdisk_loop "nandfs, swap" "" "-c
$(($LOGICAL_BOOT+1)) 82"
+ fi
+ post_partition
+ else
++++++ installer-shell.yaml
--- installer-shell.yaml
+++ installer-shell.yaml
@@ -11,6 +11,8 @@
Patches:
- add-more-check-for-imagetype.patch
- installer-shell-fix-mtab.patch
+ - installer-shell-fix-partitioning-failed.patch
+ - workaround-for-creating-btrfs-fs.patch
Description: |
A shell-script based installer which implements the
installation process in silent mode
Requires:
++++++ workaround-for-creating-btrfs-fs.patch (new)
--- workaround-for-creating-btrfs-fs.patch
+++ workaround-for-creating-btrfs-fs.patch
+diff -Naur a/installer-shell b/installer-shell
+--- a/installer-shell 2011-06-27 14:54:26.914970000 +0800
++++ b/installer-shell 2011-06-27 16:29:20.204970001 +0800
+@@ -565,7 +565,18 @@
+ if [ -n $ROOTDEV ]; then
+ persistent_umount $ROOTDEV
+ output "Creating filesystem on $ROOTDEV: btrfs"
++ # workaround of btrfs issue
++ for tmp_dev in $(cat /proc/mounts |grep "^/dev/" |awk
'{print $1}'); do
++ if [ ! -e $tmp_dev ]; then
++ dbglg_exec "touch $tmp_dev"
++ tmp_dev_list="$tmp_dev_list $tmp_dev"
++ fi
++ done
+ dbglg_exec "$FORMATROOT $ROOTDEV"
++ for tmp_dev in $tmp_dev_list; do
++ dbglg_exec "rm -rf $tmp_dev"
++ done
++ unset tmp_dev tmp_dev_list
+ else
+ fail_exit "No root device"
+ fi
_______________________________________________
MeeGo-commits mailing list
[email protected]
http://lists.meego.com/listinfo/meego-commits