Merge lp:~sergiusens/touch-preview-images/phablet-build-scripts into lp:touch-preview-images/phablet-build-scripts

Proposed by Sergio Schvezov
Status: Merged
Approved by: Ricardo Salveti
Approved revision: no longer in the source branch.
Merged at revision: 15
Proposed branch: lp:~sergiusens/touch-preview-images/phablet-build-scripts
Merge into: lp:touch-preview-images/phablet-build-scripts
Diff against target: 113 lines (+60/-28)
2 files modified
META-INF/com/google/android/updater-script (+4/-28)
ubuntu_data (+56/-0)
To merge this branch: bzr merge lp:~sergiusens/touch-preview-images/phablet-build-scripts
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Review via email: mp+163572@code.launchpad.net

Description of the change

Moved the image installation to a script to be more versatile.
Allow storing home and network settings when flashing a new image.

This initial changeset makes it inline to not affect current build system configurations.

To post a comment you must log in.
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

8 +package_extract_file("ubuntu_deploy.sh", "/tmp/ubuntu_deploy.sh");
9 +set_perm(0, 0, 0777, "/tmp/ubuntu_deploy.sh");

Do we really have /tmp/ access at recovery? Never tested, downloading the tarball to test.

55 +cat > ${WORKDIR}/ubuntu_deploy.sh << 'EOF'
56 +#!/sbin/sh

Any reason for it not to be a separated script? If separated, also make sure to add a header with copyright and such.

61 +phablet_home_bak=/data/phablet_home
+network_settings_bak=/data/nm_connections

I'd prefer to use a common directory for backups, like /data/ubuntu_bak or similar, so we know where to find the files in case of a failure when flashing the image.

Rest looks fine, creating an image to test it.

review: Needs Information
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

> 8 +package_extract_file("ubuntu_deploy.sh", "/tmp/ubuntu_deploy.sh");
> 9 +set_perm(0, 0, 0777, "/tmp/ubuntu_deploy.sh");

We do have access to this, look at the system zip and the backup tool.

> Do we really have /tmp/ access at recovery? Never tested, downloading the
> tarball to test.
>
> 55 +cat > ${WORKDIR}/ubuntu_deploy.sh << 'EOF'
> 56 +#!/sbin/sh
>
> Any reason for it not to be a separated script? If separated, also make sure
> to add a header with copyright and such.

As per the description, I didn't want to interfere with the build system and add yet another parameter.

> 61 +phablet_home_bak=/data/phablet_home
> +network_settings_bak=/data/nm_connections
>
> I'd prefer to use a common directory for backups, like /data/ubuntu_bak or
> similar, so we know where to find the files in case of a failure when flashing
> the image.

Will do this.

> Rest looks fine, creating an image to test it.

Great, works nice from what I tried :-)

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good, thanks!

review: Approve
15. By Sergio Schvezov

Moved the image installation to a script to be more versatile. Allow storing home and network settings when flashing a new image.

This initial changeset makes it inline to not affect current build system configurations.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'META-INF/com/google/android/updater-script'
--- META-INF/com/google/android/updater-script 2013-05-10 16:37:41 +0000
+++ META-INF/com/google/android/updater-script 2013-05-13 22:04:23 +0000
@@ -10,38 +10,14 @@
1010
11ui_print("Copying the ubuntu rootfs tarball...");11ui_print("Copying the ubuntu rootfs tarball...");
12package_extract_file("#UBUNTUROOTFS#", "/data/ubuntu-rootfs.tar.gz");12package_extract_file("#UBUNTUROOTFS#", "/data/ubuntu-rootfs.tar.gz");
13package_extract_file("ubuntu_deploy.sh", "/tmp/ubuntu_deploy.sh");
14set_perm(0, 0, 0777, "/tmp/ubuntu_deploy.sh");
13set_progress(0.300000);15set_progress(0.300000);
1416
15ui_print("Extracting the ubuntu rootfs tarball...");17ui_print("Deploying Ubuntu Touch...");
16delete_recursive("/data/ubuntu_tmp_extract");18run_program("/tmp/ubuntu_deploy.sh");
17run_program("/sbin/mkdir", "/data/ubuntu_tmp_extract");
18run_program("/sbin/tar", "--numeric-owner", "-xzf", "/data/ubuntu-rootfs.tar.gz", "-C", "/data/ubuntu_tmp_extract");
19set_progress(0.600000);
20
21ui_print("Saving phablet home...");
22run_program("/sbin/mv", "/data/ubuntu/home/phablet", "/data/phablet_home");
23ui_print("Saving network settings...");
24run_program("/sbin/mv", "/data/ubuntu/etc/NetworkManager/system-connections", "/data/nm_connections");
25set_progress(0.700000);
26
27ui_print("Setting up the new ubuntu rootfs...");
28delete_recursive("/data/ubuntu");
29run_program("/sbin/mv", "/data/ubuntu_tmp_extract/binary", "/data/ubuntu");
30set_progress(0.800000);19set_progress(0.800000);
3120
32ui_print("Restoring phablet home...");
33delete_recursive("/data/ubuntu/home/phablet");
34run_program("/sbin/mv", "/data/phablet_home", "/data/ubuntu/home/phablet");
35ui_print("Restoring network settings...");
36delete_recursive("/data/ubuntu/etc/NetworkManager/system-connections");
37run_program("/sbin/mv", "/data/nm_connections", "/data/ubuntu/etc/NetworkManager/system-connections");
38set_progress(0.850000);
39
40ui_print("Cleaning up");
41delete("/data/ubuntu-rootfs.tar.gz");
42delete_recursive("/data/ubuntu_tmp_extract");
43set_progress(0.900000);
44
45unmount("/data");21unmount("/data");
46run_program("/sbin/sync");22run_program("/sbin/sync");
47set_progress(1.000000);23set_progress(1.000000);
4824
=== modified file 'ubuntu_data'
--- ubuntu_data 2013-05-01 05:48:50 +0000
+++ ubuntu_data 2013-05-13 22:04:23 +0000
@@ -61,6 +61,62 @@
61cp -av ${ROOTFS} ${WORKDIR}61cp -av ${ROOTFS} ${WORKDIR}
62IMAGE=$(basename $ROOTFS)62IMAGE=$(basename $ROOTFS)
63sed -i "s/#UBUNTUROOTFS#/$IMAGE/" ${WORKDIR}/META-INF/com/google/android/updater-script63sed -i "s/#UBUNTUROOTFS#/$IMAGE/" ${WORKDIR}/META-INF/com/google/android/updater-script
64cat > ${WORKDIR}/ubuntu_deploy.sh << 'EOF'
65#!/sbin/sh
66
67ubuntu=/data/ubuntu
68ubuntu_bak=/data/ubuntu_bak
69
70phablet_home=$ubuntu/home/phablet
71phablet_home_bak=$ubuntu_bak/home
72
73network_settings=$ubuntu/etc/NetworkManager/system-connections
74network_settings_bak=$ubuntu_bak/nm_connections
75
76tmp_extract=/data/ubuntu_tmp_extract
77
78backup() {
79 mkdir -p $ubuntu_bak
80 if [ -d $2 ]; then
81 echo "Removing previous backout of $1"
82 rm -rf $2
83 fi
84 if [ -d $1 ]; then
85 echo "Backing up $1 to $2"
86 mv $1 $2
87 fi
88}
89
90restore() {
91 if [ -d $2 ]; then
92 echo "Restoring $1 from $2"
93 rm -rf $1
94 mv $2 $1
95 fi
96}
97
98deploy_ubuntu() {
99 echo "Deploying Ubuntu"
100 if [ -d $tmp_extract ]; then
101 rm -rf $tmp_extract
102 fi
103 mkdir $tmp_extract
104 tar --numeric-owner -xzf /data/ubuntu-rootfs.tar.gz -C $tmp_extract
105 rm /data/ubuntu-rootfs.tar.gz
106 if [ -d $ubuntu ]; then
107 rm -rf $ubuntu
108 fi
109 mv $tmp_extract/binary $ubuntu
110 rm -rf $tmp_extract
111}
112
113backup $phablet_home $phablet_home_bak
114backup $network_settings $network_settings_bak
115deploy_ubuntu
116restore $phablet_home $phablet_home_bak
117restore $network_settings $network_settings_bak
118EOF
119
64120
65# Create and publish the update zip file121# Create and publish the update zip file
66cd ${WORKDIR}122cd ${WORKDIR}

Subscribers

People subscribed via source and target branches