squashfs.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. This is a stupid little patch adding an option to change all uid/gid to
  2. root/root in the generated filesystem. We really need to teach mksquashfs
  3. about device tables though...
  4. --- squashfs1.3r3/squashfs-tools/mksquashfs.c-dist 2004-03-29 20:35:37.000000000 -0600
  5. +++ squashfs1.3r3/squashfs-tools/mksquashfs.c 2004-03-29 22:28:51.000000000 -0600
  6. @@ -136,6 +136,8 @@
  7. stotal_bytes, stotal_inode_bytes, stotal_directory_bytes, sinode_count, sfile_count, ssym_count, sdev_count, sdir_count, sdup_files;
  8. int restore = 0;
  9. +unsigned int root_owned = 0;
  10. +
  11. /*flag whether destination file is a block device */
  12. int block_device = 0;
  13. @@ -421,6 +423,11 @@
  14. return SQUASHFS_INVALID;
  15. }
  16. + if (root_owned) {
  17. + buf.st_uid = 0;
  18. + buf.st_gid = 0;
  19. + }
  20. +
  21. base->mode = SQUASHFS_MODE(buf.st_mode);
  22. base->uid = get_uid(&file_type, (squashfs_uid) buf.st_uid);
  23. base->inode_type = file_type;
  24. @@ -1268,6 +1275,8 @@
  25. root_name = argv[i];
  26. } else if(strcmp(argv[i], "-version") == 0) {
  27. VERSION();
  28. + } else if (strcmp(argv[i], "-root-owned") == 0) {
  29. + root_owned = TRUE;
  30. } else {
  31. ERROR("%s: invalid option\n\n", argv[0]);
  32. printOptions: