summarylogtreecommitdiffstats
path: root/dkms-frandom.install
diff options
context:
space:
mode:
authorreztho2015-06-13 23:21:53 +0100
committerreztho2015-06-13 23:21:53 +0100
commit666bf437c172a788175fd903ab80fd5d6e64fafd (patch)
tree30d6a8c7f31c5355e9af6bfd43f9808a365c9373 /dkms-frandom.install
downloadaur-666bf437c172a788175fd903ab80fd5d6e64fafd.tar.gz
Initial commit
Diffstat (limited to 'dkms-frandom.install')
-rw-r--r--dkms-frandom.install39
1 files changed, 39 insertions, 0 deletions
diff --git a/dkms-frandom.install b/dkms-frandom.install
new file mode 100644
index 000000000000..18ba932f418c
--- /dev/null
+++ b/dkms-frandom.install
@@ -0,0 +1,39 @@
+post_install (){
+ DKMS=$(which dkms)
+
+ $DKMS add -m frandom -v 1.1
+ $DKMS build -m frandom -v 1.1
+ $DKMS install -m frandom -v 1.1
+ /usr/bin/depmod -a
+}
+
+pre_upgrade(){
+ pre_remove
+}
+
+post_upgrade(){
+ post_install
+}
+
+pre_remove (){
+ _inmemory=$(/usr/bin/lsmod | /usr/bin/grep frandom)
+ if [ ! -z "$_inmemory" ]; then
+ /usr/bin/rmmod frandom &> /dev/null
+ fi
+
+ DKMS=$(which dkms)
+
+ _line=$($DKMS status -m frandom)
+ if echo "$_line" | grep -E 'added|built|installed'; then
+ version=$(echo "$_line" | sed 's/frandom,\([^,]*\)[,:].*/\1/;t;d')
+ $DKMS remove -m frandom -v $version --all
+ fi
+}
+
+post_remove () {
+ /usr/bin/depmod -a
+}
+
+op=$1
+shift
+$op $*