#!/bin/sh
### BEGIN INIT INFO
# Provides:          runresize2fs
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     S
# Default-Stop:
# Short-Description: Run resize2fs on /dev/sda2
# Description:
# Run resize2fs after fixing partition size, so that
# the filesystem takes advantage of the extra space.
# 
# This task should only run once.
#
# Part of a fix for LP: #283494 (Incorrect partition
# size on 8GB and 16GB systems)
### END INIT INFO


case "$1" in
start)
    # Let the system settle down - we don't want to resize the
    # filesystem while loading drivers
    /sbin/udevadm settle

    /sbin/usplash_write "TEXT-URGENT Fixing disk size. This may take a few minutes."
    /sbin/usplash_write "TEXT-URGENT Please do not turn off the system until startup is complete."
    /sbin/usplash_write "TIMEOUT 600"

    /sbin/resize2fs /dev/sda2 > /var/log/runresize2fs.log 2>&1
    rm -f /etc/rcS.d/S21runresize2fs
    ;;
stop|restart|reload|force-reload)
    ;;
esac

exit 0
