Hello community,

here is the log from the commit of package growpart for openSUSE:Factory 
checked in at 2018-01-25 12:41:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/growpart (Old)
 and      /work/SRC/openSUSE:Factory/.growpart.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "growpart"

Thu Jan 25 12:41:01 2018 rev:4 rq:569385 version:unknown

Changes:
--------
--- /work/SRC/openSUSE:Factory/growpart/growpart.changes        2016-09-21 
18:50:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.growpart.new/growpart.changes   2018-01-25 
12:41:09.660925644 +0100
@@ -1,0 +2,16 @@
+Wed Jan 24 17:15:46 UTC 2018 - rjsch...@suse.com
+
+- Split rootgrow and script and service into subpackage to retain
+  dependency chain for growpart
+
+-------------------------------------------------------------------
+Mon Jan 22 21:12:33 UTC 2018 - rjsch...@suse.com
+
+- Update to version 0.30 (bsc#1064755)
+  + improved error messages on failure.
+  + ignore sfdisk failure in 2.28.1 when due to reread failing
+   (LP: #1619285)
+  + Add service file to start growpart via systemd
+  + Add rootgrow script to wrap growpart
+
+-------------------------------------------------------------------

Old:
----
  cloud-utils-0.29.tar.gz

New:
----
  cloud-utils-0.30.tar.gz
  rootgrow
  rootgrow.service

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ growpart.spec ++++++
--- /var/tmp/diff_new_pack.Vxys9c/_old  2018-01-25 12:41:12.292802771 +0100
+++ /var/tmp/diff_new_pack.Vxys9c/_new  2018-01-25 12:41:12.292802771 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package growpart
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,20 @@
 #
 
 
+%define base_version 0.30
 Name:           growpart
-Version:        0.29
+Version:        %{base_version}
 Release:        0
 Summary:        Grow a partition
 License:        GPL-3.0
 Group:          System/Management
 Url:            http://launchpad.net/cloud-utils
-Source0:        cloud-utils-%{version}.tar.gz
+Source0:        cloud-utils-%{base_version}.tar.gz
+Source1:        rootgrow
+Source2:        rootgrow.service
 Patch:          licenseGPLv3.patch
 Requires:       util-linux
-%if 0%{?suse_version} && 0%{?suse_version} >= 1220
+%if 0%{?suse_version} && 0%{?suse_version} > 1220
 Requires:       gptfdisk
 %endif
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -37,17 +40,40 @@
 is started with a larger root partition than the image size. The root
 partition can be expanded to take up the additional size.
 
+%if 0%{?suse_version} && 0%{?suse_version} > 1220
+%package rootgrow
+Version:        1.0.0
+Release:        0
+Summary:        Resize root partition
+Group:          System/Management
+Requires:       growpart
+Requires:       python3
+Requires:       systemd
+# pkg-config is needed to find correct systemd unit dir
+BuildRequires:  pkg-config
+BuildRequires:  systemd
+
+%description rootgrow
+Provides as script and service togrow the root partition
+%endif
+
 %prep
-%setup -q -n cloud-utils-%{version}
+%setup -q -n cloud-utils-%{base_version}
 %patch -p1
 
 %build
 
 %install
-mkdir -p %{buildroot}/%{_sbindir}
 mkdir -p %{buildroot}/%{_mandir}/man1
+mkdir -p %{buildroot}/%{_sbindir}
 cp bin/growpart %{buildroot}/%{_sbindir}
 cp man/growpart.1 %{buildroot}/%{_mandir}/man1
+%if 0%{?suse_version} && 0%{?suse_version} > 1220
+mkdir -p %{buildroot}/usr/lib/systemd/system
+cp %SOURCE1 %{buildroot}/%{_sbindir}
+cp %SOURCE2 %{buildroot}/usr/lib/systemd/system
+chmod 755 %{buildroot}/%{_sbindir}/rootgrow
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -58,4 +84,11 @@
 %{_sbindir}/growpart
 %{_mandir}/man1/*
 
+%if 0%{?suse_version} && 0%{?suse_version} > 1220
+%files rootgrow
+%defattr(-,root,root,-)
+%{_sbindir}/rootgrow
+/usr/lib/systemd/system/rootgrow.service
+%endif
+
 %changelog

++++++ cloud-utils-0.29.tar.gz -> cloud-utils-0.30.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/README 
new/cloud-utils-0.30/.bzr/README
--- old/cloud-utils-0.29/.bzr/README    2016-06-06 19:02:19.000000000 +0200
+++ new/cloud-utils-0.30/.bzr/README    1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-This is a Bazaar control directory.
-Do not change any files in this directory.
-See http://bazaar.canonical.com/ for more information about Bazaar.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/branch/branch.conf 
new/cloud-utils-0.30/.bzr/branch/branch.conf
--- old/cloud-utils-0.29/.bzr/branch/branch.conf        2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/.bzr/branch/branch.conf        1970-01-01 
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-parent_location = ../../../home/smoser/src/cloud-utils/trunk/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/branch/format 
new/cloud-utils-0.30/.bzr/branch/format
--- old/cloud-utils-0.29/.bzr/branch/format     2016-06-06 19:02:20.000000000 
+0200
+++ new/cloud-utils-0.30/.bzr/branch/format     1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-Bazaar Branch Format 7 (needs bzr 1.6)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/branch/last-revision 
new/cloud-utils-0.30/.bzr/branch/last-revision
--- old/cloud-utils-0.29/.bzr/branch/last-revision      2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/.bzr/branch/last-revision      1970-01-01 
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-293 smo...@ubuntu.com-20160606170018-rg1wgrczt02o39f6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/branch/tags 
new/cloud-utils-0.30/.bzr/branch/tags
--- old/cloud-utils-0.29/.bzr/branch/tags       2016-06-06 19:02:20.000000000 
+0200
+++ new/cloud-utils-0.30/.bzr/branch/tags       1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-d3:0.155:james.wes...@ubuntu.com-20080912153032-p0b4kdzp8u8wctey13:0.10-0ubuntu145:kirkland@x200-20100326045405-pc1t89jpdcxussln13:0.11-0ubuntu149:smo...@ubuntu.com-20100409140405-2ua71w2bz9khx9t111:0.12ubuntu149:smo...@ubuntu.com-20100618062923-a4el5x56jmh3ug2711:0.13ubuntu149:smo...@ubuntu.com-20100625004151-dt3wp88qlpktthli13:0.14-0ubuntu145:kirkland@x200-20100722132546-l5kounq90l57dbp411:0.15ubuntu149:smo...@ubuntu.com-20100805194727-s9w0ylrstycisk7j11:0.16ubuntu149:smo...@ubuntu.com-20100924141228-j8001mvtb2cdfjru11:0.17ubuntu149:smo...@ubuntu.com-20110111144034-u94qrdv3g4vsyyk811:0.18ubuntu149:smo...@ubuntu.com-20110112005039-jj5749p2wwjfxfd311:0.19ubuntu149:smo...@ubuntu.com-20110113185652-9bqigqbu0ltonc9910:0.1ubuntu155:james.wes...@ubuntu.com-20100205183757-2w2dspl8v0a8irus3:0.255:james.wes...@ubuntu.com-20100208101812-j5qi1kb2e22703si11:0.20ubuntu149:smo...@ubuntu.com-20110219061742-xzityl1t4jelz2xl11:0.21ubuntu149:smo...@ubuntu.com-20110225175452-tqqt6vsechrj1dmw11:0.22ubuntu149:smo...@ubuntu.com-20110715161434-zy9vzet2hh1s0w3311:0.22ubuntu249:smo...@ubuntu.com-20110727013034-wilebe23lu7zgttl4:0.2349:smo...@ubuntu.com-20110727020454-wpvtl2gn6avs0tif13:0.23-0ubuntu149:smo...@ubuntu.com-20110727021554-zqpqup0yqzv57pt04:0.2449:smo...@ubuntu.com-20111027182005-1b9vrbk0j88w3slq4:0.2549:smo...@ubuntu.com-20120210175813-p1fnk3sqllw51vch4:0.2649:smo...@ubuntu.com-20121001185221-lt0oc4nfs1g6hde64:0.2749:smo...@ubuntu.com-20130327131052-e3gwddeygf1azbgi4:0.2849:smo...@ubuntu.com-20160511133920-onwyb2sg3d5saiwo4:0.2949:smo...@ubuntu.com-20160606170018-rg1wgrczt02o39f610:0.2ubuntu245:kirkland@x200-20100218030014-25krho44dacjas0f3:0.355:james.wes...@ubuntu.com-20090115114908-no0qr3y6mn653lpp5:0.3.155:james.wes...@ubuntu.com-20090126104052-tvs7xk1zlm1qzvgr5:0.3.255:james.wes...@ubuntu.com-20090204093208-88araxix921fcy0m5:0.3.355:james.wes...@ubuntu.com-20090209103556-ew7m60i0hagqrdxt12:0.3.3ubuntu155:james.wes...@ubuntu.com-20090220092254-u02tegejolfsyiix13:0.3.3ubuntu1055:james.wes...@ubuntu.com-20090401084805-laf6e7oogt0zrdxf13:0.3.3ubuntu1155:james.wes...@ubuntu.com-20090401135843-vkjmfi6x03xj08ol13:0.3.3ubuntu1255:james.wes...@ubuntu.com-20090407081407-476bp8crdcmypv8q12:0.3.3ubuntu255:james.wes...@ubuntu.com-20090224140237-wg21w0qrb5qdlewp12:0.3.3ubuntu455:james.wes...@ubuntu.com-20090304083301-p5hlzqrjnsz3xkze12:0.3.3ubuntu555:james.wes...@ubuntu.com-20090316085449-dlpspii1g3o54cxl12:0.3.3ubuntu655:james.wes...@ubuntu.com-20090319205259-8f5eth8drcy8tcgq12:0.3.3ubuntu755:james.wes...@ubuntu.com-20090322171416-y6olpjdmt6tgp4nk12:0.3.3ubuntu855:james.wes...@ubuntu.com-20090331093713-clyjotl5i1qf108c12:0.3.3ubuntu955:james.wes...@ubuntu.com-20090331151555-jfp74rl16rj1rpu012:0.3.4ubuntu151:so...@canonical.com-20090407071407-b19evof3t75wi5m312:0.3.4ubuntu251:so...@canonical.com-20090407071407-0i0xmcy03scc9fk512:0.3.4ubuntu351:so...@canonical.com-20090505075954-zhj1hw563p6tiz0312:0.3.4ubuntu451:so...@canonical.com-20090513124135-uo7r0vofjxwipqf312:0.3.4ubuntu551:so...@canonical.com-20090514101149-2ba8zxob7390yqxy12:0.3.4ubuntu651:so...@canonical.com-20090528040431-q5fjv3gggecbjvpt12:0.3.4ubuntu755:james.wes...@ubuntu.com-20090710234727-u78t6h1hejy5yp3912:0.3.4ubuntu855:james.wes...@ubuntu.com-20090711023543-1wc33n0lpyn93pfu12:0.3.4ubuntu955:james.wes...@ubuntu.com-20090711095031-7k08ab2pcvv98ajh10:0.3ubuntu155:james.wes...@ubuntu.com-20100217210056-i9ejlqrsyf95qrl312:0.4-0ubuntu155:james.wes...@ubuntu.com-20100218150439-610acsrpjtw6q4w812:0.5-0ubuntu145:kirkland@x200-20100219045843-exx2c9sv2b0oa66v5:0.5.045:smoser@nelson-20100108024318-a5junl1e14w9609q5:0.5.149:smo...@ubuntu.com-20100122213302-kljxgyhd3c651bn06:0.5.1049:smo...@ubuntu.com-20100326045540-ryc332yue5nqw04415:0.5.10-0ubuntu155:james.wes...@ubuntu.com-20100326005728-gxtc05k7uxfh6tak6:0.5.1149:smo...@ubuntu.com-20100618044901-rqdffytij70thx3k15:0.5.11-0ubuntu149:smo...@ubuntu.com-20100618063343-rosbfz2rlwguz3k915:0.5.11-0ubuntu249:smo...@ubuntu.com-20100618165717-l62j9q6rhmga8l8s6:0.5.1249:smo...@ubuntu.com-20100618194159-d9opbsduiopbx7w615:0.5.12-0ubuntu149:smo...@ubuntu.com-20100618195457-x79ojjbf96zzq6zc15:0.5.12-0ubuntu249:smo...@ubuntu.com-20100623141210-dpuxyedtpc652gff15:0.5.12-0ubuntu349:smo...@ubuntu.com-20100702022548-klafdi60d9ieb0nl6:0.5.1349:smo...@ubuntu.com-20100721154925-n12wm4wb7o070rb26:0.5.1449:smo...@ubuntu.com-20100812183625-asyroew8zgntivil6:0.5.1549:smo...@ubuntu.com-20100911192048-u2yc5qlap0ivlxoy10:0.5.16pre149:smo...@ubuntu.com-20110125054112-632x3wh30mog81j05:0.5.249:smo...@ubuntu.com-20100129182817-j82vdv1agj3aumvb5:0.5.349:smo...@ubuntu.com-20100204175711-71jurkd9ermomukd14:0.5.3-0ubuntu155:james.wes...@ubuntu.com-20100204030005-49ceaveyurbclc0b14:0.5.3-0ubuntu255:james.wes...@ubuntu.com-20100205154821-ek3as66wmpv8yivd5:0.5.449:smo...@ubuntu.com-20100217135629-pgusncj0bzzmso1u14:0.5.4-0ubuntu155:james.wes...@ubuntu.com-20100217094030-ertnrbrcvnxf9cew5:0.5.549:smo...@ubuntu.com-20100218004255-v628ek5te5z11dn614:0.5.5-0ubuntu155:james.wes...@ubuntu.com-20100217194433-if6jt5lbhiy43aoi14:0.5.5-0ubuntu255:james.wes...@ubuntu.com-20100218130402-fjfsxu1a1381sol55:0.5.649:smo...@ubuntu.com-20100219072158-5e2t02dc8vxzlfeu14:0.5.7-0ubuntu155:james.wes...@ubuntu.com-20100219182745-rmkaspath2j9hzjc14:0.5.7-0ubuntu255:james.wes...@ubuntu.com-20100219210210-snlddx892ackzvm614:0.5.7-0ubuntu355:james.wes...@ubuntu.com-20100225162210-lhqjgw1mcb46evk514:0.5.7-0ubuntu455:james.wes...@ubuntu.com-20100226170605-0qbkuc0orv187efe5:0.5.849:smo...@ubuntu.com-20100302200808-c6hq53fl20278kbb14:0.5.8-0ubuntu155:james.wes...@ubuntu.com-20100302154804-3g5zkp3l0na7x3105:0.5.949:smo...@ubuntu.com-20100308180515-c4qyytp5p5m7g2d114:0.5.9-0ubuntu155:james.wes...@ubuntu.com-20100308130702-cz0chxvmizm3350q12:0.6-0ubuntu145:kirkland@x200-20100224023246-pk9ocvv9f4lbh2we5:0.6.049:smo...@ubuntu.com-20110126221032-p4umbvvf7bhs7dvg5:0.6.149:smo...@ubuntu.com-20110219054232-0khn09ekhnbiarli5:0.6.249:smo...@ubuntu.com-20111028021057-x1zhos4t555pmm9e5:0.6.349:smo...@ubuntu.com-20120410202247-yrxqg1f2pp90pbxz12:0.7-0ubuntu145:kirkland@x200-20100225221942-udicmh50wl6okb3r12:0.8-0ubuntu149:smo...@ubuntu.com-20100303045327-tfhjcrlzeww4y8vh12:0.9-0ubuntu145:kirkland@x200-20100303055529-k39qzuapmm46t6hd18:trunk-karmic-merge49:smo...@ubuntu.com-20091214211741-wwq30h6vx89z9wle10:ubuntu-0.149:jam...@ubuntu.com-20081010182514-ar1ozo4lw424m1eg10:ubuntu-0.249:jam...@ubuntu.com-20090114005758-oslgamcs3fjq4c8d10:ubuntu-0.349:jam...@ubuntu.com-20090119185602-zu6j4lx0dz03j1n312:ubuntu-0.3.149:jam...@ubuntu.com-20090126182623-2pxl7eyjwq6xcttu12:ubuntu-0.3.249:jam...@ubuntu.com-20090204175400-8pals13mw98etvd712:ubuntu-0.3.349:jam...@ubuntu.com-20090209191209-m64fw4zqqxpt9f9419:ubuntu-0.3.3ubuntu149:jam...@ubuntu.com-20090220142738-a1jkvv6odm1mlfwb20:ubuntu-0.3.3ubuntu1049:jam...@ubuntu.com-20090406220448-p4hrwife689m9gh820:ubuntu-0.3.3ubuntu1149:jam...@ubuntu.com-20090406220449-h3cjlkv7mc5lpois20:ubuntu-0.3.3ubuntu1249:jam...@ubuntu.com-20090408170115-p7nlz6isc2ldsjdz19:ubuntu-0.3.3ubuntu249:jam...@ubuntu.com-20090224210631-7auwztcn2vue29q119:ubuntu-0.3.3ubuntu449:jam...@ubuntu.com-20090305160938-kfrrij3pw412gyo819:ubuntu-0.3.3ubuntu549:jam...@ubuntu.com-20090318201426-g08g482fudxxiw8q19:ubuntu-0.3.3ubuntu649:jam...@ubuntu.com-20090322233945-2donihv61as6v84119:ubuntu-0.3.3ubuntu749:jam...@ubuntu.com-20090322233946-c4n0ms7ie31wdmzc19:ubuntu-0.3.3ubuntu849:jam...@ubuntu.com-20090406220446-sx3s0gv4hur2vra319:ubuntu-0.3.3ubuntu949:jam...@ubuntu.com-20090406220447-oat2ke0bnbnljq5p15:upstream-0.5.1055:james.wes...@ubuntu.com-20100326005728-14siubk4zdbjzz8b15:upstream-0.5.1149:smo...@ubuntu.com-20100618045218-tsqcd3r3c8aoce6715:upstream-0.5.1249:smo...@ubuntu.com-20100618194813-1hk4vuin8w2zxypj14:upstream-0.5.355:james.wes...@ubuntu.com-20100204030005-r2y1568be8rbslxo14:upstream-0.5.455:james.wes...@ubuntu.com-20100217094030-e90qaf8ghr9x4buh14:upstream-0.5.755:james.wes...@ubuntu.com-20100219182745-he0siutbx2bdw7yr14:upstream-0.5.855:james.wes...@ubuntu.com-20100302154804-pj2zwjsj2x82g0ed14:upstream-0.5.955:james.wes...@ubuntu.com-20100308130702-n3chh5v8w3296q8ye
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/branch-format 
new/cloud-utils-0.30/.bzr/branch-format
--- old/cloud-utils-0.29/.bzr/branch-format     2016-06-06 19:02:19.000000000 
+0200
+++ new/cloud-utils-0.30/.bzr/branch-format     1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-Bazaar-NG meta directory, format 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/checkout/conflicts 
new/cloud-utils-0.30/.bzr/checkout/conflicts
--- old/cloud-utils-0.29/.bzr/checkout/conflicts        2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/.bzr/checkout/conflicts        1970-01-01 
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-BZR conflict list format 1
Binary files old/cloud-utils-0.29/.bzr/checkout/dirstate and 
new/cloud-utils-0.30/.bzr/checkout/dirstate differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/checkout/format 
new/cloud-utils-0.30/.bzr/checkout/format
--- old/cloud-utils-0.29/.bzr/checkout/format   2016-06-06 19:02:20.000000000 
+0200
+++ new/cloud-utils-0.30/.bzr/checkout/format   1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-Bazaar Working Tree Format 6 (bzr 1.14)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/.bzr/repository/format 
new/cloud-utils-0.30/.bzr/repository/format
--- old/cloud-utils-0.29/.bzr/repository/format 2016-06-06 19:02:19.000000000 
+0200
+++ new/cloud-utils-0.30/.bzr/repository/format 1970-01-01 01:00:00.000000000 
+0100
@@ -1 +0,0 @@
-Bazaar repository format 2a (needs bzr 1.16 or later)
Binary files 
old/cloud-utils-0.29/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.cix
 and 
new/cloud-utils-0.30/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.cix
 differ
Binary files 
old/cloud-utils-0.29/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.iix
 and 
new/cloud-utils-0.30/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.iix
 differ
Binary files 
old/cloud-utils-0.29/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.rix
 and 
new/cloud-utils-0.30/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.rix
 differ
Binary files 
old/cloud-utils-0.29/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.six
 and 
new/cloud-utils-0.30/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.six
 differ
Binary files 
old/cloud-utils-0.29/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.tix
 and 
new/cloud-utils-0.30/.bzr/repository/indices/90eb32c37a5652d2c7682e08643f9709.tix
 differ
Binary files old/cloud-utils-0.29/.bzr/repository/pack-names and 
new/cloud-utils-0.30/.bzr/repository/pack-names differ
Binary files 
old/cloud-utils-0.29/.bzr/repository/packs/90eb32c37a5652d2c7682e08643f9709.pack
 and 
new/cloud-utils-0.30/.bzr/repository/packs/90eb32c37a5652d2c7682e08643f9709.pack
 differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/ChangeLog 
new/cloud-utils-0.30/ChangeLog
--- old/cloud-utils-0.29/ChangeLog      2016-06-06 19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/ChangeLog      2017-01-13 17:05:42.000000000 +0100
@@ -1,3 +1,16 @@
+0.30
+ - ubuntu-cloudimg-query: fix xenial default to be ebs-ssd
+    as traditional ebs are no longer available. (LP: #1593451)
+ - mount-image-callback: fix shortopt parsing (LP: #1604011)
+ - growpart: improved error messages on failure.
+ - mount-image-callback: add -S short flag for --system-mounts
+ - growpart: ignore sfdisk failure in 2.28.1 when due to reread failing
+   (LP: #1619285)
+ - mount-image-callback: support 'overlay' filesystem type rather
+   than ubuntu specific 'overlayfs' (LP: #1493188)
+ - mount-image-callback: support 'chroot' to lxd containers and
+   correctly apply user namespace change.
+
 0.29
  - cloud-localds: fix creation of vfat filesystems (LP: #1431537)
    [Kamal Mostafa]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/bin/growpart 
new/cloud-utils-0.30/bin/growpart
--- old/cloud-utils-0.29/bin/growpart   2016-06-06 19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/bin/growpart   2017-01-13 17:05:42.000000000 +0100
@@ -63,9 +63,9 @@
        if [ -n "${RESTORE_FUNC}" ]; then
                error "***** WARNING: Resize failed, attempting to revert 
******"
                if ${RESTORE_FUNC} ; then
-                       error "***** Appears to have gone OK ****"
+                       error "***** Restore appears to have gone OK ****"
                else
-                       error "***** FAILED! ******"
+                       error "***** Restore FAILED! ******"
                        if [ -n "${RESTORE_HUMAN}" -a -f "${RESTORE_HUMAN}" ]; 
then
                                error "**** original table looked like: ****"
                                cat "${RESTORE_HUMAN}" 1>&2
@@ -164,9 +164,16 @@
        # exit code found was just 1, but dont insist on that
        #[ $ret -eq 1 ] || return 1
        # Successfully wrote the new partition table
-       grep -qi "Success.* wrote.* new.* partition" "$output" &&
+       if grep -qi "Success.* wrote.* new.* partition" "$output"; then
                grep -qi "BLKRRPART: Device or resource busy" "$output"
-       return
+               return
+       # The partition table has been altered.
+       elif grep -qi "The.* part.* table.* has.* been.* altered" "$output"; 
then
+               # Re-reading the partition table failed
+               grep -qi "Re-reading.* partition.* table.* failed" "$output"
+               return
+       fi
+       return $ret
 }
 
 get_sfdisk_version() {
@@ -337,7 +344,10 @@
        [ $ret -eq 0 ] || RESTORE_FUNC="${restore_func}"
 
        if [ $ret -eq 0 ]; then
-               :
+               debug 1 "resize of ${DISK} returned 0."
+               if [ $VERBOSITY -gt 2 ]; then
+                       sed 's,^,| ,' "${change_out}" 1>&2
+               fi
        elif $PT_UPDATE &&
                sfdisk_worked_but_blkrrpart_failed "$ret" "${change_out}"; then
                # if the command failed, but it looks like only because
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/bin/mount-image-callback 
new/cloud-utils-0.30/bin/mount-image-callback
--- old/cloud-utils-0.29/bin/mount-image-callback       2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/bin/mount-image-callback       2017-01-13 
17:05:42.000000000 +0100
@@ -4,6 +4,8 @@
 TEMP_D=""
 UMOUNTS=( )
 QEMU_DISCONNECT=""
+CR=$'\n'
+TAB=$'\t'
 
 error() { echo "$@" 1>&2; }
 
@@ -14,6 +16,10 @@
    mount a file to a temporary mount point and then
    invoke the provided cmd with args
 
+   supported 'file' are:
+      lxd:name  : the rootfs for lxd container 'name'
+      file      : any disk format supported by qemu-nbd
+
    the temporary mountpoint will be put in an a environment variable
    named MOUNTPOINT.
 
@@ -21,6 +27,10 @@
    they will be replaced with the mount point. Example:
       ${0##*/} my.img chroot _MOUNTPOINT_ /bin/sh
 
+   Additionally, the helper program 'mchroot' will be added to the path
+   and can be used effectively as 'chroot _MOUNTPOINT_':
+      ${0##*/} my.img mchroot
+
    options:
     -v | --verbose             increase verbosity
          --read-only           use read-only mount.
@@ -65,6 +75,7 @@
 disconnect_qemu() {
        [ -n "$QEMU_DISCONNECT" ] || return 0
        local out="" nbd="$QEMU_DISCONNECT"
+       debug 1 "disconnecting $nbd"
        local pid="" pfile="/sys/block/${nbd#/dev/}/pid"
        { read pid < "$pfile" ; } >/dev/null 2>&1
        [ -n "$pid" -a ! -d "/proc/$pid" ] && 
@@ -78,8 +89,10 @@
 }
 
 do_umounts() {
-       local um="" fails=0 mydir="$PWD/"
-       for um in "$@"; do
+       local um="" fails=0 mydir="$PWD/" mounts="" i=0
+       mounts=( "$@" )
+       for((i=${#mounts[@]}-1;i>=0;i--)); do
+               um=${mounts[$i]}
                um=$(readlink -f "$um") || {
                        error "WARNING: failed to get full path to '$um'";
                        fails=$(($fails+1))
@@ -123,9 +136,8 @@
 
 get_partition() {
        # return in _RET the 'auto' partition for a image.
-       # return partition number for a partitioned image
-       # return 0 for unpartitioned
-       # return 0 if image is partitioned, 1 if not
+       # _RET=partition number for a partitioned image
+       # _RET=0 for unpartitioned
        local img="$1"
        out=$(LANG=C sfdisk --list -uS "$img" 2>&1) || {
                error "failed determining if partitioned: $out";
@@ -138,13 +150,216 @@
        fi
 }
 
+add_bin() {
+       cat > "$1" || { error "failed to write to $1"; return 1; }
+       chmod 755 "$1" || { error "failed to set perms on $1"; return 1; }
+}
+
+add_helpers() {
+       local d="$1"
+       local umap="$1" gmap="$2"
+       [ -d "$1" ] || mkdir -p "$1"
+       add_bin "$d/uns-switch" <<"EOF" || return 1
+#!/bin/sh
+[ $# -eq 0 ] && set -- ${SHELL:-/bin/bash}
+if [ -z "$MIC_SUBUID" -a -z "$MIC_SUBGID" ]; then
+       exec "$@"
+fi
+exec lxc-usernsexec ${MIC_SUBUID:+-m u:0:${MIC_SUBUID}} \
+       ${MIC_SUBGID:+-m g:0:${MIC_SUBGID}} -- "$@"
+EOF
+       add_bin "$d/mchroot" <<"EOF" || return 1
+#!/bin/sh
+exec uns-switch chroot "$MOUNTPOINT" "$@"
+EOF
+       return
+}
+
+get_subid() {
+       local id="$1" file="$2"
+       awk -F: '$1 == id { printf("%s:%s\n", $2, $3); exit(0); }' \
+               id="$id" "$file"
+}
+
+set_subids() {
+       local id="$1" out="" muid="" mgid=""
+       [ -z "$id" ] && return 0
+       muid=$(get_subid "$id" /etc/subuid) &&
+               mgid=$(get_subid "$id" /etc/subgid) &&
+               [ -n "$muid" -a -n "$mgid" ] &&
+               export MIC_SUBGID="$muid" MIC_SUBUID="$mgid" && return
+}
+
+mount_overlay() {
+       local lower="$1" upper="$2" workdir="$3"
+       local olayopts="lowerdir=$lower,upperdir=$upper"
+       # 3.18+ require 'workdir=' option.
+       case "$(uname -r)" in
+               2*|3.1[01234567]*|3.[0-9].*) :;;
+               *) olayopts="${olayopts},workdir=$workdir"
+                       mkdir -p "$workdir" ||
+                               { _ERR="Failed to create workdir '$workdir'"; 
return 1; }
+                       ;;
+       esac
+
+       local cmd="" fstype="" ret="" out="" fsfile="/proc/filesystems"
+       _ERR=""
+       for fstype in overlay overlayfs; do
+               cmd=( mount -t "$fstype" -o "$olayopts" "$lower" "$upper" )
+               debug 2 "attempting '$fstype' mount with: ${cmd[*]}"
+               out=$("${cmd[@]}" 2>&1)
+               ret=$?
+               if [ $ret -eq 0 ]; then
+                       debug 1 "mounted '$fstype' via $fstype: ${cmd[*]}"
+                       return 0
+               fi
+               _ERR="${_ERR}Failed [$ret]: ${cmd[*]}:${CR}"
+               _ERR="${_ERR}$out${CR}"
+               if [ -r "$fsfile" ] && grep -q "${TAB}${fstype}$" "$fsfile"; 
then
+                       # this failed and we have support in kernel. do not try 
further.
+                       return $ret
+               fi
+       done
+       return $ret
+}
+
+assert_nbd_support() {
+       if [ ! -e /sys/block/nbd0 ] && ! grep -q nbd /proc/modules; then
+               debug 1 "trying to load nbd module"
+               modprobe nbd >/dev/null 2>&1
+               udevadm settle >/dev/null 2>&1
+       fi
+       [ -e /sys/block/nbd0 ] || {
+               error "Cannot use nbd: no nbd kernel support."
+               return 1;
+       }
+}
+
+find_unused_nbd() {
+       # return a path to an unused nbd device (/dev/nbd?)
+       local f roflag=""
+       for f in /sys/block/nbd*; do
+               [ -d "$f" -a ! -f "$f/pid" ] &&
+                       { _RET="/dev/${f##*/}"; return 0; }
+       done
+       error "failed to find an nbd device"
+       return 1;
+}
+
+connect_nbd() {
+       local img="$1" fmt="$2" ptnum="${3:-auto}" rwmode="${3:-ro}"
+       local nbd="" pidfile="" pid="" cmd="" ret="" roflag="" nptnum="" i=""
+       if [ "$rwmode" = "ro" ]; then
+               roflag="--read-only"
+       fi
+       # yes, there is a race condition here.
+       find_unused_nbd || return
+       nbd="$_RET"
+       cmd=( qemu-nbd $roflag "--format=$fmt" --connect "$nbd" "$img" )
+       "${cmd[@]}" && QEMU_DISCONNECT="$nbd"
+       ret=$?
+       if [ $ret -ne 0 ]; then
+               error "Failed [$ret]: $*"
+               return $ret
+       fi
+       pidfile="/sys/block/${nbd#/dev/}/pid"
+       if [ ! -f "$pidfile" ]; then
+               debug 1 "waiting on pidfile for $nbd in $pidfile"
+               i=0
+               while [ ! -f "$pidfile" ] && i=$(($i+1)); do
+                       if [ $i -eq 200 ]; then
+                               error "giving up on pidfile $pidfile for $nbd"
+                               disconnect_qemu
+                               return 1
+                       fi
+                       sleep .1
+                       debug 2 "."
+               done
+       fi
+       read pid < "$pidfile" && debug 2 "pid for $nbd is $pidfile" || {
+               error "reading pid from $pidfile for $nbd failed!";
+               disconnect_qemu
+               return 1
+       }
+
+       debug 1 "connected $img_in ($fmt) ${rwmode} to $nbd. waiting for 
device."
+       i=0
+       while i=$(($i+1)):; do
+               get_partition "$nbd" && nptnum="$_RET" && break
+               [ $i -eq 40 ] && {
+                       error "gave up on $nbd"
+                       disconnect_qemu
+                       return 1
+               }
+               [ $(($i%10)) -eq 0 ] &&
+                       debug 1 "waiting for $nbd to be ready."
+               sleep .1
+       done
+
+       if [ "${ptnum}" = "auto" ]; then
+               if [ "$nptnum" = "0" ]; then
+                       debug 1 "unpartitioned disk."
+               else
+                       debug 1 "partitioned disk."
+               fi
+               ptnum=$nptnum
+       else
+               if [ "$nptnum" = "0" -a "$ptnum" != "0" ]; then
+                       error "img $img does not appear partitioned but 
ptnum=$ptnum provided."
+                       return 1
+               fi
+       fi
+       if [ "$ptnum" -ne 0 ]; then
+               mdev="${nbd}p${ptnum}"
+       else
+               mdev="${nbd}"
+       fi
+
+       i=0
+       while :; do
+               [ -b "$mdev" ] && break
+               i=$(($i+1))
+               [ $i -eq 100 ] && {
+                       error "gave up on waiting for $mdev"
+                       disconnect_qemu
+                       return 1
+               }
+               [ $(($i%10)) -eq 0 ] &&
+                       debug 1 "waiting for $mdev part=$ptnum to be ready."
+               sleep .1
+       done
+
+       _RET_NBD="$nbd"
+       _RET_PT="$ptnum"
+       _RET_DEV="$mdev"
+}
+
+mount_nbd() {
+       local img="$1" mp="$2" fmt="$3" ptnum="$4" rwmode="${5:-rw}" opts="$6"
+       if [ -z "$fmt" ]; then
+               get_image_format "$img" && fmt="$_RET" || {
+                       error "failed to get image format for '$img' (try 
--format)"
+                       return 1
+               }
+       fi
+       assert_nbd_support || return
+       connect_nbd "$img" "$fmt" "$ptnum" "$rwmode" || return
+       local ptnum="$_RET_PT" mdev="$_RET_DEV" nbd="$_RET_NBD"
+       if ( set -f; mount -o "$romode" $opts "$mdev" "$img_mp" ); then
+               debug 1 "mounted $mdev via qemu-nbd $nbd"
+       else
+               error "failed to mount $mdev"
+               return 1
+       fi
+}
+
 mount_callback_umount() {
-       local img_in="$1" dev="" out="" mp="" ret="" img="" readonly=""
+       local img_in="$1" dev="" out="" mp="" ret="" img="" readonly=false
        local opts="" bmounts="" system_resolvconf=false ptnum=auto
-       local cd_mountpoint=false fmt="" mp_is_tmp=false overlay=false
-       local img_mp="" workd=""
+       local cd_mountpoint=false fmt="" overlay=false rwmode="rw"
+       local img_mp=""
 
-       short_opts="CdhmPpsv"
+       short_opts="Cdhm:P:psSv"
        
long_opts="cd-mountpoint,dev,help,format:,mountpoint:,overlay,partition:,proc,read-only,sys,system-mounts,system-resolvconf,verbose"
        getopt_out=$(getopt --name "${0##*/}" \
                --options "${short_opts}" --long "${long_opts}" -- "$@") &&
@@ -160,14 +375,14 @@
                        -h|--help) Usage ; exit 0;;
                        -m|--mountpoint) mp=$next;;
                        -P|--partition) ptnum=$next;;
-                       -O|--overlay) overlay=true;;
+                          --overlay) overlay=true;;
                        -p|--proc) bmounts="${bmounts:+${bmounts} }/proc";;
                        -s|--sys) bmounts="${bmounts:+${bmounts} }/sys";;
-                          --system-mounts) bmounts="/dev /proc /sys";;
+                       -S|--system-mounts) bmounts="/dev /proc /sys";;
                           --system-resolvconf) system_resolvconf=true;;
                        -v|--verbose) VERBOSITY=$((${VERBOSITY}+1));;
                           --opts) opts="${opts} $next"; shift;;
-                          --read-only) readonly="ro";;
+                          --read-only) readonly=true; rwmode="ro";;
                        --) shift; break;;
                esac
                shift;
@@ -175,20 +390,44 @@
 
        [ $# -ge 2 ] || { bad_Usage "must provide image and cmd"; return 1; }
 
-       [ -n "$readonly" ] && { $system_resolvconf && ! $overlay; } && {
+       $readonly && { $system_resolvconf && ! $overlay; } && {
                error "--read-only is incompatible with system-resolvconf";
                error "maybe try with --overlay"
                return 1;
        }
 
+       local uns_switch=false
        img_in="$1"
        shift 1
 
-       img=$(readlink -f "$img_in") ||
-               { error "failed to get full path to $img_in"; return 1; }
-
-       [ -f "$img" ] ||
-               { error "$img: not a file"; return 1; }
+       case "$img_in" in
+               lxd:*)
+                       if [ "$ptnum" != "auto" ]; then
+                               error "--ptnum incompatible with directory"
+                               return 1;
+                       fi
+                       command -v lxc-usernsexec >/dev/null 2>&1 || {
+                               error "lxd support needs lxc-usernsexec"; 
+                               return 1;
+                       }
+                       img="/var/lib/lxd/containers/${img_in#lxd:}/rootfs"
+                       [ -d "$img" ] || {
+                               error "${img_in}: no rootfs in $img. Not a 
container?"
+                               return 1;
+                       }
+                       set_subids lxd || {
+                               error "failed reading subids for lxd";
+                               return 1;
+                       }
+                       uns_switch=true
+                       ;;
+               *)
+                       img=$(readlink -f "$img_in") ||
+                               { error "failed to get full path to $img_in"; 
return 1; }
+                       [ -f "$img" ] ||
+                               { error "$img: not a file"; return 1; }
+                       ;;
+       esac
 
        [ "$(id -u)" = "0" ] ||
                { error "sorry, must be root"; return 1; }
@@ -199,7 +438,6 @@
        if [ -z "$mp" ]; then
                mp="${TEMP_D}/mp"
                mkdir "$mp" || return
-               mp_is_tmp=true
        else
                [ -d "$mp" ] ||
                        { error "mountpoint '$mp': not a directory"; return 1; }
@@ -215,169 +453,53 @@
                img_mp=$mp
        fi
 
-       local cmd="" arg="" found=false
-       cmd=( )
-       for arg in "$@"; do
-               if [ "${arg}" = "_MOUNTPOINT_" ]; then
-                       debug 1 "replaced string _MOUNTPOINT_ in arguments arg 
${#cmd[@]}"
-                       arg=$mp
-               fi
-               cmd[${#cmd[@]}]="$arg"
-       done
-
-       if [ "${cmd[0]##*/}" = "bash" -o "${cmd[0]##*/}" = "sh" ] &&
-          [ ${#cmd[@]} -eq 0 ]; then
-               debug 1 "invoking shell ${cmd[0]}"
-               error "MOUNTPOINT=$mp"
-       fi
-
-       local hasqemu=false
-       command -v "qemu-nbd" >/dev/null 2>&1 && hasqemu=true
-
-       if out=$(set -f; mount -o loop${readonly:+,$readonly} $opts \
-                        "$img" "$img_mp" 2>&1); then
-               debug 1 "mounted simple filesystem image '$img_in'"
+       out=""
+       if [ -d "$img" ]; then
+               debug 1 "using directory at $img for $img_in"
+               mp=$img
+               if $overlay; then
+                       debug 1 "mounting $img to $mp"
+                       mount --bind "$img" "$img_mp" ||
+                               { error "failed to mount --bind '$img' '$mp'"; 
return 1; }
+                       UMOUNTS[${#UMOUNTS[@]}]="$mp"
+               fi
+       elif [ "$ptnum" = "auto" -o "$ptnum" = "0" ] &&
+               out=$(set -f; mount -o "loop,$rwmode" $opts "$img" "$img_mp" 
2>&1); then
+               debug 1 "mounted simple filesystem image $rwmode in '$img_in'"
                UMOUNTS[${UMOUNT[@]}]="$img_mp"
        else
+               local hasqemu=false
+               command -v "qemu-nbd" >/dev/null 2>&1 && hasqemu=true
                if ! $hasqemu; then
                        error "simple mount of '$img_in' failed."
-                       error "if this not a raw image, or it is partitioned"
+                       error "if this is not a simple unpartitioned raw image, 
then"
                        error "you must have qemu-nbd (apt-get install 
qemu-utils)"
-                       error "mount failed with: $out"
-                       return 1
-               fi
-       fi
-
-       if [ "${#UMOUNTS[@]}" -eq 0 ]; then
-               if [ ! -e /sys/block/nbd0 ] && ! grep -q nbd /proc/modules; then
-                       debug 1 "trying to load nbd module"
-                       modprobe nbd >/dev/null 2>&1
-                       udevadm settle >/dev/null 2>&1
-               fi
-               [ -e /sys/block/nbd0 ] || {
-                       error "no nbd kernel support, but simple mount failed"
-                       return 1;
-               }
-
-               if [ -z "$fmt" ]; then
-                       get_image_format "$img" && fmt="$_RET" || {
-                               error "failed to get image format for '$img' 
(try --format)"
-                               return 1
-                       }
-               fi
-
-               local f nbd="" pidfile="" pid="" roflag=""
-               for f in /sys/block/nbd*; do
-                       [ -d "$f" -a ! -f "$f/pid" ] && nbd=${f##*/} && break
-               done
-               if [ -z "$nbd" ]; then
-                       error "failed to find an nbd device"
-                       return 1;
-               fi
-               nbd="/dev/$nbd"
-
-               [ -n "$readonly" ] && roflag="--read-only"
-               pidfile="/sys/block/${nbd##*/}/pid" pid=""
-               if ! qemu-nbd $roflag "--format=$fmt" --connect "$nbd" "$img"; 
then
-                       { read pid < "$pidfile"; } >/dev/null 2>&1 &&
-                               [ -d "/proc/$pid" ] &&
-                               QEMU_DISCONNECT="$nbd"
-                       error "failed to qemu-nbd connect $img to $nbd"
-                       return 1
-               fi
-               QEMU_DISCONNECT="$nbd"
-
-               local pfile="/sys/block/${nbd#/dev/}/pid"
-               if [ ! -f "$pfile" ]; then
-                       debug 1 "waiting on pidfile for $nbd in $pfile"
-                       local i=0
-                       while [ ! -f "$pfile" ] && i=$(($i+1)); do
-                               if [ $i -eq 200 ]; then
-                                       error "giving up on pidfile $pfile for 
$nbd"
-                                       return 1
-                               fi
-                               sleep .1
-                               debug 2 "."
-                       done
-               fi
-
-               local nptnum=""
-               debug 1 "connected $img_in ($fmt) to $nbd. waiting for device."
-               i=0
-               while i=$(($i+1)):; do
-                       get_partition "$nbd" && nptnum="$_RET" && break
-                       [ $i -eq 40 ] && {
-                               error "gave up on $nbd"
-                               return 1
-                       }
-                       [ $(($i%10)) -eq 0 ] &&
-                               debug 1 "waiting for $nbd to be ready."
-                       sleep .1
-               done
-
-               udevadm settle >/dev/null 2>&1
-               if [ "${ptnum}" = "auto" ]; then
-                       if [ "$nptnum" = "0" ]; then
-                               debug 1 "unpartitioned disk."
-                       else
-                               debug 1 "partitioned disk."
+                       if [ -n "$out" ]; then
+                               error "mount failed with: $out"
                        fi
-                       ptnum=$nptnum
-               fi
-               if [ "$ptnum" -ne 0 ]; then
-                       mdev="${nbd}p${ptnum}"
-               else
-                       mdev="${nbd}"
-               fi
-               i=0
-               while :; do
-                       [ -b "$mdev" ] && break
-                       i=$(($i+1))
-                       [ $i -eq 100 ] && {
-                               error "gave up on waiting for $mdev"
-                               return 1
-                       }
-                       [ $(($i%10)) -eq 0 ] &&
-                               debug 1 "waiting for $mdev part=$ptnum to be 
ready."
-                       sleep .1
-               done
-
-               if ( set -f; mount ${ro:+-o ${ro}} $opts "$mdev" "$img_mp" ) &&
-                       UMOUNTS[${#UMOUNTS[@]}]="$img_mp"; then
-                       debug 1 "mounted $mdev via qemu-nbd $nbd"
-               else
-                       local pid="" pfile="/sys/block/${nbd#/dev/}/pid"
-                       { read pid < "$pfile" ; } >/dev/null 2>&1
-                       [ -n "$pid" -a ! -d "/proc/$pid" ] ||
-                               error "qemu-nbd process seems to have died. was 
'$pid'"
-
-                       error "failed to mount $mdev"
                        return 1
                fi
-
+               mount_nbd "$img" "$img_mp" "$fmt" "$ptnum" "$opts" || return
+               UMOUNTS[${#UMOUNTS[@]}]="$img_mp"
        fi
 
        if $overlay; then
-               local olayopts="lowerdir=$img_mp,upperdir=$mp"
-               workdir="${TEMP_D}/workdir"
-               mkdir "$workdir"
-               # 3.18+ require 'workdir=' option.
-               case "$(uname -r)" in
-                       2*|3.1[01234567]*|3.[0-9].*) :;;
-                       *) olayopts="${olayopts},workdir=$workdir";;
-               esac
-               mount -t overlayfs -o "$olayopts" "$img_mp" "$mp" || {
-                       error "failed mount -t overlayfs -o '$olayopts' 
'$img_mp' '$mp'"
-                       return 1;
+               mount_overlay "$img_mp" "$mp" "${TEMP_D}/workdir" || {
+                       [ -n "${_ERR}" ] && error "${_ERR}"
+                       error "Unable to mount overlay filesystem.  Maybe no 
kernel support?"
+                       return 1
                }
                UMOUNTS[${#UMOUNTS[@]}]="$mp"
        fi
+
        local bindmp=""
        for bindmp in $bmounts; do
                [ -d "$mp${bindmp}" ] || mkdir "$mp${bindmp}" ||
                        { error "failed mkdir $bindmp in mount"; return 1; }
-               mount --bind "$bindmp" "$mp/${bindmp}" ||
+               mount --bind "$bindmp" "$mp${bindmp}" ||
                        { error "failed bind mount '$bindmp'"; return 1; }
+               UMOUNTS[${#UMOUNTS[@]}]="$mp${bindmp}"
+               debug 1 "mounted $bindmp to $mp${bindmp}"
        done
 
        if ${system_resolvconf}; then
@@ -393,6 +515,34 @@
                        { error "failed copy /etc/resolv.conf"; return 1; }
        fi
 
+       local cmd="" arg="" found=false
+       cmd=( )
+       for arg in "$@"; do
+               if [ "${arg}" = "_MOUNTPOINT_" ]; then
+                       debug 1 "replaced string _MOUNTPOINT_ in arguments arg 
${#cmd[@]}"
+                       arg=$mp
+               fi
+               cmd[${#cmd[@]}]="$arg"
+       done
+       if [ "${cmd[0]##*/}" = "bash" -o "${cmd[0]##*/}" = "sh" ] &&
+          [ ${#cmd[@]} -eq 0 ]; then
+               debug 1 "invoking shell ${cmd[0]}"
+               error "MOUNTPOINT=$mp"
+       fi
+
+       if $uns_switch && [ "$1" = "chroot" ]; then
+               debug 1 "added helper uns-switch for chroot"
+               cmd=( uns-switch "${cmd[@]}" )
+       elif $uns_switch; then
+               debug 1 "uns-switch helper can be used for changing user map"
+       fi
+
+       add_helpers "$TEMP_D/bin" "$SUBUID" "$SUBGID" || {
+               error "failed to add helpers to $TEMP_D";
+               return 1;
+       }
+       PATH="$TEMP_D/bin:$PATH"
+
        local startwd="$PWD"
        debug 1 "invoking: MOUNTPOINT=$mp" "${cmd[@]}"
 
@@ -414,11 +564,6 @@
        do_umounts "${UMOUNTS[@]}" && UMOUNTS=( ) ||
                { error "failed umount $img"; return 1; }
 
-       if "$mp_is_tmp"; then
-               rmdir "$img_mp" || error "WARN: failed 'rmdir $img_mp'"
-       fi
-
-       
        if [ -n "$QEMU_DISCONNECT" ]; then
                disconnect_qemu || return 1;
        fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/bin/ubuntu-cloudimg-query 
new/cloud-utils-0.30/bin/ubuntu-cloudimg-query
--- old/cloud-utils-0.29/bin/ubuntu-cloudimg-query      2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/bin/ubuntu-cloudimg-query      2017-01-13 
17:05:42.000000000 +0100
@@ -134,7 +134,7 @@
 output="-"
 format='%{ami}\n'
 burl="${UBUNTU_CLOUDIMG_QUERY_BASEURL:-https://cloud-images.ubuntu.com/query}";
-store="ebs"
+store=""
 region_default="${EC2_REGION:-us-east-1}"
 release="xenial"
 arch="amd64"
@@ -176,7 +176,7 @@
                        arch=${i};
                        [ "${i}" = "x86_64" ] && arch="amd64";;
                *-*-[0-9]) region=${i};;
-               ebs) store="$i";;
+               ebs|ebs-ssd|ebs-io1) store="$i";;
                instance|instance-store) store="instance-store";;
                hvm) ptype="hvm";;
                para|paravirtual) ptype="paravirtual";;
@@ -230,6 +230,15 @@
        fi
 fi
 
+if [ -z "$store" ]; then
+       # legacy 'ebs' backed root devices were dropped in xenial,
+       # so 'ebs-ssd' is the default for newer releases.
+       case "$release" in
+               lucid|precise|trusty|wily) store="ebs";;
+               *) store="ebs-ssd";;
+       esac
+fi
+
 ec2_curf="${TEMP_D}/${release}.${bname}.${stream}.current.txt"
 ec2_url="${burl}/${release}/${bname}/${stream}.current.txt"
 dl_curf="${TEMP_D}/${release}.${bname}.${stream}-dl.current.txt"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/test/test-growpart 
new/cloud-utils-0.30/test/test-growpart
--- old/cloud-utils-0.29/test/test-growpart     2016-06-06 19:02:20.000000000 
+0200
+++ new/cloud-utils-0.30/test/test-growpart     2017-01-13 17:05:42.000000000 
+0100
@@ -51,13 +51,8 @@
 
 truncate --size $osize "$img"
 
-if [ "${PT_TYPE}" = "gpt" ]; then
-       rq sgdisk --new 1:2048: "$img"
-else
-       label=""
-       [ "${PT_TYPE}" = "sfdisk-gpt" ] && label="--label=gpt"
-       echo "2048," | rq sfdisk $label --force --unit=S "$img"
-fi
+label_flag="--label=${PT_TYPE:-dos}"
+echo "2048," | rq sfdisk $label_flag --force --unit=S "$img"
 
 truncate --size "$size" "$img"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/test/test-growpart-fsimage 
new/cloud-utils-0.30/test/test-growpart-fsimage
--- old/cloud-utils-0.29/test/test-growpart-fsimage     2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/test/test-growpart-fsimage     2017-01-13 
17:05:42.000000000 +0100
@@ -32,11 +32,8 @@
 
 truncate --size $osize "$img"
 
-if [ "${PT_TYPE}" = "gpt" ]; then
-       rq sgdisk --new 1:2048: "$img"
-else
-       echo "2048," | rq sfdisk --force --unit=S "$img"
-fi
+label_flag="--label=${PT_TYPE:-dos}"
+echo "2048," | rq sfdisk $label_flag --force --unit=S "$img"
 
 truncate --size "$size" "$img"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/test/test-mic 
new/cloud-utils-0.30/test/test-mic
--- old/cloud-utils-0.29/test/test-mic  1970-01-01 01:00:00.000000000 +0100
+++ new/cloud-utils-0.30/test/test-mic  2017-01-13 17:05:42.000000000 +0100
@@ -0,0 +1,200 @@
+#!/bin/bash
+
+set -e
+
+[ "$(id -u)" = "0" ] ||
+       { echo "sorry, must be root"; exit 1; }
+
+PT_TYPE="${PT_TYPE:-gpt}" # dos or gpt
+
+cleanup() {
+       [ ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+rq() {
+   local out="${TEMP_D}/out"
+       "$@" > "$out" 2>&1 || { error "FAILED:" "$@"; cat "$out"; return 1; }
+}
+fail() { echo "$@" 1>&2; exit 1; }
+error() { echo "$@" 1>&2; }
+msg() { error "$@"; }
+
+do_pt_test() {
+       local img="$1" pt="$2" data="$3" info="$4" premsg="$5" out=""
+       msg "${premsg}testing partition $pt in $img"
+       mount-image-callback --cd "--part=$pt" "$img" -- \
+               sh -c "echo '$data' > data.txt" || {
+                       error "${premsg}failed writing to partition $pt in 
$img";
+                       return 1;
+               }
+       local expected=$(printf "%s\n%s\n" "$info" "$data")
+       out=$(mount-image-callback --read-only --cd "--part=$pt" "$img" -- \
+               sh -c "cat info.txt data.txt") || {
+                       error "${premsg}failed mounting part $pt for 
verification";
+                       return 1;
+               }
+       [ "$expected" = "$out" ] || {
+               error "${premsg}expected $pt to have:"
+               error "$expected"
+               error "found:"
+               error "$out"
+       }
+}
+
+
+TEMP_D=$(mktemp -d ${TMPDIR:-/tmp}/${0##*/}.XXXXXX)
+trap cleanup EXIT
+
+pt1="${TEMP_D}/pt1.img"
+pt2="${TEMP_D}/pt2.img"
+prept="${TEMP_D}/header.img"
+postpt="${TEMP_D}/foot.img"
+img_mbr="${TEMP_D}/disk-mbr.img"
+img_gpt="${TEMP_D}/disk-gpt.img"
+MB=$((1024*1024))
+SSIZE=512
+pt1_size=$((100*$MB))
+pt2_size=$((200*$MB))
+prept_size=$MB
+postpt_size=$MB
+
+pt1_d="${TEMP_D}/pt1"
+pt2_d="${TEMP_D}/pt2"
+mkdir -p "$pt1_d" "$pt2_d"
+echo "partition 1" > "$pt1_d/info.txt"
+echo "file 1" > "$pt1_d/file1.txt"
+mkdir "$pt1_d/dev" "$pt1_d/sys" "$pt1_d/proc" "$pt1_d/mnt"
+echo "partition 2" > "$pt2_d/info.txt"
+
+## Stage 1
+## Create 2 un-partitioned images, put a filesystem on them.
+## And then mount them write a file, and then mount and
+## read the file to verify its there.
+truncate "--size=$pt1_size" "$pt1"
+truncate "--size=$pt2_size" "$pt2"
+rq mkfs.ext4 -F "${pt1}"
+rq mkfs.ext4 -F "${pt2}"
+
+## Stage 1.5: Verify
+msg "testing partition 1 image"
+mount-image-callback "$pt1" -- cp -r "$pt1_d/"* _MOUNTPOINT_ ||
+       fail "copying file to pt1 mount failed"
+
+out=$(mount-image-callback --read-only "$pt1" --cd -- cat info.txt) &&
+       [ "$out" = "partition 1" ] ||
+       fail "failed verification of pt1 contents"
+
+out=$(mount-image-callback --read-only --cd "$pt1" -- cat file1.txt)
+[ "$out" = "file 1" ] ||
+       fail "found unexpected contents in file1.txt on pt1: $out"
+
+msg "testing partition 2 image"
+mount-image-callback "$pt2" -- cp -r "$pt2_d/"* _MOUNTPOINT_ ||
+       fail "copying file to pt2 mount failed"
+
+out=$(mount-image-callback --read-only "$pt2" --cd -- cat info.txt) &&
+       [ "$out" = "partition 2" ] ||
+       fail "failed verification of pt2 contents"
+
+## Stage 1.6: Mount with overlay
+copy_out="${TEMP_D}/copy-out"
+mkdir -p "$TEMP_D/copy-out"
+mount-image-callback --overlay --cd "$pt1" -- \
+       sh -ec 't="$1";
+               echo hi > new-file.txt; echo xxx > file1.txt;
+               cp -r * "$t"' -- "$copy_out"
+read found < "$copy_out/file1.txt"
+[ "$found" = "xxx" ] ||
+       fail "unexpected contents in file1.txt from overlay: $found."
+
+[ -f "$copy_out/new-file.txt" ] ||
+       fail "new file created during overlay does not exist in copy out"
+read found <"$copy_out/new-file.txt"
+[ "$found" = "hi" ] ||
+       fail "unexpected contents in new-file.txt from overlay: $found."
+
+## verify the overlay mount changes did not change partition
+out=$(mount-image-callback --cd "$pt1" -- cat file1.txt)
+[ "$out" = "file 1" ] ||
+       fail "found unexpected contents in pt1:file1.txt after overlay: $out"
+
+## Stage 1.7: Test --system-mounts
+msg "testing --system-mounts on pt1"
+mount-image-callback --read-only --system-mounts --cd -- "$pt1" sh -c '
+       fails=0
+       logfail() { fails=$(($fails+1)); echo "$@" 1>&2; }
+       [ -e proc/1 ] || logfail "proc/1 did not exist: proc not mounted"
+       [ -d sys/class ] || logfail "sys/class did not exist: sys not mounted"
+       [ -e dev/null ] || logfail "dev/null did not exist: dev not mounted"' ||
+       fail "testing system-mounts failed."
+
+## Stage 1.8: Test unmounts of unexpected mounted dirs.
+msg "testing unexpected mount get unmounted."
+mount-image-callback --read-only --cd -- "$pt1" sh -ec '
+       fail() { echo "$@" 1>&2; }
+       mount -t tmpfs none -o size=10240 mnt/ || fail "failed tmpfs mount"
+       echo "hi mom" > mnt/file-on-tmpfs ||
+               fail "failed write to file-on-tmpfs"
+       mkdir mnt/mnt2 || faili "failed mkdir mnt/mnt2"
+       mount -t tmpfs none -o size=4096 mnt/mnt2 || fail "failed 2nd tmpfs 
mount"
+       echo "hi again" > mnt/mnt2/second-file-on-tmpfs' ||
+               fail "testing unexpected mounts failed."
+
+# verify the file is not there.
+mount-image-callback --read-only --cd -- "$pt1" sh -c '
+       fail() { echo "$@" 1>&2; exit 1; }
+       [ ! -e mnt/file-on-tmpfs ] || fail mnt/file-on-tmpfs existed
+       [ ! -e mnt/mnt2 ] || fail mnt/mnt2 existed
+       [ ! -e mnt/mnt2/second-file-on-tmpfs ] || fail second file existed
+       exit 0' ||
+               fail "file mnt/file-on-tmpfs existed."
+
+## Stage 2
+## Create a full disk image with those 2 partition images inside
+## and a partition table that points to them.  Do one for MBR and GPT.
+truncate "--size=$prept_size" "$prept"
+truncate "--size=$postpt_size" "$postpt"
+
+msg "writing hunks to disk image ${img_mbr}"
+for hunk in "$prept" "$pt1" "$pt2" "$postpt"; do
+       rq dd bs=1M conv=notrunc oflag=append "if=$hunk" "of=${img_mbr}" ||
+               fail "failed adding $hunk to disk image"
+done
+cp "${img_mbr}" "$img_gpt"
+
+#
+sfdisk_in="$TEMP_D/ptable_in"
+curstart=0
+(
+echo unit: sectors
+for pair in "-:${prept_size}" "1:${pt1_size}" "2:${pt2_size}" 
"-:${postpt_size}"; do
+       op=${pair%%:*}
+       size="${pair#*:}"
+       if [ "$op" != "-" ]; then
+               echo "${curstart} $((size/$SSIZE)) L"
+       fi
+       curstart=$(($curstart+($size/$SSIZE)))
+done
+) > "$sfdisk_in"
+
+msg "partitioning MBR disk image ${img_mbr}"
+(echo "label: dos"; cat "$sfdisk_in"; ) | rq sfdisk "${img_mbr}"
+
+msg "partitioning GPT disk image ${img_gpt}"
+(echo "label: gpt"; cat "$sfdisk_in"; ) | rq sfdisk "${img_gpt}"
+
+## Stage 2.5
+## Verify we can mount each partition with '--part=N'
+## write data, then remount and read expected data.
+for toks in "MBR:${img_mbr}" "GPT:${img_gpt}"; do
+       img=${toks#*:}
+       prefix=${toks%%:*}
+       do_pt_test "$img" 1 "foo1" "partition 1" "$prefix: " ||
+               fail "${prefix}failed testing partition 1 on $img"
+
+       do_pt_test "$img" 2 "foo2" "partition 2" "$prefix: " ||
+               fail "${prefix}failed testing partition 2 on $img"
+done
+
+error "Finished tests."
+
+# vi: ts=4 noexpandtab
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cloud-utils-0.29/tools/make-dist-tarball 
new/cloud-utils-0.30/tools/make-dist-tarball
--- old/cloud-utils-0.29/tools/make-dist-tarball        2016-06-06 
19:02:20.000000000 +0200
+++ new/cloud-utils-0.30/tools/make-dist-tarball        2017-01-13 
17:05:42.000000000 +0100
@@ -22,6 +22,6 @@
 
 cd ${tmpd} && 
    bzr branch -r "tag:${tag}" "${topdir}" ./${name}-${tag} &&
-   rm -rf ${name}-${tag}/debian &&
-   tar czf "${out}" ${name}-${tag}/ --exclude ${name}-${tag}/.bzr &&
+   rm -rf ${name}-${tag}/debian ${name}-${tag}/.bzr*
+   tar -czf "${out}" ${name}-${tag}/ &&
    echo "wrote ${out}"

++++++ rootgrow ++++++
#!/usr/bin/python3
import os
import re
import syslog

split_dev = re.compile('([a-z/]*)(\d*)')
mounts = open('/proc/mounts' ,'r').readlines()

def get_mount_point(device):
    for mount in mounts:
        if mount.startswith(device):
            return mount.split(' ')[1]

def resize_fs(fs_type, device):
    if fs_type.startswith('ext'):
        cmd = 'resize2fs %s' % device
        syslog.syslog(
            syslog.LOG_INFO,
            'Resizing: "%s"' %cmd
        )
        os.system(cmd)
    elif fs_type == 'xfs':
        mnt_point = get_mount_point(device)
        cmd = 'xfs_growfs %s' % mnt_point
        syslog.syslog(
            syslog.LOG_INFO,
            'Resizing: "%s"' %cmd
        )
        os.system(cmd)


for mount in mounts:
    if ' / ' in mount:
        mount_dev = mount.split(' ')[0]
        fs = mount.split(' ')[2]
        try:
            dev, partition = split_dev.match(mount_dev).groups()
        except:
            syslog.syslog(
                syslog.LOG_ERR,
                'match exception for "%s"' % mount
            )
            break
        if dev and partition:
            cmd = '/usr/sbin/growpart %s %s' %(dev, partition)
            syslog.syslog(
                syslog.LOG_INFO,
                'Executing: "%s"' % cmd
            )
            os.system(cmd)
            resize_fs(fs, mount_dev)
        else:
            syslog.syslog(
                syslog.LOG_ERR,
                'could not match device and partition in "%s"' % mount
            )

++++++ rootgrow.service ++++++
[Unit]
Description=Grow the root partition
After=local-fs.target
Wants=local-fs.target

[Service]
ExecStart=/usr/sbin/rootgrow
Type=oneshot

[Install]
WantedBy=multi-user.target

Reply via email to