PKGBUILDs/alarm/dkms-mt7601/dkms-mt7601.install

56 lines
1.1 KiB
Plaintext
Raw Normal View History

2013-08-17 20:54:27 +00:00
post_install (){
MODULE="mt7601"
VERSION="v3.0.0.4"
2013-08-17 20:54:27 +00:00
# TODO: replace /usr/src with a variable.
SRCDIR=/usr/src/$MODULE-$VERSION
2014-07-18 03:38:58 +00:00
dkms add -m $MODULE -v $VERSION
dkms build -m $MODULE -v $VERSION
dkms install -m $MODULE -v $VERSION
2013-08-17 20:54:27 +00:00
# This file is read form a hardcoded location.
# Can we put this in a standard location?
PARAMSDIR="/etc/Wireless/RT2870STA"
2014-07-18 03:38:58 +00:00
mkdir -p $PARAMSDIR
cp $SRCDIR/RT2870STA.dat $PARAMSDIR
2013-08-17 20:54:27 +00:00
2014-07-18 03:38:58 +00:00
depmod -a $(uname -r)
2014-07-18 03:38:58 +00:00
modprobe -a mt7601Usta
2013-08-17 20:54:27 +00:00
}
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
2014-07-18 03:38:58 +00:00
_line=$(dkms status -m mt7601)
2013-08-17 20:54:27 +00:00
if echo "$_line" | grep -E 'added|built|installed'; then
version=$(echo "$_line" | sed 's/mt7601,\([^,]*\)[,:].*/\1/;t;d')
2014-07-18 03:38:58 +00:00
dkms remove -m mt7601 -v $version --all
2013-08-17 20:54:27 +00:00
fi
2014-07-18 03:38:58 +00:00
rm -rf /etc/Wireless/RT2870STA
rmdir --ignore-fail-on-non-empty /etc/Wireless
2013-08-17 20:54:27 +00:00
}
post_remove () {
/sbin/depmod -a
}
op=$1
shift
$op $*