84 lines
2.5 KiB
Diff
Executable File
84 lines
2.5 KiB
Diff
Executable File
diff -Naur squashfs4.3/squashfs-tools/mksquashfs.c squashfs4.3-bak/squashfs-tools/mksquashfs.c
|
|
--- squashfs4.3/squashfs-tools/mksquashfs.c 2014-05-13 06:18:20.000000000 +0800
|
|
+++ squashfs4.3-bak/squashfs-tools/mksquashfs.c 2018-08-24 14:48:35.268576971 +0800
|
|
@@ -129,6 +129,9 @@
|
|
/* inode lookup table */
|
|
squashfs_inode *inode_lookup_table = NULL;
|
|
|
|
+/* override all timestamps */
|
|
+time_t fixed_time = -1;
|
|
+
|
|
/* in memory directory data */
|
|
#define I_COUNT_SIZE 128
|
|
#define DIR_ENTRIES 32
|
|
@@ -2265,7 +2268,8 @@
|
|
pathname_reader(dir_ent), strerror(errno));
|
|
goto read_err;
|
|
}
|
|
-
|
|
+ if (fixed_time != -1)
|
|
+ buf2.st_mtime = fixed_time;
|
|
if(read_size != buf2.st_size) {
|
|
close(file);
|
|
memcpy(buf, &buf2, sizeof(struct stat));
|
|
@@ -3139,7 +3143,7 @@
|
|
buf.st_mode = S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR;
|
|
buf.st_uid = getuid();
|
|
buf.st_gid = getgid();
|
|
- buf.st_mtime = time(NULL);
|
|
+ buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL);
|
|
buf.st_dev = 0;
|
|
buf.st_ino = 0;
|
|
dir_ent->inode = lookup_inode2(&buf, PSEUDO_FILE_OTHER, 0);
|
|
@@ -3148,6 +3152,8 @@
|
|
/* source directory has disappeared? */
|
|
BAD_ERROR("Cannot stat source directory %s because %s\n",
|
|
pathname, strerror(errno));
|
|
+ if(fixed_time != -1)
|
|
+ buf.st_mtime = fixed_time;
|
|
dir_ent->inode = lookup_inode(&buf);
|
|
}
|
|
|
|
@@ -3370,6 +3376,8 @@
|
|
free_dir_entry(dir_ent);
|
|
continue;
|
|
}
|
|
+ if(fixed_time != -1)
|
|
+ buf.st_mtime = fixed_time;
|
|
|
|
if((buf.st_mode & S_IFMT) != S_IFREG &&
|
|
(buf.st_mode & S_IFMT) != S_IFDIR &&
|
|
@@ -3526,7 +3534,7 @@
|
|
buf.st_gid = pseudo_ent->dev->gid;
|
|
buf.st_rdev = makedev(pseudo_ent->dev->major,
|
|
pseudo_ent->dev->minor);
|
|
- buf.st_mtime = time(NULL);
|
|
+ buf.st_mtime = fixed_time != -1 ? fixed_time : time(NULL);
|
|
buf.st_ino = pseudo_ino ++;
|
|
|
|
if(pseudo_ent->dev->type == 'd') {
|
|
@@ -5076,6 +5084,15 @@
|
|
force_progress = TRUE;
|
|
else if(strcmp(argv[i], "-no-exports") == 0)
|
|
exportable = FALSE;
|
|
+ else if(strcmp(argv[i], "-fixed-time") == 0) {
|
|
+ if((++i == argc) || (fixed_time =
|
|
+ strtoll(argv[i], &b, 10), *b != '\0')) {
|
|
+ ERROR("%s: -fixed-time missing or invalid "
|
|
+ "timestamp\n", argv[0]);
|
|
+
|
|
+ exit(1);
|
|
+ }
|
|
+ }
|
|
else if(strcmp(argv[i], "-processors") == 0) {
|
|
if((++i == argc) || !parse_num(argv[i], &processors)) {
|
|
ERROR("%s: -processors missing or invalid "
|
|
@@ -5717,7 +5734,7 @@
|
|
sBlk.flags = SQUASHFS_MKFLAGS(noI, noD, noF, noX, no_fragments,
|
|
always_use_fragments, duplicate_checking, exportable,
|
|
no_xattrs, comp_opts);
|
|
- sBlk.mkfs_time = time(NULL);
|
|
+ sBlk.mkfs_time = fixed_time != -1 ? fixed_time : time(NULL);
|
|
|
|
disable_info();
|