summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorZach Marano <zmarano@google.com>2019-07-08 14:55:29 -0700
committerGitHub <noreply@github.com>2019-07-08 14:55:29 -0700
commit22025ab58556b58432209b780b77819d2ecad4d2 (patch)
treed0c8d75284579c384fa4e80dbd22427490f4e061 /packages
parent0b8410b7dd7e6630ecf8c344d03c16e226d362e4 (diff)
downloadgoogle-compute-image-packages-22025ab58556b58432209b780b77819d2ecad4d2.tar.gz
Fix gce_disk_expand for Debian. (#803)
Diffstat (limited to 'packages')
-rw-r--r--packages/gce-disk-expand/packaging/debian/control3
-rw-r--r--packages/gce-disk-expand/packaging/debian/install1
-rwxr-xr-xpackages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs10
-rwxr-xr-xpackages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs34
4 files changed, 26 insertions, 22 deletions
diff --git a/packages/gce-disk-expand/packaging/debian/control b/packages/gce-disk-expand/packaging/debian/control
index 1b18aef..ac38b5d 100644
--- a/packages/gce-disk-expand/packaging/debian/control
+++ b/packages/gce-disk-expand/packaging/debian/control
@@ -2,8 +2,7 @@ Source: gce-disk-expand
Section: admin
Priority: optional
Maintainer: Google Cloud Team <gc-team@google.com>
-Build-Depends: debhelper (>= 9),
- dh-systemd (>= 1.5),
+Build-Depends: debhelper (>= 10)
Standards-Version: 3.9.8
Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages
diff --git a/packages/gce-disk-expand/packaging/debian/install b/packages/gce-disk-expand/packaging/debian/install
index e621f63..976acf1 100644
--- a/packages/gce-disk-expand/packaging/debian/install
+++ b/packages/gce-disk-expand/packaging/debian/install
@@ -1 +1,2 @@
src/usr/share/initramfs-tools usr/share/
+src/expandfs-lib.sh usr/share/initramfs-tools/scripts/
diff --git a/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs b/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs
index b1f38b7..dae461a 100755
--- a/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs
+++ b/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs
@@ -28,5 +28,11 @@ esac
. /usr/share/initramfs-tools/hook-functions
-parted=$(command -v "parted")
-copy_exec "$parted" /bin
+copy_exec /sbin/parted /bin
+copy_exec /bin/grep /bin
+copy_exec /bin/sed /bin
+copy_exec /usr/bin/cut /bin
+copy_exec /sbin/e2fsck /bin
+copy_exec /sbin/blkid /bin
+copy_exec /sbin/resize2fs /bin
+copy_exec /bin/udevadm /bin
diff --git a/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs b/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs
index c95f50d..a380bc2 100755
--- a/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs
+++ b/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs
@@ -26,7 +26,7 @@ case $1 in
esac
. /scripts/functions
-. /local-premount/expandfs-lib.sh
+. /scripts/expandfs-lib.sh
if ! rootdev=$(resolve_device "${ROOT}"); then
log_failure_message "Failed to resolve root device for \"${ROOT}\""
@@ -36,34 +36,32 @@ if ! fs_type=$(get_fstype "${rootdev}"); then
log_failure_message "Failed to determine fstype for \"${rootdev}\""
fi
-if ! out=$(get_partition "$rootdev"); then
- echo "Failed to detect disk and partition info: ${out}"
+if ! out=$(split_partition "$rootdev"); then
+ log_failure_message "Failed to detect disk and partition info: ${out}"
exit 0
fi
disk=${out%:*}
partnum=${out#*:}
-if ! parted_needresize "$rootdisk" "$partnum"; then
+if ! parted_needresize "${disk}" "${partnum}"; then
+ log_success_message "Disk ${rootdev} doesn't need resizing."
exit 0
fi
-echo "Resizing disk ${rootdev}"
+if ! out=$(parted_fix_gpt "$disk"); then
+ log_failure_message "Failed to fix GPT: ${out}"
+ exit 0
+fi
-if ! out=$(parted_fix_gpt); then
- echo "$out"
+echo "Resizing partition on ${rootdev}"
+if ! out=$(parted_resizepart "${disk}" "${partnum}"); then
+ log_failure_message "Failed to resize partition: ${out}"
exit 0
fi
-if parted --help | grep -q 'resizepart'; then
- if ! out=$(parted_resizepart "$disk" "$partnum"); then
- echo "Failed to resize partition: ${out}"
- exit 0
- fi
-else
- echo "No 'resizepart' command in this parted, trying rm&&mkpart"
- if ! out=$(parted_resize_mkpart "$disk" "$partnum"); then
- echo "Failed to resize partition: ${out}"
- exit 0
- fi
+echo "Resizing filesystem on ${rootdev}"
+if ! out=$(resize_filesystem "${rootdev}"); then
+ log_failure_message "Failed to resize filesystem: ${out}"
+ exit 0
fi