#!/bin/bash

set -e

ROOT_DIR=$(dirname $(realpath "$0"))
source ${ROOT_DIR}/library.sh

_root_partition=$(get_root_partition)
if [[ -z ${_root_partition} ]]; then
    echo "Failed to detect root partition!" >&2
    exit 1
fi

# Resize root partition
resize_partition ${_root_partition}

# Expand
resize2fs "${_root_partition}"

# Disable service
systemctl disable olinuxino-expand.service
