mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ext2fs] automated persistence set up for Debian Live & Ubuntu
* Only UEFI boot for now (GRUB) & requires a post 2019.07.26 ISO for Ubuntu. * This adds the relevant persistence/persistent kernel option to the conf file, sets the expected volume label and creates a /persistence.conf file where needed. * Also improve token parsing by ensuring a token is followed by at least one white space.
This commit is contained in:
parent
307e2f7075
commit
fcb15ab6e9
11 changed files with 331 additions and 23 deletions
|
@ -75,6 +75,7 @@
|
|||
<ClCompile Include="..\src\ext2fs\mkdir.c" />
|
||||
<ClCompile Include="..\src\ext2fs\mkjournal.c" />
|
||||
<ClCompile Include="..\src\ext2fs\mmp.c" />
|
||||
<ClCompile Include="..\src\ext2fs\namei.c" />
|
||||
<ClCompile Include="..\src\ext2fs\newdir.c" />
|
||||
<ClCompile Include="..\src\ext2fs\nt_io.c" />
|
||||
<ClCompile Include="..\src\ext2fs\openfs.c" />
|
||||
|
|
|
@ -159,6 +159,9 @@
|
|||
<ClCompile Include="..\src\ext2fs\openfs.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\ext2fs\namei.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\ext2fs\ext2_fs.h">
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#define FP_DUPLICATE_METADATA 0x00000008
|
||||
#define FP_LARGE_FAT32 0x00010000
|
||||
#define FP_NO_BOOT 0x00020000
|
||||
#define FP_CREATE_PERSISTENCE_CONF 0x00040000
|
||||
|
||||
#define FILE_FLOPPY_DISKETTE 0x00000004
|
||||
|
||||
|
@ -359,7 +360,6 @@ typedef struct {
|
|||
} ClusterSize[FS_MAX];
|
||||
} RUFUS_DRIVE_INFO;
|
||||
extern RUFUS_DRIVE_INFO SelectedDrive;
|
||||
extern uint64_t persistence_size;
|
||||
extern DWORD partition_index[3];
|
||||
|
||||
BOOL SetAutoMount(BOOL enable);
|
||||
|
|
|
@ -4,7 +4,7 @@ libext2fs_a_SOURCES = alloc.c alloc_sb.c alloc_stats.c alloc_tables.c badblocks.
|
|||
bitmaps.c bitops.c blkmap64_ba.c blkmap64_rb.c blknum.c block.c bmap.c closefs.c crc16.c \
|
||||
crc32c.c csum.c dirblock.c dir_iterate.c extent.c ext_attr.c extent.c fallocate.c fileio.c \
|
||||
freefs.c gen_bitmap.c gen_bitmap64.c get_num_dirs.c hashmap.c i_block.c ind_block.c initialize.c \
|
||||
inline.c inline_data.c inode.c io_manager.c link.c lookup.c mkdir.c mkjournal.c mmp.c newdir.c \
|
||||
nt_io.c openfs.c punch.c rbtree.c read_bb.c rw_bitmaps.c sha512.c symlink.c valid_blk.c
|
||||
inline.c inline_data.c inode.c io_manager.c link.c lookup.c mkdir.c mkjournal.c namei.c mmp.c \
|
||||
newdir.c nt_io.c openfs.c punch.c rbtree.c read_bb.c rw_bitmaps.c sha512.c symlink.c valid_blk.c
|
||||
|
||||
libext2fs_a_CFLAGS = $(AM_CFLAGS) -DEXT2_FLAT_INCLUDES=0 -DHAVE_CONFIG_H -I. -I.. -Wno-undef -Wno-strict-aliasing -Wno-shadow
|
||||
|
|
|
@ -117,12 +117,13 @@ am_libext2fs_a_OBJECTS = libext2fs_a-alloc.$(OBJEXT) \
|
|||
libext2fs_a-inline_data.$(OBJEXT) libext2fs_a-inode.$(OBJEXT) \
|
||||
libext2fs_a-io_manager.$(OBJEXT) libext2fs_a-link.$(OBJEXT) \
|
||||
libext2fs_a-lookup.$(OBJEXT) libext2fs_a-mkdir.$(OBJEXT) \
|
||||
libext2fs_a-mkjournal.$(OBJEXT) libext2fs_a-mmp.$(OBJEXT) \
|
||||
libext2fs_a-newdir.$(OBJEXT) libext2fs_a-nt_io.$(OBJEXT) \
|
||||
libext2fs_a-openfs.$(OBJEXT) libext2fs_a-punch.$(OBJEXT) \
|
||||
libext2fs_a-rbtree.$(OBJEXT) libext2fs_a-read_bb.$(OBJEXT) \
|
||||
libext2fs_a-rw_bitmaps.$(OBJEXT) libext2fs_a-sha512.$(OBJEXT) \
|
||||
libext2fs_a-symlink.$(OBJEXT) libext2fs_a-valid_blk.$(OBJEXT)
|
||||
libext2fs_a-mkjournal.$(OBJEXT) libext2fs_a-namei.$(OBJEXT) \
|
||||
libext2fs_a-mmp.$(OBJEXT) libext2fs_a-newdir.$(OBJEXT) \
|
||||
libext2fs_a-nt_io.$(OBJEXT) libext2fs_a-openfs.$(OBJEXT) \
|
||||
libext2fs_a-punch.$(OBJEXT) libext2fs_a-rbtree.$(OBJEXT) \
|
||||
libext2fs_a-read_bb.$(OBJEXT) libext2fs_a-rw_bitmaps.$(OBJEXT) \
|
||||
libext2fs_a-sha512.$(OBJEXT) libext2fs_a-symlink.$(OBJEXT) \
|
||||
libext2fs_a-valid_blk.$(OBJEXT)
|
||||
libext2fs_a_OBJECTS = $(am_libext2fs_a_OBJECTS)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
|
@ -274,8 +275,8 @@ libext2fs_a_SOURCES = alloc.c alloc_sb.c alloc_stats.c alloc_tables.c badblocks.
|
|||
bitmaps.c bitops.c blkmap64_ba.c blkmap64_rb.c blknum.c block.c bmap.c closefs.c crc16.c \
|
||||
crc32c.c csum.c dirblock.c dir_iterate.c extent.c ext_attr.c extent.c fallocate.c fileio.c \
|
||||
freefs.c gen_bitmap.c gen_bitmap64.c get_num_dirs.c hashmap.c i_block.c ind_block.c initialize.c \
|
||||
inline.c inline_data.c inode.c io_manager.c link.c lookup.c mkdir.c mkjournal.c mmp.c newdir.c \
|
||||
nt_io.c openfs.c punch.c rbtree.c read_bb.c rw_bitmaps.c sha512.c symlink.c valid_blk.c
|
||||
inline.c inline_data.c inode.c io_manager.c link.c lookup.c mkdir.c mkjournal.c namei.c mmp.c \
|
||||
newdir.c nt_io.c openfs.c punch.c rbtree.c read_bb.c rw_bitmaps.c sha512.c symlink.c valid_blk.c
|
||||
|
||||
libext2fs_a_CFLAGS = $(AM_CFLAGS) -DEXT2_FLAT_INCLUDES=0 -DHAVE_CONFIG_H -I. -I.. -Wno-undef -Wno-strict-aliasing -Wno-shadow
|
||||
all: all-am
|
||||
|
@ -567,6 +568,12 @@ libext2fs_a-mkjournal.o: mkjournal.c
|
|||
libext2fs_a-mkjournal.obj: mkjournal.c
|
||||
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libext2fs_a_CFLAGS) $(CFLAGS) -c -o libext2fs_a-mkjournal.obj `if test -f 'mkjournal.c'; then $(CYGPATH_W) 'mkjournal.c'; else $(CYGPATH_W) '$(srcdir)/mkjournal.c'; fi`
|
||||
|
||||
libext2fs_a-namei.o: namei.c
|
||||
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libext2fs_a_CFLAGS) $(CFLAGS) -c -o libext2fs_a-namei.o `test -f 'namei.c' || echo '$(srcdir)/'`namei.c
|
||||
|
||||
libext2fs_a-namei.obj: namei.c
|
||||
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libext2fs_a_CFLAGS) $(CFLAGS) -c -o libext2fs_a-namei.obj `if test -f 'namei.c'; then $(CYGPATH_W) 'namei.c'; else $(CYGPATH_W) '$(srcdir)/namei.c'; fi`
|
||||
|
||||
libext2fs_a-mmp.o: mmp.c
|
||||
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libext2fs_a_CFLAGS) $(CFLAGS) -c -o libext2fs_a-mmp.o `test -f 'mmp.c' || echo '$(srcdir)/'`mmp.c
|
||||
|
||||
|
|
227
src/ext2fs/namei.c
Normal file
227
src/ext2fs/namei.c
Normal file
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
* namei.c --- ext2fs directory lookup operations
|
||||
*
|
||||
* Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o.
|
||||
*
|
||||
* %Begin-Header%
|
||||
* This file may be redistributed under the terms of the GNU Library
|
||||
* General Public License, version 2.
|
||||
* %End-Header%
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* #define NAMEI_DEBUG */
|
||||
|
||||
#include "ext2_fs.h"
|
||||
#include "ext2fs.h"
|
||||
#include "ext2fsP.h"
|
||||
|
||||
static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
|
||||
const char *pathname, size_t pathlen, int follow,
|
||||
int link_count, char *buf, ext2_ino_t *res_inode);
|
||||
|
||||
static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
|
||||
ext2_ino_t inode, int link_count,
|
||||
char *buf, ext2_ino_t *res_inode)
|
||||
{
|
||||
char *pathname;
|
||||
char *buffer = 0;
|
||||
errcode_t retval;
|
||||
struct ext2_inode ei;
|
||||
blk64_t blk;
|
||||
|
||||
#ifdef NAMEI_DEBUG
|
||||
printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n",
|
||||
root, dir, inode, link_count);
|
||||
|
||||
#endif
|
||||
retval = ext2fs_read_inode (fs, inode, &ei);
|
||||
if (retval) return retval;
|
||||
if (!LINUX_S_ISLNK (ei.i_mode)) {
|
||||
*res_inode = inode;
|
||||
return 0;
|
||||
}
|
||||
if (link_count++ >= EXT2FS_MAX_NESTED_LINKS)
|
||||
return EXT2_ET_SYMLINK_LOOP;
|
||||
|
||||
if (ext2fs_is_fast_symlink(&ei))
|
||||
pathname = (char *)&(ei.i_block[0]);
|
||||
else if (ei.i_flags & EXT4_INLINE_DATA_FL) {
|
||||
retval = ext2fs_get_memzero(ei.i_size, &buffer);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = ext2fs_inline_data_get(fs, inode,
|
||||
&ei, buffer, NULL);
|
||||
if (retval) {
|
||||
ext2fs_free_mem(&buffer);
|
||||
return retval;
|
||||
}
|
||||
pathname = buffer;
|
||||
} else {
|
||||
retval = ext2fs_bmap2(fs, inode, &ei, NULL, 0, 0, NULL, &blk);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = ext2fs_get_mem(fs->blocksize, &buffer);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = io_channel_read_blk64(fs->io, blk, 1, buffer);
|
||||
if (retval) {
|
||||
ext2fs_free_mem(&buffer);
|
||||
return retval;
|
||||
}
|
||||
pathname = buffer;
|
||||
}
|
||||
|
||||
retval = open_namei(fs, root, dir, pathname, ei.i_size, 1,
|
||||
link_count, buf, res_inode);
|
||||
if (buffer)
|
||||
ext2fs_free_mem(&buffer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine interprets a pathname in the context of the current
|
||||
* directory and the root directory, and returns the inode of the
|
||||
* containing directory, and a pointer to the filename of the file
|
||||
* (pointing into the pathname) and the length of the filename.
|
||||
*/
|
||||
static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
|
||||
const char *pathname, int pathlen,
|
||||
int link_count, char *buf,
|
||||
const char **name, int *namelen,
|
||||
ext2_ino_t *res_inode)
|
||||
{
|
||||
char c;
|
||||
const char *thisname;
|
||||
int len;
|
||||
ext2_ino_t inode;
|
||||
errcode_t retval;
|
||||
|
||||
if ((c = *pathname) == '/') {
|
||||
dir = root;
|
||||
pathname++;
|
||||
pathlen--;
|
||||
}
|
||||
while (1) {
|
||||
thisname = pathname;
|
||||
for (len=0; --pathlen >= 0;len++) {
|
||||
c = *(pathname++);
|
||||
if (c == '/')
|
||||
break;
|
||||
}
|
||||
if (pathlen < 0)
|
||||
break;
|
||||
retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode);
|
||||
if (retval) return retval;
|
||||
retval = follow_link (fs, root, dir, inode,
|
||||
link_count, buf, &dir);
|
||||
if (retval) return retval;
|
||||
}
|
||||
*name = thisname;
|
||||
*namelen = len;
|
||||
*res_inode = dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
|
||||
const char *pathname, size_t pathlen, int follow,
|
||||
int link_count, char *buf, ext2_ino_t *res_inode)
|
||||
{
|
||||
const char *base_name;
|
||||
int namelen;
|
||||
ext2_ino_t dir, inode;
|
||||
errcode_t retval;
|
||||
|
||||
#ifdef NAMEI_DEBUG
|
||||
printf("open_namei: root=%lu, dir=%lu, path=%.*s, lc=%d\n",
|
||||
root, base, pathlen, pathname, link_count);
|
||||
#endif
|
||||
retval = dir_namei(fs, root, base, pathname, pathlen,
|
||||
link_count, buf, &base_name, &namelen, &dir);
|
||||
if (retval) return retval;
|
||||
if (!namelen) { /* special case: '/usr/' etc */
|
||||
*res_inode=dir;
|
||||
return 0;
|
||||
}
|
||||
retval = ext2fs_lookup (fs, dir, base_name, namelen, buf, &inode);
|
||||
if (retval)
|
||||
return retval;
|
||||
if (follow) {
|
||||
retval = follow_link(fs, root, dir, inode, link_count,
|
||||
buf, &inode);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
#ifdef NAMEI_DEBUG
|
||||
printf("open_namei: (link_count=%d) returns %lu\n",
|
||||
link_count, inode);
|
||||
#endif
|
||||
*res_inode = inode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
||||
const char *name, ext2_ino_t *inode)
|
||||
{
|
||||
char *buf;
|
||||
errcode_t retval;
|
||||
|
||||
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
||||
|
||||
retval = ext2fs_get_mem(fs->blocksize, &buf);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0,
|
||||
buf, inode);
|
||||
|
||||
ext2fs_free_mem(&buf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
||||
const char *name, ext2_ino_t *inode)
|
||||
{
|
||||
char *buf;
|
||||
errcode_t retval;
|
||||
|
||||
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
||||
|
||||
retval = ext2fs_get_mem(fs->blocksize, &buf);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0,
|
||||
buf, inode);
|
||||
|
||||
ext2fs_free_mem(&buf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
|
||||
ext2_ino_t inode, ext2_ino_t *res_inode)
|
||||
{
|
||||
char *buf;
|
||||
errcode_t retval;
|
||||
|
||||
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
||||
|
||||
retval = ext2fs_get_mem(fs->blocksize, &buf);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
retval = follow_link(fs, root, cwd, inode, 0, buf, res_inode);
|
||||
|
||||
ext2fs_free_mem(&buf);
|
||||
return retval;
|
||||
}
|
||||
|
34
src/format.c
34
src/format.c
|
@ -1054,6 +1054,35 @@ BOOL FormatExtFs(DWORD DriveIndex, DWORD PartitionIndex, DWORD BlockSize, LPCSTR
|
|||
}
|
||||
}
|
||||
|
||||
// Create a 'persistence.conf' file if required
|
||||
if (Flags & FP_CREATE_PERSISTENCE_CONF) {
|
||||
// You *do* want the LF at the end of the "/ union" line, else Debian Live bails out...
|
||||
const char *name = "persistence.conf", data[] = "/ union\n";
|
||||
int written = 0, fsize = sizeof(data) - 1;
|
||||
ext2_file_t ext2fd;
|
||||
ext2_ino_t inode_id;
|
||||
uint32_t ctime = (uint32_t)time(0);
|
||||
struct ext2_inode inode = { 0 };
|
||||
inode.i_mode = 0100644;
|
||||
inode.i_links_count = 1;
|
||||
inode.i_atime = ctime;
|
||||
inode.i_ctime = ctime;
|
||||
inode.i_mtime = ctime;
|
||||
inode.i_size = fsize;
|
||||
|
||||
ext2fs_namei(ext2fs, EXT2_ROOT_INO, EXT2_ROOT_INO, name, &inode_id);
|
||||
ext2fs_new_inode(ext2fs, EXT2_ROOT_INO, 010755, 0, &inode_id);
|
||||
ext2fs_link(ext2fs, EXT2_ROOT_INO, name, inode_id, EXT2_FT_REG_FILE);
|
||||
ext2fs_inode_alloc_stats(ext2fs, inode_id, 1);
|
||||
ext2fs_write_new_inode(ext2fs, inode_id, &inode);
|
||||
ext2fs_file_open(ext2fs, inode_id, EXT2_FILE_WRITE, &ext2fd);
|
||||
if ((ext2fs_file_write(ext2fd, data, fsize, &written) != 0) || (written != fsize))
|
||||
uprintf("Error: Could not create '%s' file", name);
|
||||
else
|
||||
uprintf("Created '%s' file", name);
|
||||
ext2fs_file_close(ext2fd);
|
||||
}
|
||||
|
||||
// Finally we can call close() to get the file system gets created
|
||||
r = ext2fs_close(ext2fs);
|
||||
if (r != 0) {
|
||||
|
@ -2660,8 +2689,11 @@ DWORD WINAPI FormatThread(void* param)
|
|||
uint32_t ext_version = ReadSetting32(SETTING_USE_EXT_VERSION);
|
||||
if ((ext_version < 2) || (ext_version > 4))
|
||||
ext_version = 3;
|
||||
uprintf("Using %s-like method to enable persistence", img_report.uses_casper ? "Ubuntu" : "Debian");
|
||||
if (!FormatPartition(DriveIndex, partition_index[PI_CASPER], 0, FS_EXT2 + (ext_version - 2),
|
||||
"casper-rw", IsChecked(IDC_QUICK_FORMAT) ? FP_QUICK : 0)) {
|
||||
img_report.uses_casper ? "casper-rw" : "persistence",
|
||||
(img_report.uses_casper ? 0 : FP_CREATE_PERSISTENCE_CONF) |
|
||||
(IsChecked(IDC_QUICK_FORMAT) ? FP_QUICK : 0))) {
|
||||
if (!IS_ERROR(FormatStatus))
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
|
||||
goto out;
|
||||
|
|
35
src/iso.c
35
src/iso.c
|
@ -76,6 +76,7 @@ static const char* bootmgr_efi_name = "bootmgr.efi";
|
|||
static const char* grldr_name = "grldr";
|
||||
static const char* ldlinux_name = "ldlinux.sys";
|
||||
static const char* ldlinux_c32 = "ldlinux.c32";
|
||||
static const char* casper_dirname = "/casper";
|
||||
static const char* efi_dirname = "/efi/boot";
|
||||
static const char* efi_bootname[] = { "bootia32.efi", "bootia64.efi", "bootx64.efi", "bootarm.efi", "bootaa64.efi", "bootebc.efi" };
|
||||
static const char* sources_str = "/sources";
|
||||
|
@ -185,6 +186,11 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const
|
|||
has_ldlinux_c32 = TRUE;
|
||||
}
|
||||
|
||||
// Check for a /casper directory
|
||||
if (safe_stricmp(psz_dirname, casper_dirname) == 0) {
|
||||
img_report.uses_casper = TRUE;
|
||||
}
|
||||
|
||||
// Check for various files in root (psz_dirname = "")
|
||||
if ((psz_dirname != NULL) && (psz_dirname[0] == 0)) {
|
||||
if (safe_stricmp(psz_basename, bootmgr_name) == 0) {
|
||||
|
@ -290,13 +296,40 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
|
|||
for (i=0; i<nul_pos; i++)
|
||||
if (src[i] == '/') src[i] = '\\';
|
||||
|
||||
// Add persistence to the kernel options
|
||||
if ((boot_type == BT_IMAGE) && HAS_PERSISTENCE(img_report) && persistence_size) {
|
||||
if (props->is_grub_cfg) {
|
||||
// Ubuntu & derivatives are assumed to use '/casper/vmlinuz'
|
||||
// in their kernel options and use 'persistent' as keyword.
|
||||
if (replace_in_token_data(src, "linux", "/casper/vmlinuz",
|
||||
"/casper/vmlinuz persistent", TRUE) != NULL)
|
||||
uprintf(" Added 'persistent' kernel option");
|
||||
// Debian & derivatives are assumed to use 'boot=live' in
|
||||
// their kernel options and use 'persistence' as keyword.
|
||||
else if (replace_in_token_data(src, "linux", "boot=live",
|
||||
"boot=live persistence", TRUE) != NULL)
|
||||
uprintf(" Added 'persistence' kernel option");
|
||||
// Other distros can go to hell. Seriously, just check all partitions for
|
||||
// an ext volume with the right label and use persistence *THEN*. I mean,
|
||||
// why on earth do you need a bloody *NONSTANDARD* kernel option and/or a
|
||||
// "persistence.conf" file. This is SO INCREDIBLY RETARDED that it makes
|
||||
// Windows look smart in comparison. Great job there, Linux people!
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for config files requiring an ISO label for kernel append that may be
|
||||
// different from our USB label. Oh, and these labels must have spaces converted to \x20.
|
||||
if ((props->is_cfg) || (props->is_conf)) {
|
||||
iso_label = replace_char(img_report.label, ' ', "\\x20");
|
||||
usb_label = replace_char(img_report.usb_label, ' ', "\\x20");
|
||||
if ((iso_label != NULL) && (usb_label != NULL)) {
|
||||
if (replace_in_token_data(src, (props->is_grub_cfg) ? "linuxefi" : ((props->is_conf) ? "options" : "append"),
|
||||
if (props->is_grub_cfg) {
|
||||
// Older versions of GRUB EFI used "linuxefi", newer just use "linux"
|
||||
if ((replace_in_token_data(src, "linux", iso_label, usb_label, TRUE) != NULL) ||
|
||||
(replace_in_token_data(src, "linuxefi", iso_label, usb_label, TRUE) != NULL))
|
||||
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label);
|
||||
}
|
||||
else if (replace_in_token_data(src, (props->is_conf) ? "options" : "append",
|
||||
iso_label, usb_label, TRUE) != NULL)
|
||||
uprintf(" Patched %s: '%s' ➔ '%s'\n", src, iso_label, usb_label);
|
||||
}
|
||||
|
|
|
@ -1090,7 +1090,7 @@ char* replace_in_token_data(const char* filename, const char* token, const char*
|
|||
wchar_t *wtoken = NULL, *wfilename = NULL, *wtmpname = NULL, *wsrc = NULL, *wrep = NULL, bom = 0;
|
||||
wchar_t buf[1024], *torep;
|
||||
FILE *fd_in = NULL, *fd_out = NULL;
|
||||
size_t i, size;
|
||||
size_t i, ns, size;
|
||||
int mode = 0;
|
||||
char *ret = NULL, tmp[2];
|
||||
|
||||
|
@ -1180,8 +1180,11 @@ char* replace_in_token_data(const char* filename, const char* token, const char*
|
|||
// Token was found, move past token
|
||||
i += wcslen(wtoken);
|
||||
|
||||
// Skip spaces
|
||||
i += wcsspn(&buf[i], wspace);
|
||||
// Skip whitespaces after token (while making sure there's at least one)
|
||||
ns = wcsspn(&buf[i], wspace);
|
||||
if (ns == 0)
|
||||
continue;
|
||||
i += ns;
|
||||
|
||||
torep = wcsstr(&buf[i], wsrc);
|
||||
if (torep == NULL) {
|
||||
|
|
|
@ -322,6 +322,8 @@ typedef struct {
|
|||
uint32_t wininst_version;
|
||||
BOOLEAN is_iso;
|
||||
BOOLEAN is_bootable_img;
|
||||
BOOLEAN is_vhd;
|
||||
BOOLEAN disable_iso;
|
||||
uint16_t winpe;
|
||||
uint8_t has_efi;
|
||||
uint8_t wininst_index;
|
||||
|
@ -338,10 +340,9 @@ typedef struct {
|
|||
BOOLEAN has_grub4dos;
|
||||
BOOLEAN has_grub2;
|
||||
BOOLEAN has_kolibrios;
|
||||
BOOLEAN uses_casper;
|
||||
BOOLEAN uses_minint;
|
||||
BOOLEAN compression_type;
|
||||
BOOLEAN is_vhd;
|
||||
BOOLEAN disable_iso;
|
||||
uint16_t sl_version; // Syslinux/Isolinux version
|
||||
char sl_version_str[12];
|
||||
char sl_version_ext[32];
|
||||
|
@ -445,6 +446,7 @@ extern BOOL allow_dual_uefi_bios, large_drive, usb_debug;
|
|||
extern int64_t iso_blocking_status;
|
||||
extern uint8_t image_options;
|
||||
extern uint16_t rufus_version[3], embedded_sl_version[2];
|
||||
extern uint64_t persistence_size;
|
||||
extern size_t ubuffer_pos;
|
||||
extern const int nb_steps[FS_MAX];
|
||||
extern float fScale;
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 3.7.1554"
|
||||
CAPTION "Rufus 3.7.1555"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -394,8 +394,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1554,0
|
||||
PRODUCTVERSION 3,7,1554,0
|
||||
FILEVERSION 3,7,1555,0
|
||||
PRODUCTVERSION 3,7,1555,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -413,13 +413,13 @@ BEGIN
|
|||
VALUE "Comments", "https://akeo.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.7.1554"
|
||||
VALUE "FileVersion", "3.7.1555"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus-3.7.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.7.1554"
|
||||
VALUE "ProductVersion", "3.7.1555"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue