summaryrefslogtreecommitdiff
path: root/copy-modloop.in
blob: 0c0d3a291b30f3e83b4dcfdab837dd0f77169f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

set -e

if ! rc-service -q modloop status; then
	echo "modloop is not started"
	exit 1
fi

if [ -n "$DO_UMOUNT" ] && [ -z "$modloop_media" ]; then
	modloop_media=$(find_modloop_media)
fi

modulesdir=/lib/modules
if [ -L "$modulesdir" ]; then
	modulesdir=$(readlink "$modulesdir")
fi
cp -a "$modulesdir" /lib/modules.tmp
rc-service modloop stop
rm -r /lib/modules
mv /lib/modules.tmp /lib/modules

if [ -n "$DO_UMOUNT" ]; then
	umount "$modloop_media"
fi