PKGBUILDs/alarm/dkms-mt7610/dkms-mt7610.install

59 lines
1.2 KiB
Text
Raw Normal View History

2015-04-26 13:07:45 +00:00
pre_install(){
2015-04-28 11:10:32 +00:00
rm -rf /etc/Wireless/RT2870STA
2015-04-26 13:07:45 +00:00
}
post_install(){
MODULE="mt7610"
VERSION="v3.0.0.3"
2015-04-26 13:07:45 +00:00
KERNEL_MODULE_NAME="mt7650u_sta"
USR_SRC="/usr/src"
SRC_DIR=$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?
2015-04-28 11:10:32 +00:00
PARAMSDIR="/etc/Wireless/RT2870STA"
2015-04-26 13:07:45 +00:00
mkdir -p $PARAMSDIR
2015-04-28 11:10:32 +00:00
cp $SRC_DIR/RT2870STA.dat $PARAMSDIR
cp $SRC_DIR/RT2870STACard.dat $PARAMSDIR
2015-04-26 13:07:45 +00:00
depmod -a $(uname -r)
modprobe -a $KERNEL_MODULE_NAME
}
pre_upgrade(){
pre_remove
}
post_upgrade(){
post_install
}
pre_remove (){
_inmemory=$(/usr/bin/lsmod | /usr/bin/grep $KERNEL_MODULE_NAME)
if [ ! -z "$_inmemory" ]; then
/usr/bin/rmmod $KERNEL_MODULE_NAME &> /dev/null
fi
_line=$(dkms status -m mt7610)
if echo "$_line" | grep -E 'added|built|installed'; then
version=$(echo "$_line" | sed 's/mt7610,\([^,]*\)[,:].*/\1/;t;d')
dkms remove -m mt7610 -v $version --all
fi
2015-04-28 11:10:32 +00:00
rm -rf /etc/Wireless/RT2870STA
2015-04-26 13:07:45 +00:00
#rmdir --ignore-fail-on-non-empty /etc/Wireless
}
post_remove () {
/sbin/depmod -a
}
op=$1
shift
$op $*