# Created by Tobias Powalowski <tpowa@archlinux.org>

install ()
{
    MODULES="$(checked_modules "/drivers/net/wireless/") $(checked_modules "/net/wireless/") $(checked_modules "/net/ieee80211/") $(checked_modules "/net/mac80211/")"
    # add staging wireless here
    STAGING="ath6kl brcm80211 otus rt2860 rt2870 rtl8187se rtl8192e rtl8192u rtl8712 vt6655 vt6656 winbond wlan-ng"
    for i in $STAGING; do
        MODULES="$MODULES $(checked_modules "/drivers/staging/$i")"
    done
    BINARIES="iwconfig iwevent iwgetid iwlist iwpriv iwspy ifrename b43-fwcutter wpa_cli wpa_passphrase wpa_supplicant loadndisdriver perl iw crda regdbdump wpa_actiond rfkill"
    FILES=""
    SCRIPT=""
    add_file "/usr/share/archboot/wireless/etc/conf.d/wireless" "/etc/conf.d/wireless"
    add_file "/usr/share/archboot/wireless/etc/wpa_supplicant.conf" "/etc/wpa_supplicant.conf"
    # add rfkill
    add_file "/usr/share/archboot/wireless/etc/conf.d/rfkill" "/etc/conf.d/rfkill"
    add_file "/etc/rc.d/rfkill"
    add_file "/lib/udev/rules.d/60-rfkill.rules"
    # add zd1211 firmware files
    for i in /lib/firmware/zd1211/* ; do
	add_file "$i"
    done
    # add ndiswrapper support
    add_file "/usr/sbin/ndiswrapper"
    add_file "/usr/share/perl5/core_perl/File/Path.pm"
    add_file "/usr/lib/perl5/core_perl/File/Spec/Unix.pm"
    add_file "/usr/lib/perl5/core_perl/File/Spec.pm"
    add_file "/usr/share/perl5/core_perl/File/Copy.pm"
    add_file "/usr/share/perl5/core_perl/File/Basename.pm"
    add_file "/usr/share/perl5/core_perl/Exporter/Heavy.pm"
    add_file "/usr/share/perl5/core_perl/AutoLoader.pm"
    add_file "/usr/share/perl5/core_perl/Carp.pm"
    add_file "/usr/share/perl5/core_perl/Carp/Heavy.pm"
    add_file "/usr/share/perl5/core_perl/warnings.pm"
    add_file "/usr/share/perl5/core_perl/warnings/register.pm"
    add_file "/usr/share/perl5/core_perl/vars.pm"
    add_file "/usr/share/perl5/core_perl/Exporter.pm"
    add_file "/usr/share/perl5/core_perl/strict.pm"
    add_file "/usr/lib/perl5/core_perl/Cwd.pm"
    add_file "/usr/lib/perl5/core_perl/auto/Cwd/Cwd.so"
    add_file "/usr/lib/perl5/core_perl/auto/Fcntl/Fcntl.so"
    add_file "/usr/lib/perl5/core_perl/auto/DynaLoader/dl_find_symbol_anywhere.al"
    add_file "/usr/lib/perl5/core_perl/auto/DynaLoader/dl_expandspec.al"
    add_file "/usr/lib/perl5/core_perl/auto/DynaLoader/autosplit.ix"
    add_file "/usr/lib/perl5/core_perl/auto/DynaLoader/dl_findfile.al"
    add_file "/usr/lib/perl5/core_perl/Config.pm"
    add_file "/usr/lib/perl5/core_perl/DynaLoader.pm"
    add_file "/usr/share/perl5/core_perl/XSLoader.pm"
    add_file "/usr/lib/perl5/core_perl/Fcntl.pm"
    # crda support
    add_file "/usr/share/archboot/wireless/etc/conf.d/wireless-regdom" "/etc/conf.d/wireless-regdom"
    add_file "/lib/udev/rules.d/85-regulatory.rules"
    add_file "/usr/lib/crda/regulatory.bin"
    # fixing licenses
    add_file "/usr/share/licenses/expat/COPYING"
    add_file "/usr/share/licenses/dbus-core/COPYING"
    add_file "/usr/share/licenses/crda/LICENSE"
    add_file "/usr/share/licenses/wireless-regdb/LICENSE"
    add_file "/usr/share/licenses/python/LICENSE"
    add_file "/usr/share/licenses/rfkill/LICENSE"
}

help ()
{
cat<<HELPEOF
  This hook includes wireless on an arch boot image.
HELPEOF
}
