Implemented option -chmod (does not get written into image, though)
This commit is contained in:
@ -580,6 +580,33 @@ much_too_long:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_get_node_by_path(struct XorrisO *xorriso,
|
||||
char *in_path, char *eff_path,
|
||||
struct iso_tree_node **node, int flag)
|
||||
{
|
||||
int ret;
|
||||
char sfe[4*SfileadrL], path[SfileadrL];
|
||||
struct iso_volume *volume;
|
||||
|
||||
ret= Xorriso_normalize_img_path(xorriso, in_path, path, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
if(eff_path!=NULL)
|
||||
strcpy(eff_path, path);
|
||||
ret= Xorriso_get_volume(xorriso, &volume, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
*node= iso_tree_volume_path_to_node(volume,path);
|
||||
if(*node==NULL) {
|
||||
sprintf(xorriso->info_text, "Not found in ISO image: %s",
|
||||
Text_shellsafe(path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= recursion is active */
|
||||
int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
|
||||
char *img_dir_path, char *disk_dir_path, int flag)
|
||||
@ -1740,6 +1767,40 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso__mode_to_perms(mode_t st_mode, char perms[10], int flag)
|
||||
{
|
||||
strcpy(perms,"---------");
|
||||
if(st_mode&S_IRUSR) perms[0]= 'r';
|
||||
if(st_mode&S_IWUSR) perms[1]= 'w';
|
||||
if(st_mode&S_IXUSR) perms[2]= 'x';
|
||||
if(st_mode&S_ISUID) {
|
||||
if(st_mode&S_IXUSR)
|
||||
perms[2]= 's';
|
||||
else
|
||||
perms[2]= 'S';
|
||||
}
|
||||
if(st_mode&S_IRGRP) perms[3]= 'r';
|
||||
if(st_mode&S_IWGRP) perms[4]= 'w';
|
||||
if(st_mode&S_IXGRP) perms[5]= 'x';
|
||||
if(st_mode&S_ISGID) {
|
||||
if(st_mode&S_IXGRP)
|
||||
perms[5]= 's';
|
||||
else
|
||||
perms[5]= 'S';
|
||||
}
|
||||
if(st_mode&S_IROTH) perms[6]= 'r';
|
||||
if(st_mode&S_IWOTH) perms[7]= 'w';
|
||||
if(st_mode&S_IXOTH) perms[8]= 'x';
|
||||
if(st_mode&S_ISVTX) {
|
||||
if(st_mode&S_IXOTH)
|
||||
perms[8]= 't';
|
||||
else
|
||||
perms[8]= 'T';
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= long format
|
||||
bit1= do not print count of nodes
|
||||
bit2= du format
|
||||
@ -1824,16 +1885,7 @@ much_too_long:;
|
||||
strcat(rpt, "?");
|
||||
|
||||
st_mode= iso_tree_node_get_permissions(node);
|
||||
strcpy(perms,"---------");
|
||||
if(st_mode&S_IRUSR) perms[0]= 'r';
|
||||
if(st_mode&S_IWUSR) perms[1]= 'w';
|
||||
if(st_mode&S_IXUSR) perms[2]= 'x';
|
||||
if(st_mode&S_IRGRP) perms[3]= 'r';
|
||||
if(st_mode&S_IWGRP) perms[4]= 'w';
|
||||
if(st_mode&S_IXGRP) perms[5]= 'x';
|
||||
if(st_mode&S_IROTH) perms[6]= 'r';
|
||||
if(st_mode&S_IWOTH) perms[7]= 'w';
|
||||
if(st_mode&S_IXOTH) perms[8]= 'x';
|
||||
Xorriso__mode_to_perms(st_mode, perms, 0);
|
||||
strcat(rpt, perms);
|
||||
|
||||
/* >>> With directories this should be : number of subdirs + 2 */
|
||||
@ -1976,16 +2028,7 @@ wdi_is_not_a_dir:;
|
||||
strcat(rpt, "?");
|
||||
|
||||
st_mode= iso_tree_node_get_permissions(node);
|
||||
strcpy(perms,"---------");
|
||||
if(st_mode&S_IRUSR) perms[0]= 'r';
|
||||
if(st_mode&S_IWUSR) perms[1]= 'w';
|
||||
if(st_mode&S_IXUSR) perms[2]= 'x';
|
||||
if(st_mode&S_IRGRP) perms[3]= 'r';
|
||||
if(st_mode&S_IWGRP) perms[4]= 'w';
|
||||
if(st_mode&S_IXGRP) perms[5]= 'x';
|
||||
if(st_mode&S_IROTH) perms[6]= 'r';
|
||||
if(st_mode&S_IWOTH) perms[7]= 'w';
|
||||
if(st_mode&S_IXOTH) perms[8]= 'x';
|
||||
Xorriso__mode_to_perms(st_mode, perms, 0);
|
||||
strcat(rpt, perms);
|
||||
|
||||
/* >>> With directories this should be : number of subdirs + 2 */
|
||||
@ -2422,3 +2465,24 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_set_st_mode(struct XorrisO *xorriso, char *in_path,
|
||||
mode_t mode_and, mode_t mode_or, int flag)
|
||||
{
|
||||
mode_t mode= 0;
|
||||
int ret;
|
||||
struct iso_tree_node *node;
|
||||
char sfe[4*SfileadrL], path[SfileadrL];
|
||||
|
||||
ret= Xorriso_get_node_by_path(xorriso, in_path, path, &node, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
mode= iso_tree_node_get_permissions(node);
|
||||
mode= (mode & mode_and) | mode_or;
|
||||
iso_tree_node_set_permissions(node, mode);
|
||||
sprintf(xorriso->info_text,"Permissions now: %-5.5o %s",
|
||||
mode, Text_shellsafe(path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
xorriso->volset_change_pending= 1;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user