X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fsrc%2Fetc%2Finit.d%2Fresizefs;fp=cirros-testvm%2Fsrc-cirros%2Fsrc%2Fetc%2Finit.d%2Fresizefs;h=1c7c90dd654ca2760caf7f3e20f213aaea01269d;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/src/etc/init.d/resizefs b/cirros-testvm/src-cirros/src/etc/init.d/resizefs new file mode 100755 index 0000000..1c7c90d --- /dev/null +++ b/cirros-testvm/src-cirros/src/etc/init.d/resizefs @@ -0,0 +1,48 @@ +#!/bin/sh +# vi: ts=4 noexpandtab + +RESIZE_MODE="background" +GROWROOT="enabled" +if [ -f /etc/default/resizefs ]; then + . /etc/default/resizefs +fi + +case "$1" in + start) + lxc-is-container && exit 0 + [ -e /dev/root ] || exit 0 + case "$GROWROOT" in + disabled|off|0) :;; + *) + growroot /dev/root || + { echo "failed growing /dev/root"; exit 1; } + esac + # here we have to use start-stop-daemon or the resize + # process gets killed when rc.sysinit ends (LP: #1261710) + case "$RESIZE_MODE" in + background) + cirros-per once resize-rootfs -- \ + start-stop-daemon --start --background \ + --exec=/sbin/resize-filesystem -- \ + /dev/root /run/resize.rootfs /dev/console + ;; + foreground) + cirros-per once resize-rootfs -- \ + /sbin/resize-filesystem \ + /dev/root /run/resize.rootfs /dev/console + ;; + disabled) : ;; + *) + echo "resizefs: unknown RESIZE_MODE='$RESIZE_MODE'." \ + "Doing nothing." 1>&2 + ;; + esac + ;; + stop|restart|reload) : ;; + *) + echo $"Usage: $0 {start}" + exit 1 + ;; +esac + +exit $?