mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-11-21 08:15:01 -05:00
Add qperf and mkinitcpio-wifi
This commit is contained in:
parent
8ea81d1fc0
commit
d8c21f4995
22
src/mkinitcpio-wifi/PKGBUILD
Normal file
22
src/mkinitcpio-wifi/PKGBUILD
Normal file
@ -0,0 +1,22 @@
|
||||
# Maintainer: tequa
|
||||
pkgname=mkinitcpio-wifi
|
||||
pkgver=0.3
|
||||
pkgrel=1
|
||||
pkgdesc="mkinitcpio hook to enable wifi remote access"
|
||||
arch=(any)
|
||||
license=('GPL')
|
||||
url="https://aur.archlinux.org/packages/mkinitcpio-wifi/"
|
||||
depends=(mkinitcpio wpa_supplicant iproute2)
|
||||
optdepends=(mkinitcpio-netconf)
|
||||
install="mkinitcpio-wifi.install"
|
||||
source=('wifi.hook'
|
||||
'wifi.install')
|
||||
sha256sums=('6af8f536a1ca30c5702acc63ee70346568643d234df7729f3ba70197ef4dd723'
|
||||
'445dbe0457ae61fc053660e2935d925cd8949b449c3f88e36c72d1f1093a553c')
|
||||
|
||||
package() {
|
||||
install -Dm 644 wifi.hook \
|
||||
"${pkgdir}/usr/lib/initcpio/hooks/wifi"
|
||||
install -Dm 644 wifi.install \
|
||||
"${pkgdir}/usr/lib/initcpio/install/wifi"
|
||||
}
|
6
src/mkinitcpio-wifi/mkinitcpio-wifi.install
Normal file
6
src/mkinitcpio-wifi/mkinitcpio-wifi.install
Normal file
@ -0,0 +1,6 @@
|
||||
post_install() {
|
||||
echo 'to use this hook add "wifi" to your mkinitcpio.conf and create a'
|
||||
echo 'wpa_supplicant configuration in /etc/wpa_supplicant/initcpio.conf, e.g.:'
|
||||
echo 'wpa_passphrase "ESSID" "passphrase" > /etc/wpa_supplicant/initcpio.conf'
|
||||
echo 'and rerun mkinitcpio'
|
||||
}
|
78
src/mkinitcpio-wifi/wifi.hook
Normal file
78
src/mkinitcpio-wifi/wifi.hook
Normal file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/ash
|
||||
|
||||
check_net_device () {
|
||||
ip link show $1 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
poll_net_device () {
|
||||
local device=$1 seconds=${2//[!0-9]}
|
||||
|
||||
[ "${seconds:-x}" = x ] && seconds=10
|
||||
|
||||
check_net_device $device && return 0
|
||||
|
||||
msg "Waiting $seconds seconds for network device $device ..." >&2
|
||||
while ! check_net_device $device && [ "$seconds" -gt 0 ]; do
|
||||
sleep 1
|
||||
seconds=$(( seconds - 1 ))
|
||||
done
|
||||
|
||||
check_net_device $device
|
||||
}
|
||||
|
||||
check_wpa_supplicant_done () {
|
||||
grep "CTRL-EVENT-CONNECTED" $1 > /dev/null
|
||||
}
|
||||
|
||||
poll_wpa_completion () {
|
||||
local logfile=$1 seconds=${2//[!0-9]}
|
||||
|
||||
[ "${seconds:-x}" = x ] && seconds=10
|
||||
|
||||
check_wpa_supplicant_done $logfile && return 0
|
||||
|
||||
msg "Waiting $seconds seconds for wpa_supplicant ..." >&2
|
||||
while ! check_wpa_supplicant_done $logfile && [ "$seconds" -gt 0 ]; do
|
||||
sleep 1
|
||||
seconds=$(( seconds - 1 ))
|
||||
done
|
||||
|
||||
check_wpa_supplicant_done $logfile
|
||||
}
|
||||
|
||||
run_hook ()
|
||||
{
|
||||
local device="wlan0"
|
||||
local logfile="/tmp-wpa-supplicant-log"
|
||||
|
||||
# wait for wlan-device
|
||||
poll_net_device $device 15
|
||||
|
||||
msg "Starting wifi"
|
||||
|
||||
# set wlan-device to up
|
||||
ip link set $device up || return 1
|
||||
|
||||
# assocciate with wifi network
|
||||
wpa_supplicant -B -i $device -c /etc/wpa_supplicant/initcpio.conf -f $logfile
|
||||
|
||||
# wait for wpa_supplicant
|
||||
poll_wpa_completion $logfile 15
|
||||
|
||||
# wlan-device should now be connected and ready to be assigned an ip by the net hook
|
||||
}
|
||||
|
||||
run_cleanuphook ()
|
||||
{
|
||||
local device="wlan0"
|
||||
local logfile="/tmp-wpa-supplicant-log"
|
||||
|
||||
# kill wpa_supplicant running in the background
|
||||
killall wpa_supplicant
|
||||
|
||||
# set wlan-device link down
|
||||
ip link set $device down
|
||||
|
||||
# wlan-device should now be fully disconnected from the wifi network
|
||||
rm $logfile
|
||||
}
|
68
src/mkinitcpio-wifi/wifi.install
Normal file
68
src/mkinitcpio-wifi/wifi.install
Normal file
@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_mods_depending_on () {
|
||||
local res
|
||||
|
||||
res=$(lsmod | grep -e "^\\<${1}\\>" | awk '{print $4}')
|
||||
res=(${res//,/ })
|
||||
|
||||
(( ${#res[*]} )) && printf "%s\n" "${res[@]}"
|
||||
}
|
||||
|
||||
get_mods_depending_on_recursive () {
|
||||
local mods queue i_mod i_testmod
|
||||
|
||||
mods=($1 $(get_mods_depending_on $1))
|
||||
queue=(${mods[@]})
|
||||
|
||||
while (( ${#queue[*]} )) ; do
|
||||
i_mod=${queue[0]}
|
||||
queue=(${queue[@]:1})
|
||||
|
||||
for i_testmod in $(get_mods_depending_on ${i_mod}) ; do
|
||||
in_array ${i_testmod} ${mods[@]}
|
||||
if [ $? != 0 ] ; then
|
||||
mods+=(${i_testmod})
|
||||
queue+=(${i_testmod})
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
(( ${#mods[*]} )) && printf "%s\n" "${mods[@]}"
|
||||
}
|
||||
|
||||
|
||||
build ()
|
||||
{
|
||||
# Are we even needed?
|
||||
if [ ! -r "/etc/wpa_supplicant/initcpio.conf" ]; then
|
||||
echo "There is no wifi config /etc/wpa_supplicant/initcpio.conf; (create and rerun?); exit"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# wireless modules
|
||||
add_checked_modules "/drivers/net/wireless/"
|
||||
|
||||
# make sure loaded modules depending on cfg80211 are included (e.g. iwlmvm)
|
||||
local mod
|
||||
for mod in $(get_mods_depending_on_recursive cfg80211) ; do
|
||||
add_module $mod
|
||||
done
|
||||
|
||||
# make sure to add module ccm (needed in some cases)
|
||||
add_module ccm
|
||||
|
||||
add_binary "killall"
|
||||
add_binary "wpa_supplicant"
|
||||
add_binary "ip"
|
||||
add_runscript
|
||||
|
||||
add_file "/etc/wpa_supplicant/initcpio.conf" "/etc/wpa_supplicant/initcpio.conf"
|
||||
}
|
||||
|
||||
help ()
|
||||
{
|
||||
cat<<HELPEOF
|
||||
Enables wifi on boot, for ssh unlocking of disk.
|
||||
HELPEOF
|
||||
}
|
30
src/qperf/PKGBUILD
Normal file
30
src/qperf/PKGBUILD
Normal file
@ -0,0 +1,30 @@
|
||||
# Maintainer: James P. Harvey <jamespharvey20 at gmail dot com>
|
||||
|
||||
pkgname=qperf
|
||||
pkgver=0.4.11
|
||||
pkgrel=3
|
||||
pkgdesc='OpenFabrics Alliance InfiniBand performance benchmark for bandwidth and latency (supports TCP/IP and RDMA)'
|
||||
arch=('x86_64' 'i686')
|
||||
url='https://www.openfabrics.org/index.php/overview.html'
|
||||
license=('GPL2')
|
||||
depends=('rdma-core')
|
||||
conflicts=('qperf-nordma')
|
||||
source=("https://github.com/linux-rdma/${pkgname}/archive/v${pkgver}.tar.gz")
|
||||
sha256sums=('b0ef2ffe050607566d06102b4ef6268aad08fdc52898620d429096e7b0767e75')
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
./autogen.sh
|
||||
./configure --prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libexecdir=/usr/lib \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/share/man
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
Loading…
Reference in New Issue
Block a user