mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
55 lines
1.1 KiB
Text
55 lines
1.1 KiB
Text
post_install (){
|
|
|
|
MODULE="mt7601"
|
|
VERSION="v0.0.0"
|
|
DKMS=$(which dkms)
|
|
MODPROBE=$(which modprobe)
|
|
CP=$(which cp)
|
|
MKDIR=$(which mkdir)
|
|
|
|
# TODO: replace /usr/src with a variable.
|
|
SRCDIR=/usr/src/$MODULE-$VERSION
|
|
|
|
$DKMS add -m $MODULE -v $VERSION
|
|
$DKMS build -m $MODULE -v $VERSION
|
|
$DKMS install -m $MODULE -v $VERSION
|
|
|
|
# This file is read form a hardcoded location.
|
|
# Can we put this in a standard location?
|
|
PARAMSDIR="/etc/Wireless/RT2870STA"
|
|
$MKDIR -p $PARAMSDIR
|
|
$CP $SRCDIR/RT2870STA.dat $PARAMSDIR
|
|
|
|
$MODPROBE -a mt7601Usta mtutil7601Usta mtnet7601Usta
|
|
}
|
|
|
|
pre_upgrade(){
|
|
pre_remove
|
|
}
|
|
|
|
post_upgrade(){
|
|
post_install
|
|
}
|
|
|
|
pre_remove (){
|
|
_inmemory=$(/usr/bin/lsmod | /usr/bin/grep mt7601)
|
|
if [ ! -z "$_inmemory" ]; then
|
|
/usr/bin/rmmod mt7601 &> /dev/null
|
|
fi
|
|
|
|
DKMS=$(which dkms)
|
|
|
|
_line=$($DKMS status -m mt7601)
|
|
if echo "$_line" | grep -E 'added|built|installed'; then
|
|
version=$(echo "$_line" | sed 's/mt7601,\([^,]*\)[,:].*/\1/;t;d')
|
|
$DKMS remove -m mt7601 -v $version --all
|
|
fi
|
|
}
|
|
|
|
post_remove () {
|
|
/sbin/depmod -a
|
|
}
|
|
|
|
op=$1
|
|
shift
|
|
$op $*
|