Advertisement
Guest User

Untitled

a guest
Dec 13th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. Patch is based from /usr/lib
  2.  
  3.  
  4. --- python2.7/dist-packages/curtin/commands/block_meta.py.orig 2014-10-28 02:19:38.000000000 +1000
  5. +++ python2.7/dist-packages/curtin/commands/block_meta.py 2014-12-13 14:17:02.763444917 +1000
  6. @@ -15,6 +15,7 @@
  7. # You should have received a copy of the GNU Affero General Public License
  8. # along with Curtin. If not, see <http://www.gnu.org/licenses/>.
  9.  
  10. +import os
  11. from collections import OrderedDict
  12. from curtin import block
  13. from curtin import util
  14. @@ -199,6 +200,9 @@
  15. rootdev = devnode + "1"
  16. bootdev = None
  17.  
  18. + if not os.path.exists(rootdev):
  19. + rootdev = devnode + "p1"
  20. +
  21. LOG.debug("rootdev=%s bootdev=%s fmt=%s bootpt=%s",
  22. rootdev, bootdev, ptfmt, bootpt)
  23. logtime("creating partition with: %s" % ' '.join(ptcmd),
  24. --- python2.7/dist-packages/curtin/block/__init__.py.orig 2014-10-28 02:19:38.000000000 +1000
  25. +++ python2.7/dist-packages/curtin/block/__init__.py 2014-12-13 14:18:26.055446550 +1000
  26. @@ -25,7 +25,7 @@
  27.  
  28.  
  29. def get_dev_name_entry(devname):
  30. - bname = os.path.basename(devname)
  31. + bname = devname.split('/dev/')[-1]
  32. return (bname, "/dev/" + bname)
  33.  
  34.  
  35. @@ -62,12 +62,14 @@
  36. 'TYPE', 'UUID']
  37. if args is None:
  38. args = []
  39. + args = [x.replace('!', '/') for x in args]
  40. # in order to avoid a very odd error with '-o' and all output fields above
  41. # we just drop one. doesn't really matter which one.
  42. keys.remove('SCHED')
  43. basecmd = ['lsblk', '--noheadings', '--bytes', '--pairs',
  44. '--output=' + ','.join(keys)]
  45. (out, _err) = util.subp(basecmd + list(args), capture=True)
  46. + out = out.replace('!', '/')
  47. return _lsblock_pairs_to_dict(out)
  48.  
  49.  
  50. @@ -132,9 +134,11 @@
  51.  
  52. bname = os.path.basename(rpath)
  53. syspath = "/sys/class/block/%s" % bname
  54. -
  55. if not os.path.exists(syspath):
  56. - raise ValueError("%s had no syspath (%s)" % (devpath, syspath))
  57. + syspath2 = "/sys/class/block/cciss!%s" % bname
  58. + if not os.path.exists(syspath2):
  59. + raise ValueError("%s had no syspath (%s)" % (devpath, syspath))
  60. + syspath = syspath2
  61.  
  62. ptpath = os.path.join(syspath, "partition")
  63. if not os.path.exists(ptpath):
  64. --- curtin/helpers/common.orig 2014-10-28 02:19:38.000000000 +1000
  65. +++ curtin/helpers/common 2014-12-13 14:20:44.335449262 +1000
  66. @@ -153,8 +153,8 @@
  67. if $isblk; then
  68. blockdev --rereadpt "$target"
  69. udevadm settle
  70. - [ -b "${target}1" ] ||
  71. - { error "no partition found ${target}1"; return 1; }
  72. + [ -b "${target}1" ] || [ -b "${target}p1" ] ||
  73. + { error "no partition found ${target}1 or ${target}p1"; return 1; }
  74. [ -b "${target}15" ] ||
  75. { error "no partition found ${target}15"; return 1; }
  76. if [ "$boot" = true ]; then
  77. @@ -191,8 +191,8 @@
  78. if $isblk; then
  79. blockdev --rereadpt "$target"
  80. udevadm settle
  81. - [ -b "${target}1" ] ||
  82. - { error "no partition found ${target}1"; return 1; }
  83. + [ -b "${target}1" ] || [ -b "${target}p1" ] ||
  84. + { error "no partition found ${target}1 or ${target}p1"; return 1; }
  85. [ -b "${target}15" ] ||
  86. { error "no partition found ${target}15"; return 1; }
  87. fi
  88. @@ -250,8 +250,8 @@
  89. if $isblk; then
  90. blockdev --rereadpt "$target"
  91. udevadm settle
  92. - [ -b "${target}1" ] ||
  93. - { error "no partition found ${target}1"; return 1; }
  94. + [ -b "${target}1" ] || [ -b "${target}p1" ] ||
  95. + { error "no partition found ${target}1 or ${target}p1"; return 1; }
  96. fi
  97. out=$(wipefs "--offset=$(($start*512))" "$target" 2>&1) || {
  98. error "$out";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement