mirror of https://github.com/ventoy/Ventoy
Compare commits
No commits in common. 'master' and 'v1.0.76' have entirely different histories.
@ -1,7 +0,0 @@
|
||||
|
||||
obj-m += dm_patch_ibt.o
|
||||
|
||||
EXTRA_CFLAGS := -Wall -DVTOY_IBT -fcf-protection=branch -mindirect-branch-register
|
||||
|
||||
dm_patch_ibt-objs := dmpatch.o
|
||||
|
@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
FTPIP=192.168.44.1
|
||||
FTPUSR='a:a'
|
||||
|
||||
rm -f dmpatch.c Makefile Makefile_IBT
|
||||
|
||||
for f in dmpatch.c Makefile Makefile_IBT; do
|
||||
curl -s -u $FTPUSR ftp://$FTPIP/$f -o $f
|
||||
if [ -f $f ]; then
|
||||
echo "download $f OK ..."
|
||||
else
|
||||
echo "download $f FAILED ..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
rm -f *.ko
|
||||
|
||||
|
||||
echo "build dm_patch.ko ..."
|
||||
rm -rf ./aa
|
||||
mkdir ./aa
|
||||
|
||||
cp -a *.c aa/
|
||||
cp -a Makefile aa/
|
||||
|
||||
cd /home/panda/linux-source-5.15.0
|
||||
make modules M=/home/panda/build/aa/
|
||||
strip --strip-debug /home/panda/build/aa/dm_patch.ko
|
||||
cd -
|
||||
|
||||
cp -a aa/dm_patch.ko ./
|
||||
|
||||
|
||||
|
||||
echo "build dm_patch_ibt.ko ..."
|
||||
rm -rf ./aa
|
||||
mkdir ./aa
|
||||
|
||||
cp -a *.c aa/
|
||||
cp -a Makefile_IBT aa/Makefile
|
||||
|
||||
cd /home/panda/linux-source-5.15.0
|
||||
make modules M=/home/panda/build/aa/
|
||||
strip --strip-debug /home/panda/build/aa/dm_patch_ibt.ko
|
||||
cd -
|
||||
|
||||
cp -a aa/dm_patch_ibt.ko ./
|
||||
|
||||
rm -rf ./aa
|
||||
|
||||
|
||||
curl -s -T dm_patch.ko -u $FTPUSR ftp://$FTPIP/dm_patch_64.ko || exit 1
|
||||
curl -s -T dm_patch_ibt.ko -u $FTPUSR ftp://$FTPIP/dm_patch_ibt_64.ko || exit 1
|
||||
|
||||
|
||||
if [ -f ./dm_patch.ko -a -f ./dm_patch_ibt.ko ]; then
|
||||
echo -e "\n\n=============== SUCCESS =============\n\n"
|
||||
else
|
||||
echo -e "\n\n=============== FAILED ==============\n\n"
|
||||
fi
|
||||
|
@ -1,250 +0,0 @@
|
||||
/* env.c - Environment variables */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/env.h>
|
||||
#include <grub/env_private.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
/* The initial context. */
|
||||
static struct grub_env_context initial_context;
|
||||
|
||||
/* The current context. */
|
||||
struct grub_env_context *grub_current_context = &initial_context;
|
||||
|
||||
static grub_env_read_hook_t vtoy_menu_lang_read_hook;
|
||||
|
||||
/* Return the hash representation of the string S. */
|
||||
static unsigned int
|
||||
grub_env_hashval (const char *s)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
/* XXX: This can be done much more efficiently. */
|
||||
while (*s)
|
||||
i += 5 * *(s++);
|
||||
|
||||
return i % HASHSZ;
|
||||
}
|
||||
|
||||
static struct grub_env_var *
|
||||
grub_env_find (const char *name)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
int idx = grub_env_hashval (name);
|
||||
|
||||
/* Look for the variable in the current context. */
|
||||
for (var = grub_current_context->vars[idx]; var; var = var->next)
|
||||
if (grub_strcmp (var->name, name) == 0)
|
||||
return var;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_env_insert (struct grub_env_context *context,
|
||||
struct grub_env_var *var)
|
||||
{
|
||||
int idx = grub_env_hashval (var->name);
|
||||
|
||||
/* Insert the variable into the hashtable. */
|
||||
var->prevp = &context->vars[idx];
|
||||
var->next = context->vars[idx];
|
||||
if (var->next)
|
||||
var->next->prevp = &(var->next);
|
||||
context->vars[idx] = var;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_env_remove (struct grub_env_var *var)
|
||||
{
|
||||
/* Remove the entry from the variable table. */
|
||||
*var->prevp = var->next;
|
||||
if (var->next)
|
||||
var->next->prevp = var->prevp;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_env_set (const char *name, const char *val)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
||||
/* If the variable does already exist, just update the variable. */
|
||||
var = grub_env_find (name);
|
||||
if (var)
|
||||
{
|
||||
char *old = var->value;
|
||||
|
||||
if (var->write_hook)
|
||||
var->value = var->write_hook (var, val);
|
||||
else
|
||||
var->value = grub_strdup (val);
|
||||
|
||||
if (! var->value)
|
||||
{
|
||||
var->value = old;
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_free (old);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* The variable does not exist, so create a new one. */
|
||||
var = grub_zalloc (sizeof (*var));
|
||||
if (! var)
|
||||
return grub_errno;
|
||||
|
||||
var->name = grub_strdup (name);
|
||||
if (! var->name)
|
||||
goto fail;
|
||||
|
||||
var->value = grub_strdup (val);
|
||||
if (! var->value)
|
||||
goto fail;
|
||||
|
||||
grub_env_insert (grub_current_context, var);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
fail:
|
||||
grub_free (var->name);
|
||||
grub_free (var->value);
|
||||
grub_free (var);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
const char *
|
||||
grub_env_get (const char *name)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
||||
if (name && vtoy_menu_lang_read_hook && grub_strncmp(name, "VTLANG_", 7) == 0)
|
||||
return vtoy_menu_lang_read_hook(NULL, name);
|
||||
|
||||
var = grub_env_find (name);
|
||||
if (! var)
|
||||
return 0;
|
||||
|
||||
if (var->read_hook)
|
||||
return var->read_hook (var, var->value);
|
||||
|
||||
return var->value;
|
||||
}
|
||||
|
||||
void
|
||||
grub_env_unset (const char *name)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
||||
var = grub_env_find (name);
|
||||
if (! var)
|
||||
return;
|
||||
|
||||
if (var->read_hook || var->write_hook)
|
||||
{
|
||||
grub_env_set (name, "");
|
||||
return;
|
||||
}
|
||||
|
||||
grub_env_remove (var);
|
||||
|
||||
grub_free (var->name);
|
||||
grub_free (var->value);
|
||||
grub_free (var);
|
||||
}
|
||||
|
||||
struct grub_env_var *
|
||||
grub_env_update_get_sorted (void)
|
||||
{
|
||||
struct grub_env_var *sorted_list = 0;
|
||||
int i;
|
||||
|
||||
/* Add variables associated with this context into a sorted list. */
|
||||
for (i = 0; i < HASHSZ; i++)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
||||
for (var = grub_current_context->vars[i]; var; var = var->next)
|
||||
{
|
||||
struct grub_env_var *p, **q;
|
||||
|
||||
for (q = &sorted_list, p = *q; p; q = &((*q)->sorted_next), p = *q)
|
||||
{
|
||||
if (grub_strcmp (p->name, var->name) > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
var->sorted_next = *q;
|
||||
*q = var;
|
||||
}
|
||||
}
|
||||
|
||||
return sorted_list;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_register_variable_hook (const char *name,
|
||||
grub_env_read_hook_t read_hook,
|
||||
grub_env_write_hook_t write_hook)
|
||||
{
|
||||
struct grub_env_var *var = grub_env_find (name);
|
||||
|
||||
if (! var)
|
||||
{
|
||||
if (grub_env_set (name, "") != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
var = grub_env_find (name);
|
||||
/* XXX Insert an assertion? */
|
||||
}
|
||||
|
||||
var->read_hook = read_hook;
|
||||
var->write_hook = write_hook;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_register_vtoy_menu_lang_hook(grub_env_read_hook_t read_hook)
|
||||
{
|
||||
vtoy_menu_lang_read_hook = read_hook;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_env_export (const char *name)
|
||||
{
|
||||
struct grub_env_var *var;
|
||||
|
||||
var = grub_env_find (name);
|
||||
if (! var)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
||||
err = grub_env_set (name, "");
|
||||
if (err)
|
||||
return err;
|
||||
var = grub_env_find (name);
|
||||
}
|
||||
var->global = 1;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_ENV_HEADER
|
||||
#define GRUB_ENV_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/menu.h>
|
||||
|
||||
struct grub_env_var;
|
||||
|
||||
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
struct grub_env_var
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
grub_env_read_hook_t read_hook;
|
||||
grub_env_write_hook_t write_hook;
|
||||
struct grub_env_var *next;
|
||||
struct grub_env_var **prevp;
|
||||
struct grub_env_var *sorted_next;
|
||||
int global;
|
||||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
const char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_update_get_sorted) (void);
|
||||
|
||||
#define FOR_SORTED_ENV(var) for (var = grub_env_update_get_sorted (); var; var = var->sorted_next)
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
|
||||
grub_env_read_hook_t read_hook,
|
||||
grub_env_write_hook_t write_hook);
|
||||
grub_err_t EXPORT_FUNC(grub_register_vtoy_menu_lang_hook) (grub_env_read_hook_t read_hook);
|
||||
|
||||
grub_err_t grub_env_context_open (void);
|
||||
grub_err_t grub_env_context_close (void);
|
||||
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
|
||||
|
||||
void grub_env_unset_menu (void);
|
||||
grub_menu_t grub_env_get_menu (void);
|
||||
void grub_env_set_menu (grub_menu_t nmenu);
|
||||
|
||||
grub_err_t
|
||||
grub_env_extractor_open (int source);
|
||||
|
||||
grub_err_t
|
||||
grub_env_extractor_close (int source);
|
||||
|
||||
|
||||
#endif /* ! GRUB_ENV_HEADER */
|
Binary file not shown.
Before Width: | Height: | Size: 437 KiB |
@ -1,32 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "wait for disk ..."
|
||||
$SLEEP 3
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
|
@ -1,22 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$SED "/maybe_break *premount/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/chimera/disk_hook.sh" -i /init
|
@ -1,43 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
NEWROOT=$(grep switch_root /init | awk '{print $3}')
|
||||
|
||||
for i in 'usr/bin' 'usr/sbin'; do
|
||||
if [ -f $NEWROOT/$i/udevadm ]; then
|
||||
UPATH=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
|
||||
sed "s#UPATH=.*#UPATH=/$UPATH#" -i /ventoy/hook/clear/udevadm
|
||||
sed "s#DM=.*#DM=$vtDM#" -i /ventoy/hook/clear/udevadm
|
||||
|
||||
|
||||
mv $NEWROOT/$UPATH/udevadm $NEWROOT/$UPATH/udevadm_bk
|
||||
cp -a /ventoy/hook/clear/udevadm $NEWROOT/$UPATH/udevadm
|
||||
chmod 777 $NEWROOT/$UPATH/udevadm
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
UPATH=/usr/bin
|
||||
DM=dm-0
|
||||
|
||||
rm -f $UPATH/udevadm
|
||||
mv $UPATH/udevadm_bk $UPATH/udevadm
|
||||
|
||||
echo 1 > /tmp/vthidden
|
||||
mount --bind /tmp/vthidden /sys/block/$DM/hidden
|
||||
|
||||
exec $UPATH/udevadm "$@"
|
@ -1,40 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "${vtdiskname#/dev/}2 found..."
|
||||
$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
|
||||
|
||||
if [ -f /ventoy/autoinstall ]; then
|
||||
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
|
||||
fi
|
@ -1,151 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
ventoy_os_install_dmsetup() {
|
||||
|
||||
vtlog "ventoy_os_install_dmsetup $1 ..."
|
||||
|
||||
vt_usb_disk=$1
|
||||
|
||||
# dump iso file location
|
||||
$VTOY_PATH/tool/vtoydm -i -f $VTOY_PATH/ventoy_image_map -d ${vt_usb_disk} > $VTOY_PATH/iso_file_list
|
||||
|
||||
# install dmsetup
|
||||
LINE=$($GREP ' dmsetup.*\.udeb' $VTOY_PATH/iso_file_list)
|
||||
if [ $? -eq 0 ]; then
|
||||
install_udeb_from_line "$LINE" ${vt_usb_disk}
|
||||
fi
|
||||
|
||||
# install libdevmapper
|
||||
LINE=$($GREP ' libdevmapper.*\.udeb' $VTOY_PATH/iso_file_list)
|
||||
if [ $? -eq 0 ]; then
|
||||
install_udeb_from_line "$LINE" ${vt_usb_disk}
|
||||
fi
|
||||
|
||||
# install md-modules
|
||||
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
|
||||
if [ $? -eq 0 ]; then
|
||||
LINTCNT=$($GREP -i -c ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
|
||||
if [ $LINTCNT -gt 1 ]; then
|
||||
vtlog "more than one pkgs, need to filter..."
|
||||
VER=$($BUSYBOX_PATH/uname -r)
|
||||
|
||||
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i $VER)
|
||||
LINTCNT=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -c $VER)
|
||||
if [ $LINTCNT -gt 1 ]; then
|
||||
vtlog "Still more than one pkgs, use the first one..."
|
||||
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -m1 $VER)
|
||||
fi
|
||||
fi
|
||||
install_udeb_from_line "$LINE" ${vt_usb_disk}
|
||||
fi
|
||||
|
||||
# insmod md-mod if needed
|
||||
if $GREP -q 'device-mapper' /proc/devices; then
|
||||
vtlog "device mapper module is loaded"
|
||||
else
|
||||
vtlog "device mapper module is NOT loaded, now load it..."
|
||||
|
||||
VER=$($BUSYBOX_PATH/uname -r)
|
||||
KO=$($FIND /lib/modules/$VER/kernel/drivers/md -name "dm-mod*")
|
||||
vtlog "KO=$KO"
|
||||
|
||||
insmod $KO
|
||||
fi
|
||||
|
||||
vtlog "dmsetup install finish, now check it..."
|
||||
if dmsetup info >> $VTLOG 2>&1; then
|
||||
vtlog "dmsetup work ok"
|
||||
else
|
||||
vtlog "dmsetup not work, now try to load eglibc ..."
|
||||
|
||||
# install eglibc (some ubuntu 32 bit version need it)
|
||||
LINE=$($GREP 'libc6-.*\.udeb' $VTOY_PATH/iso_file_list)
|
||||
if [ $? -eq 0 ]; then
|
||||
install_udeb_from_line "$LINE" ${vt_usb_disk}
|
||||
fi
|
||||
|
||||
if dmsetup info >> $VTLOG 2>&1; then
|
||||
vtlog "dmsetup work ok after retry"
|
||||
else
|
||||
vtlog "dmsetup still not work after retry"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "==== $0 $* ===="
|
||||
|
||||
dmsetup_path=$(ventoy_find_bin_path dmsetup)
|
||||
if [ -z "$dmsetup_path" ]; then
|
||||
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
||||
fi
|
||||
|
||||
if ! $GREP -q 'device-mapper' /proc/devices; then
|
||||
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook $*
|
||||
|
||||
#
|
||||
# Some distro default only accept usb partitions as install medium.
|
||||
# So if ventoy is installed on a non-USB device, we just mount /cdrom here except
|
||||
# for these has boot=live or boot=casper parameter in cmdline
|
||||
#
|
||||
VT_BUS_USB=""
|
||||
if [ -n "$ID_BUS" ]; then
|
||||
if echo $ID_BUS | $GREP -q -i usb; then
|
||||
VT_BUS_USB="YES"
|
||||
fi
|
||||
else
|
||||
if $BUSYBOX_PATH/ls -l /sys/class/block/${1:0:-1} | $GREP -q -i usb; then
|
||||
VT_BUS_USB="YES"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$VT_BUS_USB" ]; then
|
||||
vtlog "$1 is USB device"
|
||||
echo /dev/$1 > /ventoy/list-devices-usb-part
|
||||
else
|
||||
vtlog "$1 is NOT USB device (bus $ID_BUS)"
|
||||
|
||||
if $EGREP -q 'boot=|casper' /proc/cmdline; then
|
||||
vtlog "boot=, or casper, don't mount"
|
||||
else
|
||||
vtlog "No boot param, need to mount"
|
||||
echo /dev/$1 > /ventoy/list-devices-usb-part
|
||||
fi
|
||||
fi
|
||||
|
||||
#special process for Linx
|
||||
if $BUSYBOX_PATH/uname -r | $GREP -q "^2\.6"; then
|
||||
if $GREP -q "linx" /proc/version; then
|
||||
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
echo "/dev/$vtDM" > /ventoy/list-devices-usb-part
|
||||
fi
|
||||
fi
|
||||
|
||||
# OK finish
|
||||
set_ventoy_hook_finish
|
@ -1,42 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
|
||||
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||
echo "Here before mountroot ..." >> $VTLOG
|
||||
|
||||
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/deepin/disk_mount_hook.sh" -i /init
|
||||
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
|
||||
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
|
||||
|
||||
if $GREP -q 'live-media=' /proc/cmdline; then
|
||||
if [ -f /scripts/casper ] && $GREP -q '^ *LIVEMEDIA=' /scripts/casper; then
|
||||
$SED "s#^ *LIVEMEDIA=.*#LIVEMEDIA=/dev/mapper/ventoy#" -i /scripts/casper
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Here use udev hook ..." >> $VTLOG
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/deepin/udev_disk_hook.sh %k"
|
||||
fi
|
||||
|
||||
if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
echo "Do auto install ..." >> $VTLOG
|
||||
$SED '/maybe_break[[:space:]]*init/i\/ventoy/busybox/sh /ventoy/hook/deepin/ventoy_autoinstall.sh >>/ventoy/autoinstall.log 2>&1' -i /init
|
||||
fi
|
@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2022, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
PATH=$PATH:/ventoy/busybox:/ventoy/tool
|
||||
|
||||
vlog() {
|
||||
echo "$@" >> /ventoy/autoinstall.log
|
||||
}
|
||||
|
||||
if grep -q '\$\$VT_' /ventoy/autoinstall; then
|
||||
vlog "======== auto install variables expansion ======="
|
||||
else
|
||||
vlog "======== auto install variables expansion no need ======="
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /ventoy/ventoy_os_param ]; then
|
||||
VTOYDISK=$(vtoydump -f /ventoy/ventoy_os_param | awk -F'#' '{print $1}')
|
||||
vlog VTOYDISK=$VTOYDISK
|
||||
|
||||
if [ -b "$VTOYDISK" ]; then
|
||||
vlog "$VTOYDISK exist OK"
|
||||
else
|
||||
vlog "$VTOYDISK does NOT exist"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$1" -a -f "$1" ]; then
|
||||
vtoyexpand "$1" "$VTOYDISK"
|
||||
else
|
||||
vlog "File $1 not exist"
|
||||
fi
|
||||
else
|
||||
vlog "os param file not exist"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -1,118 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "######### $0 $* ############"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
|
||||
ventoy_os_install_dmsetup_by_fuse() {
|
||||
vtlog "ventoy_os_install_dmsetup_by_fuse $*"
|
||||
|
||||
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso $VTOY_PATH/mnt/squashfs
|
||||
|
||||
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
|
||||
vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
|
||||
|
||||
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
|
||||
|
||||
sfsfile=$VTOY_PATH/mnt/iso/kdeos/x86_64/root-image.sqfs
|
||||
|
||||
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
|
||||
|
||||
kVer=$(uname -r)
|
||||
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$kVer/kernel/drivers/md/dm-mod.ko*)
|
||||
vtlog "insmod $KoName"
|
||||
|
||||
if echo $KoName | grep -q '\.zst'; then
|
||||
zstdcat $KoName > $VTOY_PATH/dm-mod.ko
|
||||
insmod $VTOY_PATH/dm-mod.ko
|
||||
else
|
||||
insmod $KoName
|
||||
fi
|
||||
|
||||
ventoy_check_umount $VTOY_PATH/mnt/squashfs
|
||||
ventoy_check_umount $VTOY_PATH/mnt/iso
|
||||
ventoy_check_umount $VTOY_PATH/mnt/fuse
|
||||
vtlog "umount done"
|
||||
}
|
||||
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if grep -q 'device-mapper' /proc/devices; then
|
||||
vtlog "device-mapper module exist"
|
||||
else
|
||||
ventoy_os_install_dmsetup_by_fuse $vtdiskname
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
|
||||
|
||||
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
|
||||
vtDM=$(ventoy_find_dm_id ${blkdev_num})
|
||||
vtlog "blkdev_num=$blkdev_num vtDM=$vtDM ..."
|
||||
|
||||
while [ -n "Y" ]; do
|
||||
if [ -b /dev/$vtDM ]; then
|
||||
break
|
||||
else
|
||||
sleep 0.3
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
vtlog "ln -s /dev/$vtDM $1"
|
||||
|
||||
if [ -e "$1" ]; then
|
||||
vtlog "$1 already exist"
|
||||
else
|
||||
ln -s /dev/$vtDM "$1"
|
||||
fi
|
||||
else
|
||||
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
|
||||
vtlog "vtLABEL is $vtLABEL"
|
||||
|
||||
if [ -z "$vtLABEL" ]; then
|
||||
vtLABEL=$($SED "s/.*label=\([^ ]*\)/\1/" /proc/cmdline)
|
||||
vtlog "vtLABEL is $vtLABEL from cmdline"
|
||||
fi
|
||||
|
||||
if [ -e "/dev/disk/by-label/$vtLABEL" ]; then
|
||||
vtlog "$1 already exist"
|
||||
else
|
||||
ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
|
||||
fi
|
||||
fi
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
# OK finish
|
||||
set_ventoy_hook_finish
|
@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2022, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
if [ -f /run/install/ks.cfg ]; then
|
||||
sh /ventoy/hook/default/auto_install_varexp.sh /run/install/ks.cfg
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2022, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
PATH=$PATH:/ventoy/busybox:/ventoy/tool
|
||||
|
||||
if grep -q '\$\$VT_' /ventoy/autoinstall; then
|
||||
:
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /sbin/hald ]; then
|
||||
mv /sbin/hald /sbin/hald_bk
|
||||
cp -a /ventoy/tool/hald /sbin/hald
|
||||
|
||||
rm -f "/ventoy/loader_exec_cmdline"
|
||||
echo "/bin/sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall" > "/ventoy/loader_hook_cmd"
|
||||
echo -n "/sbin/hald_bk" > "/ventoy/loader_exec_file"
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2022, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
if [ -f /run/install/ks.cfg ]; then
|
||||
sh /ventoy/hook/default/auto_install_varexp.sh /run/install/ks.cfg
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,26 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2023, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtHook=$($CAT $VTOY_PATH/inotifyd-hook-script.txt)
|
||||
|
||||
vtdisk=$(get_ventoy_disk_name)
|
||||
vtlog "... $vtdisk already exist ..."
|
||||
$BUSYBOX_PATH/sh $vtHook n /dev "${vtdisk#/dev/}2"
|
@ -1,23 +0,0 @@
|
||||
#!/ventoy/busybox/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. $VTOY_PATH/hook/ventoy-os-lib.sh
|
||||
|
||||
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/loop/fwts/ventoy-disk.sh" -i /init
|
||||
#$SED "/^mountroot$/i\\export ROOT=/dev/mapper/ventoy" -i /init
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue