mirror of
https://github.com/ventoy/Ventoy.git
synced 2026-11-30 17:36:19 +01:00
Fix the storage probe issue for Ubuntu Server 2604/2404 (#3810)
This commit is contained in:
@@ -6,7 +6,7 @@ Type=oneshot
|
|||||||
ExecStart=-/bin/sh /etc/ventoy_curtin/ventoy-curtin-wa.sh
|
ExecStart=-/bin/sh /etc/ventoy_curtin/ventoy-curtin-wa.sh
|
||||||
ExecStartPost=-/bin/sh -c '\
|
ExecStartPost=-/bin/sh -c '\
|
||||||
rm -f /etc/systemd/system/ventoy-curtin-wa.service;\
|
rm -f /etc/systemd/system/ventoy-curtin-wa.service;\
|
||||||
rm -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf;\
|
rm -f XXXX/10-ventoy-curtin-wa.conf;\
|
||||||
rm -rf /etc/ventoy_curtin;\
|
rm -rf /etc/ventoy_curtin;\
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,10 @@ set -x
|
|||||||
|
|
||||||
if [ -e /tmp/ventoy_storage_config.py ]; then
|
if [ -e /tmp/ventoy_storage_config.py ]; then
|
||||||
echo "no need to patch again"
|
echo "no need to patch again"
|
||||||
elif [ -d /snap/ubuntu-desktop-bootstrap/current/lib ]; then
|
else
|
||||||
PyVer=$(ls -1 /snap/ubuntu-desktop-bootstrap/current/lib | grep -m1 python)
|
|
||||||
echo "Python Path: $PyVer"
|
|
||||||
|
|
||||||
OldFile=/snap/ubuntu-desktop-bootstrap/current/lib/$PyVer/site-packages/curtin/storage_config.py
|
|
||||||
NewFile=/tmp/ventoy_storage_config.py
|
NewFile=/tmp/ventoy_storage_config.py
|
||||||
|
OldFile=$(find /snap -type f -path '*curtin/storage_config.py' -print -quit 2>/dev/null)
|
||||||
if [ -e $OldFile ]; then
|
if [ -n "$OldFile" ]; then
|
||||||
echo "Patch curtin storage config script"
|
echo "Patch curtin storage config script"
|
||||||
cp -a $OldFile $NewFile
|
cp -a $OldFile $NewFile
|
||||||
|
|
||||||
@@ -22,6 +18,4 @@ elif [ -d /snap/ubuntu-desktop-bootstrap/current/lib ]; then
|
|||||||
else
|
else
|
||||||
echo "curin file not exist"
|
echo "curin file not exist"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "curin snap dir not exit"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,16 +7,25 @@ PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
|||||||
vtlog "####### $0 $* ########"
|
vtlog "####### $0 $* ########"
|
||||||
|
|
||||||
subiquity_curtin_workaround() {
|
subiquity_curtin_workaround() {
|
||||||
mkdir -p /root/etc/ventoy_curtin
|
local newroot=$1
|
||||||
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.sh /root/etc/ventoy_curtin/ventoy-curtin-wa.sh 0755
|
local vtDepName=''
|
||||||
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.conf /root/etc/ventoy_curtin/ventoy-curtin-wa.conf 0644
|
local vtDepDir=''
|
||||||
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.service /root/etc/ventoy_curtin/ventoy-curtin-wa.service 0644
|
|
||||||
|
mkdir -p $newroot/etc/ventoy_curtin
|
||||||
|
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.sh $newroot/etc/ventoy_curtin/ventoy-curtin-wa.sh 0755
|
||||||
|
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.conf $newroot/etc/ventoy_curtin/ventoy-curtin-wa.conf 0644
|
||||||
|
ventoy_copy_file /ventoy/hook/debian/ventoy-curtin-wa.service $newroot/etc/ventoy_curtin/ventoy-curtin-wa.service 0644
|
||||||
|
|
||||||
ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.service /root/etc/systemd/system/ventoy-curtin-wa.service
|
ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.service $newroot/etc/systemd/system/ventoy-curtin-wa.service
|
||||||
|
|
||||||
vtDepDir=/root/etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d
|
vtDepName=$(ls -1 $newroot/etc/systemd/system/ | grep 'snap.*subiquity-server.service' | head -n 1)
|
||||||
|
vtDepDir=$newroot/etc/systemd/system/${vtDepName}.d
|
||||||
|
vtlog "Depend dir is $vtDepDir"
|
||||||
|
|
||||||
mkdir -p $vtDepDir
|
mkdir -p $vtDepDir
|
||||||
ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.conf $vtDepDir/10-ventoy-curtin-wa.conf
|
ln -sf /etc/ventoy_curtin/ventoy-curtin-wa.conf $vtDepDir/10-ventoy-curtin-wa.conf
|
||||||
|
|
||||||
|
sed "s#XXXX#/etc/systemd/system/${vtDepName}.d#g" -i $newroot/etc/ventoy_curtin/ventoy-curtin-wa.service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,10 +34,12 @@ if [ -z "$vroot" ]; then
|
|||||||
vtlog "new sysroot not found"
|
vtlog "new sysroot not found"
|
||||||
else
|
else
|
||||||
ventoy_copy_udev_auto_rules
|
ventoy_copy_udev_auto_rules
|
||||||
if ls $vroot/etc/udev/rules.d | grep -q 'snap.*desktop'; then
|
|
||||||
subiquity_curtin_workaround
|
if ls -l $vroot/etc/systemd/system | grep -q 'snap.*subiquity-server.service'; then
|
||||||
|
vtlog "do snap subiquity workaround"
|
||||||
|
subiquity_curtin_workaround $vroot
|
||||||
else
|
else
|
||||||
vtlog "no snap desktop detected"
|
vtlog "no snap subiquity detected"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,6 @@ rm -f /etc/systemd/system-preset/80-ventoy-udev.preset
|
|||||||
rm -f /etc/systemd/system/sysinit.target.wants/ventoy-udev*.service
|
rm -f /etc/systemd/system/sysinit.target.wants/ventoy-udev*.service
|
||||||
rm -f /etc/systemd/system/ventoy-udev*.service
|
rm -f /etc/systemd/system/ventoy-udev*.service
|
||||||
|
|
||||||
if [ -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf ]; then
|
|
||||||
if [ -e /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service ]; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
rm -f /etc/systemd/system/ventoy-curtin-wa.service
|
|
||||||
rm -f /etc/systemd/system/snap.ubuntu-desktop-bootstrap.subiquity-server.service.d/10-ventoy-curtin-wa.conf
|
|
||||||
rm -rf /etc/ventoy_curtin
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mkdir -p /run/udev/rules.d
|
mkdir -p /run/udev/rules.d
|
||||||
mv /etc/udev/rules.d/*ventoy* /run/udev/rules.d/
|
mv /etc/udev/rules.d/*ventoy* /run/udev/rules.d/
|
||||||
|
|||||||
Reference in New Issue
Block a user