diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2021-01-18 12:27:01 -0500 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2021-02-15 12:10:16 +0000 |
commit | 59cea34505cfc8563e1164d1ba81cb5ea2f3369f (patch) | |
tree | f96bceade621ab3acb3c1a3d29a634966bb10426 /libalpine.sh.in | |
parent | 6fff80e3d5211e708337f0c486c5a3607133ce77 (diff) | |
download | alpine-conf-59cea34505cfc8563e1164d1ba81cb5ea2f3369f.zip |
split modloop copy to a separate script
fixes #10468
Diffstat (limited to 'libalpine.sh.in')
-rw-r--r-- | libalpine.sh.in | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libalpine.sh.in b/libalpine.sh.in index 75b94ae..3185b55 100644 --- a/libalpine.sh.in +++ b/libalpine.sh.in @@ -286,3 +286,14 @@ ask_which() { echo "'$resp' is not a valid choice." done } + +find_modloop_media() { + devnum=$(mountpoint -d /.modloop) || return + test -n "$devnum" || return + modloop_file=$(cat /sys/dev/block/$devnum/loop/backing_file) || return + test -n "$modloop_file" || return + # assume that device name and mount point don't contain spaces + modloop_media=$(df "$modloop_file" | awk 'NR==2{print $6}') || return + test -n "$modloop_media" || return + echo "$modloop_media" +} |