Merge lp:~smoser/maas-images/trunk.img2squash-fixes into lp:maas-images

Proposed by Scott Moser
Status: Merged
Merged at revision: 412
Proposed branch: lp:~smoser/maas-images/trunk.img2squash-fixes
Merge into: lp:maas-images
Diff against target: 48 lines (+5/-5)
1 file modified
bin/img2squashfs (+5/-5)
To merge this branch: bzr merge lp:~smoser/maas-images/trunk.img2squash-fixes
Reviewer Review Type Date Requested Status
Newell Jensen (community) Approve
Review via email: mp+355364@code.launchpad.net

Commit message

img2squashfs: fix when 'image' was a directory.

This fixes img2squashfs for both '--format=dir' and --format=auto
(the default) when input is a directory.

Now the following works:
 img2squashfs my-dir/ /tmp/my-squashfs

To post a comment you must log in.
Revision history for this message
Newell Jensen (newell-jensen) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/img2squashfs'
--- bin/img2squashfs 2017-05-11 14:52:01 +0000
+++ bin/img2squashfs 2018-09-19 21:01:03 +0000
@@ -91,7 +91,7 @@
91 [ "$fmt" != "auto" ] && _RET="$fmt" && return 091 [ "$fmt" != "auto" ] && _RET="$fmt" && return 0
92 if [ -d "$input" ]; then92 if [ -d "$input" ]; then
93 debug 1 "${input} is a directory";93 debug 1 "${input} is a directory";
94 _RET="$dir"94 _RET="dir"
95 return95 return
96 fi96 fi
97 fout=$(LANG=C file "$input") ||97 fout=$(LANG=C file "$input") ||
@@ -127,7 +127,7 @@
127127
128get_usable_input() {128get_usable_input() {
129 # given 'input' in format 'fmt' return:129 # given 'input' in format 'fmt' return:
130 # _RET_fmt: the format of _RET_PATH. either130 # _RET_fmt: the format of _RET_path. either
131 # fs-image : a mountable filesystem image.131 # fs-image : a mountable filesystem image.
132 # dir : a directory132 # dir : a directory
133 # _RET_path: full path to a file in tempd133 # _RET_path: full path to a file in tempd
@@ -151,7 +151,7 @@
151 return;;151 return;;
152 squashfs-image)152 squashfs-image)
153 _RET_fmt="squashfs-image"153 _RET_fmt="squashfs-image"
154 _RET_PATH="${tempd}/fs-image"154 _RET_path="${tempd}/fs-image"
155 ln -s "$(readlink -f "$input")" "${tempd}/fs-image"155 ln -s "$(readlink -f "$input")" "${tempd}/fs-image"
156 return;;156 return;;
157 root-tar)157 root-tar)
@@ -169,7 +169,7 @@
169 ;;169 ;;
170 dir)170 dir)
171 _RET_fmt="dir"171 _RET_fmt="dir"
172 _RET_PATH="${tempd}/fs-dir"172 _RET_path="${tempd}/fs-dir"
173 ln -s "$(readlink -f "$input")" "${tempd}/fs-dir"173 ln -s "$(readlink -f "$input")" "${tempd}/fs-dir"
174 return;;174 return;;
175 *)175 *)
@@ -270,7 +270,7 @@
270 elif [ -f "$tpath" ]; then270 elif [ -f "$tpath" ]; then
271 fsimage2squashfs "$tpath" "$output" "$owner" || return271 fsimage2squashfs "$tpath" "$output" "$owner" || return
272 elif [ -d "$tpath" ]; then272 elif [ -d "$tpath" ]; then
273 dir2squashfs "$tpath" "$output" || return273 dir2squashfs "$tpath/" "$output" || return
274 else274 else
275 error "failed. path='$tpath' cfmt=${cfmt}"275 error "failed. path='$tpath' cfmt=${cfmt}"
276 return 1276 return 1

Subscribers

People subscribed via source and target branches