summaryrefslogtreecommitdiff
path: root/copy-modloop.in
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2021-01-18 12:27:01 -0500
committerNatanael Copa <ncopa@alpinelinux.org>2021-02-15 12:10:16 +0000
commit59cea34505cfc8563e1164d1ba81cb5ea2f3369f (patch)
treef96bceade621ab3acb3c1a3d29a634966bb10426 /copy-modloop.in
parent6fff80e3d5211e708337f0c486c5a3607133ce77 (diff)
downloadalpine-conf-59cea34505cfc8563e1164d1ba81cb5ea2f3369f.zip
split modloop copy to a separate script
fixes #10468
Diffstat (limited to 'copy-modloop.in')
-rw-r--r--copy-modloop.in25
1 files changed, 25 insertions, 0 deletions
diff --git a/copy-modloop.in b/copy-modloop.in
new file mode 100644
index 0000000..0c0d3a2
--- /dev/null
+++ b/copy-modloop.in
@@ -0,0 +1,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