# -*- mode: conf; -*-

# Set this to save a file across reboots to indictate on boot that
# umount happened correctly (and that, e.g. battery wasn't pulled)
MOUNT_STAMP=/var/umount.stamp
# tags used in MOUNT_STAMP
REASON_MARK=reason
CLEAN_UMOUNT_MARK=date

# name of system property holding true/false based on presence of
# $MOUNT_STAMP.  Ignored if MOUNT_STAMP not set; must be defined
# otherwise
MOUNT_PROPERTY=last_umount_clean

# file that contains 1 if / should be remounted rw, 0 otherwise
REMOUNT_TOKEN="/etc/.rootfs_RW"

# If an fsck or reformat of /media/internal was required on boot, set
# this property.
MEDIA_FIX_PROPERTY=media_fixed_how

WIPE_FLAGS_DIR=/var/.flags
WIPE_FLAGS_FILE=$WIPE_FLAGS_DIR/on_mount
WIPE_PROGRESS=/var/.sought_blocks

# MMC_PROTECT_OPTS=-f
MMC_PROTECT_OPTS=""
MMC_PROTECT_DISABLED=1                                
mmc_boot_update() {
    if which mmc_protect >/dev/null && test -z "$MMC_PROTECT_DISABLED" ; then
        BOOT_DEV=$(sed 's,.*root=\(/dev/[^ ]*\) .*,\1,' < /proc/cmdline)
        ON_OFF=1                # on by default
        if [ -f "$REMOUNT_TOKEN" -a "$(cat $REMOUNT_TOKEN)" = "1" ]; then
            ON_OFF=0
        fi
        mmc_protect $MMC_PROTECT_OPTS -D "$BOOT_DEV" -p $ON_OFF
    fi
}