mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-08-06 17:16:12 +00:00
Fix Persistence intermittently fails on Ubuntu 24.04 (#3718)
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
find_cow_device() {
|
||||||
|
tgt_pers_label="${1}"
|
||||||
|
vt_pers_label=""
|
||||||
|
vt_pers_dev=""
|
||||||
|
|
||||||
|
if [ -f /ventoy/ventoy_persistent_label -a -f /ventoy/ventoy_persistent_dev ]; then
|
||||||
|
vt_pers_label=$(cat /ventoy/ventoy_persistent_label)
|
||||||
|
vt_pers_dev=$(cat /ventoy/ventoy_persistent_dev)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$tgt_pers_label" = "$vt_pers_label" ]; then
|
||||||
|
echo "$vt_pers_dev"
|
||||||
|
else
|
||||||
|
find_cow_device_back "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_cow_device_back() {
|
||||||
@@ -31,6 +31,19 @@ if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
|||||||
$SED "s#^ *LIVEMEDIA=.*#LIVEMEDIA=/dev/mapper/ventoy#" -i /scripts/casper
|
$SED "s#^ *LIVEMEDIA=.*#LIVEMEDIA=/dev/mapper/ventoy#" -i /scripts/casper
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#workaround for issue #3718
|
||||||
|
if [ -f $VTOY_PATH/ventoy_persistent_map -a -f /scripts/casper-helpers ]; then
|
||||||
|
echo 'fix casper cow udev issue' >> $VTLOG
|
||||||
|
if $GREP -q '^find_cow_device\(\).*{' /scripts/casper-helpers; then
|
||||||
|
VTINS_LINE=$($GREP -n '^find_cow_device\(\).*{' /scripts/casper-helpers | $AWK -F':' '{print $1}')
|
||||||
|
$AWK "NR < $VTINS_LINE" /scripts/casper-helpers > /ventoy/casper-helpers-tmp
|
||||||
|
$CAT $VTOY_PATH/hook/debian/casper-perst-wa.sh >> /ventoy/casper-helpers-tmp
|
||||||
|
$AWK "NR > $VTINS_LINE" /scripts/casper-helpers >> /ventoy/casper-helpers-tmp
|
||||||
|
$CAT /ventoy/casper-helpers-tmp > /scripts/casper-helpers
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ -e "$CD_DETECT" ]; then
|
elif [ -e "$CD_DETECT" ]; then
|
||||||
echo "$CD_DETECT exist, now add hook in it..." >> $VTLOG
|
echo "$CD_DETECT exist, now add hook in it..." >> $VTLOG
|
||||||
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i "$CD_DETECT"
|
$SED "1 a $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i "$CD_DETECT"
|
||||||
|
|||||||
@@ -512,6 +512,9 @@ ventoy_create_persistent_link() {
|
|||||||
VTLABEL=casper-rw
|
VTLABEL=casper-rw
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$VTLABEL" > $VTOY_PATH/ventoy_persistent_label
|
||||||
|
echo "/dev/$vtDM" > $VTOY_PATH/ventoy_persistent_dev
|
||||||
|
|
||||||
vtlog "Persistent Label: ##${VTLABEL}##"
|
vtlog "Persistent Label: ##${VTLABEL}##"
|
||||||
|
|
||||||
if ! [ -e /dev/disk/by-label/$VTLABEL ]; then
|
if ! [ -e /dev/disk/by-label/$VTLABEL ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user