#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

check() {
    return 0
}

depends() {
    # We depend on ublinux modules being loaded
#    echo ublinux
    return 0
}

install() {
    #mc
    dracut_install /usr/bin/mc /usr/bin/mcview /usr/bin/mcedit /usr/bin/mcdiff
    dracut_install /usr/share/mc/*
    dracut_install /usr/share/mc/examples/macros.d/*
    dracut_install /usr/share/mc/help/*
    dracut_install /usr/share/mc/hints/*
    dracut_install /usr/share/mc/skins/*
    dracut_install /usr/share/mc/syntax/*
    dracut_install /etc/mc/*
    [ -f /etc/profile.d/mc.sh ] && dracut_install /etc/profile.d/mc.sh
    [ -f /usr/share/locale/LC_MESSAGES/ru/mc.mo ] && dracut_install /usr/share/locale/LC_MESSAGES/ru/mc.mo
    [ -f /usr/share/locale/ru/LC_MESSAGES/mc.mo ] && dracut_install /usr/share/locale/ru/LC_MESSAGES/mc.mo
    [ -d /usr/lib/mc ] && dracut_install /usr/lib/mc/*
    [ -d /usr/lib/mc/fish ] && dracut_install /usr/lib/mc/fish/*
    grep -E -Rs '#![[:space:]]*/bin/.*sh' /usr/lib/mc/ext.d/* /usr/lib/mc/extfs.d/* \
    /usr/lib/mc/ext.d/* /usr/lib/mc/extfs.d/* | sed 's/:.*$//' 2>/dev/null | while read script ; do
	cat $script | grep -Eq '[/, ]python |[/, ]perl ' || dracut_install $script
    done


    # dracut_install /usr/bin/ssh

    # inst /usr/bin/git
    # inst_multiple \
    #		/usr/lib/git-core/git-sh-i18n \
    #		/usr/lib/git-core/git-sh-i18n--envsubst \
    #		/usr/lib/git-core/git-sh-setup \
    #		/usr/lib/git-core/git-http-backend \
    #		/usr/lib/git-core/git-http-fetch \
    #		/usr/lib/git-core/git-http-push \
    #		/usr/lib/git-core/git-stash \
    #		/usr/lib/git-core/git-remote-https \
    #		/usr/lib/git-core/git-svn \
    #		/usr/lib/git-core/git-submodule \
    #		/usr/lib/git-core/git-parse-remote \ 
    #		/usr/lib/git-core/git-rebase \
    #		/usr/lib/git-core/git-rebase--am \
    #		/usr/lib/git-core/git-rebase--interactive \
    #		/usr/lib/git-core/git-rebase--merge
    # inst_libdir_file /usr/lib/git-core/*

    # inst pkg-config
    # inst cc
    # inst make
    # inst sort
    # inst cp
}
