### Start
### 16.10.2017
set iso_path=""
set cfg_path="/boot/grub/loopback.cfg"
export iso_path
set timeout=0
menuentry "Manjaro" --hotkey=1 {
	loopback loop ${iso_path}
	set root=loop
	source /boot/grub/variable.cfg
    loaded=true
	export loaded
	set auto="img_dev=/dev/disk/by-uuid/${rootuuid} img_loop=${iso_path}"
	export auto

    if keystatus --shift; then
        disable_gfxterm=true
    fi

    if [ "${disable_gfxterm}" != "true" ]; then
        if loadfont /boot/grub/unicode.pf2 ; then
            if [ -z "$gfxmode" ] ; then
                gfxmode=1280x1024,1024x768,800x600
                gfxpayload=keep
            fi
            if keystatus --ctrl; then
                gfxok=""
                pager=0
                while [ -z "$gfxok" ]; do
                    echo "gfxmode=$gfxmode"
                    echo "Input new mode or Enter to confirm"
                    prompt
                    read gfxmodein
                    if [ -n "$gfxmodein" ]; then
                        gfxmode="$gfxmodein"
                        echo ""
                    else
                        gfxok="true"
                    fi
                done
            fi
            insmod all_video
            insmod gfxterm
            if terminal_output --append gfxterm; then
                terminal_output --remove console
            else
                disable_gfxterm=true
            fi
        else
            disable_gfxterm=true
        fi
    fi

    if [ "${disable_gfxterm}" != "true"  -a -f "${grub_theme}" ]; then
        insmod gfxmenu
        themedir=""
        regexp -s themedir '^(.*)/.*$' "${grub_theme}"
        for themefont in $themedir/*.pf2 $themedir/f/*.pf2; do
            if [ -f "${themefont}" ]; then
                loadfont "${themefont}"
            fi
        done
        for imagetype in jpg jpeg png tga; do
            for themeimage in ${themedir}/*.${imagetype}; do
                if [ -f "${themeimage}" ]; then
                    if [ "${imagetype}" = "jpg" ]; then
                        insmod jpeg
                    else
                        insmod $imagetype
                    fi
                fi
            done
        done
        theme=${grub_theme}
        export theme
    fi

    menu_color_normal=cyan/blue
    menu_color_highlight=white/blue
	
	configfile $cfg_path
	loopback -d loop
}
### End