#!/bin/sh
#170622a sfs
run_hook() {
#    rootaufs="${changes}" ###sfs
#    if [ "x${rootaufs}" != "x" ]; then
    if [ "x${rootaufs}${changes}" != "x" ]; then
        return
    fi

    if [ ! "${root}" ]; then
        err " root= not defined"
        launch_interactive_shell
    fi

    if [ ! -z "$rootdir" ]; then
        mv /new_root /new_rootimg
        ln -s new_rootimg /new_root
    fi
}

run_latehook() {
    if [ "x${rootaufs}" != "x" ]; then
        return
    fi

    local _rootpath _postfix _d
    if [ ! -z "$rootdir" -a -L /new_root ]; then
        _rootpath=/`readlink /new_root`
        rm /new_root
        mkdir /new_root
	##rootaufs
        mount --bind $_rootpath/"$rootdir" /new_root
	#[ "${roothide}" = "y" ] && 
	[ "${root}" ] &&
	    root2="/new_root/mnt/`basename ${root}`" &&
	    mkdir -p "${root2}" && 
    	    default_mount_handler "${root2}" &&
            msg "::: Mount ${root} in ${root2}"
    fi
}
