#!/bin/sh

#     DESCRIPTION
#
# Umount /image. Allow eject cd.


#     REQUIRES
#


#     INFO
# If rescue image copied to memory user can eject cd.

NAME="init1-umount_image"

verbose()
{
    if [ -n "$GLOBAL_VERBOSE" ]; then
        echo "HOOK: $NAME: $@"
    fi
}

CONFIG="/etc/rc.d/rc.sysinit.rescue"

verbose "has started"

verbose "add umount /image to $CONFIG"

if ! [ -f "$CONFIG" ]; then
    verbose "Can't find rc.sysinit.rescue"
    verbose "Please install startup-rescue package"
    exit 0;
fi

sed -i -e '/^# Set hard disk parameters$/ i\
\
# inserted by HOOK ###########################################\
action "Umount /image" umount /image\
##############################################################\
\
' "$CONFIG"


verbose "finished"
