fix losetup -a used in newer busybox, add ntfs-3g with acl support

pull/40/head
TomasM 2017-12-14 17:43:02 -05:00
parent 25f74c4c0a
commit 3fceef5583
3 changed files with 40 additions and 16 deletions

View File

@ -19,7 +19,7 @@ debug_shell
detach_free_loops() detach_free_loops()
{ {
losetup | cut -d : -f 1 | xargs -r -n 1 losetup -d losetup -a | cut -d : -f 1 | xargs -r -n 1 losetup -d
} }
# $1=dir # $1=dir

Binary file not shown.

View File

@ -12,6 +12,7 @@ debug_start()
{ {
if grep -q debug /proc/cmdline; then if grep -q debug /proc/cmdline; then
DEBUG_IS_ENABLED=1 DEBUG_IS_ENABLED=1
set -x
else else
DEBUG_IS_ENABLED= DEBUG_IS_ENABLED=
fi fi
@ -316,11 +317,15 @@ fs_options()
FS="" FS=""
fi fi
echo -n "$FS -o ro" echo -n "$FS -o rw"
if [ "$1" = "vfat" ]; then if [ "$1" = "vfat" ]; then
echo ",check=s,shortname=mixed,iocharset=utf8" echo ",check=s,shortname=mixed,iocharset=utf8"
fi fi
if [ "$1" = "ntfs-3g" ]; then
echo ",acl"
fi
} }
@ -509,7 +514,6 @@ find_data_try()
# if the FROM parameter is actual file, mount it again as loop (eg. iso) # if the FROM parameter is actual file, mount it again as loop (eg. iso)
if [ -f "$1/$FROM" ]; then if [ -f "$1/$FROM" ]; then
mount -o remount,rw "$DEVICE" "$1" 2>/dev/null
mkdir -p "$1/../iso" mkdir -p "$1/../iso"
mount -o loop,ro "$1/$FROM" "$1/../iso" 2>/dev/null mount -o loop,ro "$1/$FROM" "$1/../iso" 2>/dev/null
FROM="../iso/$LIVEKITNAME" FROM="../iso/$LIVEKITNAME"
@ -518,7 +522,6 @@ find_data_try()
# search for bundles in the mounted directory # search for bundles in the mounted directory
if [ "$(find "$1/$FROM" -maxdepth 1 -name "*.$BEXT" 2>/dev/null)" != "" ]; then if [ "$(find "$1/$FROM" -maxdepth 1 -name "*.$BEXT" 2>/dev/null)" != "" ]; then
# we found at least one bundle/module here # we found at least one bundle/module here
mount -o remount,rw "$DEVICE" "$1" 2>/dev/null
echo "$1/$FROM" | tr -s "/" | sed -r "s:/[^/]+/[.][.]/:/:g" echo "$1/$FROM" | tr -s "/" | sed -r "s:/[^/]+/[.][.]/:/:g"
return return
fi fi
@ -594,7 +597,7 @@ persistent_changes()
{ {
debug_log "persistent_changes" "$*" debug_log "persistent_changes" "$*"
local CHANGES T1 T2 local CHANGES T1 T2 EXISTS
CHANGES="$1/$(basename "$2")" CHANGES="$1/$(basename "$2")"
T1="$CHANGES/.empty" T1="$CHANGES/.empty"
@ -624,20 +627,41 @@ persistent_changes()
chmod -x "$T1" 2>/dev/null && test ! -x "$T1" && \ chmod -x "$T1" 2>/dev/null && test ! -x "$T1" && \
rm "$T1" "$T2" 2>/dev/null rm "$T1" "$T2" 2>/dev/null
if [ $? -ne 0 ]; then if [ $? -eq 0 ]; then
echo "* Activating dynamic sized storage for persistent changes"
rm "$T1" "$T2" 2>/dev/null
@mount.dynfilefs "$CHANGES/changes.dat" 4000 "$2"
if [ "$(device_bestfs "$2/loop.fs" | tr -d " ")" = "-t" ]; then
mke2fs -F "$2/loop.fs" >/dev/null
fi
mount -o loop,sync "$2/loop.fs" "$2"
rmdir "$2/lost+found" 2>/dev/null
else
echo "* Activating native persistent changes" echo "* Activating native persistent changes"
mount --bind "$CHANGES" "$2" mount --bind "$CHANGES" "$2"
return
fi fi
if [ -e "$CHANGES/changes.dat" ]; then
echo "* Restoring persistent changes"
EXISTS="true"
else
echo "* Creating new persistent changes"
EXISTS=""
fi
# test sparse file support. If supported, use it in favor of fynfilefs
dd if=/dev/zero of="$T1" seek=200k bs=1 count=0 >/dev/null 2>/dev/null && \
test "$(du -k "$T1" | sed -r "s/[^0-9].*//")" -lt 200
if [ $? -eq 0 ]; then
if [ ! "$EXISTS" ]; then
dd if=/dev/zero of="$CHANGES/changes.dat" seek=2000M bs=1 count=0 >/dev/null 2>&1
mke2fs -F "$CHANGES/changes.dat" >/dev/null 2>&1
fi
mount -o loop "$CHANGES/changes.dat" "$2"
else
@mount.dynfilefs "$CHANGES/changes.dat" 4000 "$2"
if [ ! "$EXISTS" ]; then
mke2fs -F "$2/loop.fs" >/dev/null 2>&1
fi
mount -o loop,sync "$2/loop.fs" "$2"
fi
# if test failed at any point, we may have temp files left behind
rm "$T1" "$T2" 2>/dev/null
rmdir "$2/lost+found" 2>/dev/null
} }