$SED "/searching *for *\$CFG *file/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-disk.sh" -i $1
}
-if $GREP -q exfat /proc/filesystems; then
- vtPath=$($VTOY_PATH/tool/vtoydump -p $VTOY_PATH/ventoy_os_param)
-
+vtPath=$($VTOY_PATH/tool/vtoydump -p $VTOY_PATH/ventoy_os_param)
+echo $vtPath | $GREP -q " "
+_vtRet1=$?
+
+$GREP -q exfat /proc/filesystems
+_vtRet2=$?
+
+echo "_vtRet1=$_vtRet1 _vtRet2=$_vtRet2 ..." >> $VTLOG
+
+if [ $_vtRet1 -ne 0 -a $_vtRet2 -eq 0 ]; then
vtFindFlag=0
$GREP '`value from`' /usr/* -r | $AWK -F: '{print $1}' | while read vtline; do
echo "hooking $vtline ..." >> $VTLOG
if [ $vtFindFlag -eq 0 ]; then
if $GREP -q '`value from`' /linuxrc; then
- echo "hooking linuxrc ..." >> $VTLOG
- $SED "/searching *for *\$CFG *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh" -i /linuxrc
- $SED "/searching *for *\$CFG *file/iFROM=\$(cat /porteus-from)" -i /linuxrc
- $SED "/searching *for *\$CFG *file/iISO=\$(cat /porteus-from)" -i /linuxrc
- vtFindFlag=1
+ if $GREP -q "searching *for *\$CFG *file" /linuxrc; then
+ echo "hooking linuxrc CFG..." >> $VTLOG
+ $SED "/searching *for *\$CFG *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh" -i /linuxrc
+ $SED "/searching *for *\$CFG *file/iFROM=\$(cat /porteus-from)" -i /linuxrc
+ $SED "/searching *for *\$CFG *file/iISO=\$(cat /porteus-from)" -i /linuxrc
+ vtFindFlag=1
+ else
+ echo "hooking linuxrc SGN..." >> $VTLOG
+ $SED "/searching *for *\$SGN *file/i$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/porteus-path.sh" -i /linuxrc
+ $SED "/searching *for *\$SGN *file/iFROM=\$(cat /porteus-from)" -i /linuxrc
+ $SED "/searching *for *\$SGN *file/iISO=\$(cat /porteus-from)" -i /linuxrc
+ vtFindFlag=1
+ fi
fi
fi
for vtfile in '/linuxrc' '/init'; do
if [ -e $vtfile ]; then
if ! $GREP -q ventoy $vtfile; then
- echo "hooking $vtfile ..." >> $VTLOG
+ echo "hooking disk $vtfile ..." >> $VTLOG
porteus_hook $vtfile
fi
fi
return 0;
}
+static int vtoy_printf_fs(ventoy_os_param *param)
+{
+ const char *fs[] =
+ {
+ "exfat", "ntfs", "ext", "xfs", "udf", "fat"
+ };
+
+ if (param->vtoy_disk_part_type < 6)
+ {
+ printf("%s\n", fs[param->vtoy_disk_part_type]);
+ }
+ else
+ {
+ printf("unknown\n");
+ }
+ return 0;
+}
+
static int vtoy_check_device(ventoy_os_param *param, const char *device)
{
unsigned long long size;
int rc;
int ch;
int print_path = 0;
+ int print_fs = 0;
char filename[256] = {0};
char diskname[256] = {0};
char device[64] = {0};
ventoy_os_param *param = NULL;
- while ((ch = getopt(argc, argv, "c:f:p:v::")) != -1)
+ while ((ch = getopt(argc, argv, "c:f:p:s:v::")) != -1)
{
if (ch == 'f')
{
print_path = 1;
strncpy(filename, optarg, sizeof(filename) - 1);
}
+ else if (ch == 's')
+ {
+ print_fs = 1;
+ strncpy(filename, optarg, sizeof(filename) - 1);
+ }
else
{
fprintf(stderr, "Usage: %s -f datafile [ -v ] \n", argv[0]);
{
rc = vtoy_printf_iso_path(param);
}
+ else if (print_fs)
+ {
+ rc = vtoy_printf_fs(param);
+ }
else if (device[0])
{
rc = vtoy_check_device(param, device);