updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / cloop / cloop.sh
blob65318d960305d27cfbcf6dc271b5948d01ba7d4f
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/vbox/vbox.cfg
7 case "$1" in
8 setup)
9 stat_busy "Unloading cloop kernel module"
10 if grep -q "^cloop" /proc/modules; then
11 modprobe -r cloop
13 stat_done
14 for p in /lib/modules/*; do
15 if [ ! -d "$p/kernel" ]; then
16 if [ -e "$p/misc/cloop.ko" ]; then
17 stat_busy "Removing old cloop kernel module from $p"
18 rm -f "$p/misc/cloop.ko" 2>/dev/null
19 rmdir -p --ignore-fail-on-non-empty "$p/misc/" 2>/dev/null
20 stat_done
23 done
24 if [ -e "/lib/modules/$(uname -r)/misc/cloop.ko" ]; then
25 stat_busy "Removing old cloop kernel module"
26 rm -f "/lib/modules/$(uname -r)/misc/cloop.ko" 2>/dev/null
27 stat_done
29 stat_busy "Recompiling cloop kernel module"
30 rm -f /usr/src/cloop/{cloop.ko,cloop.mod.o,cloop.o,compressed_loop.o}
31 make modules -C /usr/src/linux-$(uname -r)/ M=/usr/src/cloop >/dev/null 2>&1
32 if [ ! -d "/lib/modules/$(uname -r)/misc" ]; then
33 mkdir "/lib/modules/$(uname -r)/misc"
35 install -m 664 /usr/src/cloop/cloop.ko "/lib/modules/$(uname -r)/misc"
36 stat_done
39 echo "usage: $0 {setup}"
41 esac