mirror of
				https://github.com/fspc/gbootroot.git
				synced 2025-11-04 08:15:36 -05:00 
			
		
		
		
	Now a non-root user can make a root_fs, the administrator has to add an entry
for each user to the fstab, right now there is just a generic location for all users. Special files aren't copied over if permissions don't allow it, but devfs more than solves that problem!
This commit is contained in:
		
							parent
							
								
									41df0e88aa
								
							
						
					
					
						commit
						fef993baf9
					
				@ -1094,15 +1094,21 @@ sub copy_strip_file {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Copy file perms and owner
 | 
						# Copy file perms and owner
 | 
				
			||||||
	my($mode, $uid, $gid);
 | 
						## non-root users will experience problems here so this is
 | 
				
			||||||
	(undef, undef, $mode, undef, $uid, $gid) = stat $from;
 | 
						## skipped. --freesource
 | 
				
			||||||
	my $from_base = basename($from);
 | 
					
 | 
				
			||||||
	chown($uid, $gid, $to) or ($error = 
 | 
						if ( $< == 0 ) {
 | 
				
			||||||
				   error("chown: $! \($from_base\)\n"));
 | 
						    my($mode, $uid, $gid);
 | 
				
			||||||
	return "ERROR"if $error && $error eq "ERROR";
 | 
						    (undef, undef, $mode, undef, $uid, $gid) = stat $from;
 | 
				
			||||||
	chmod($mode, $to)      or ($error = 
 | 
						    my $from_base = basename($from);
 | 
				
			||||||
				   error("chmod: $! \($from_base\)\n"));
 | 
						    chown($uid, $gid, $to) or ($error = 
 | 
				
			||||||
        return "ERROR"if $error && $error eq "ERROR";
 | 
									       error("chown: $! \($from_base\)\n"));
 | 
				
			||||||
 | 
						    return "ERROR"if $error && $error eq "ERROR";
 | 
				
			||||||
 | 
						    chmod($mode, $to)      or ($error = 
 | 
				
			||||||
 | 
									       error("chmod: $! \($from_base\)\n"));
 | 
				
			||||||
 | 
						    return "ERROR"if $error && $error eq "ERROR";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
	#  Normal copy, no strip
 | 
						#  Normal copy, no strip
 | 
				
			||||||
@ -1583,7 +1589,13 @@ sub mount_device {
 | 
				
			|||||||
    $options = "";
 | 
					    $options = "";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  errmk(sys("mount $options -t ext2 $device $mount_point"));
 | 
					  if ( $< == 0 ) {
 | 
				
			||||||
 | 
					      errmk(sys("mount $options -t ext2 $device $mount_point"));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  else {
 | 
				
			||||||
 | 
					      errmk(sys("mount $mount_point"));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										50
									
								
								gbootroot
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								gbootroot
									
									
									
									
									
								
							@ -128,7 +128,7 @@ my $lilo_conf = "/etc/lilo.conf";
 | 
				
			|||||||
my $home = "$ENV{HOME}/.gbootroot";
 | 
					my $home = "$ENV{HOME}/.gbootroot";
 | 
				
			||||||
my $uml_xterm = "xterm -e";
 | 
					my $uml_xterm = "xterm -e";
 | 
				
			||||||
$main::editor = "emacs --font 6x13";
 | 
					$main::editor = "emacs --font 6x13";
 | 
				
			||||||
$main::makefs = "/sbin/mke2fs -F -m0 -i8192"; # Root Disk
 | 
					$main::makefs = "mke2fs -F -m0 -i8192"; # Root Disk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# CHANGES
 | 
					# CHANGES
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@ -504,19 +504,46 @@ my ($sec,$min,$hour,$day,$month,$year) = (localtime)[0,1,2,3,4,5];
 | 
				
			|||||||
my $time = sprintf("%02d:%02d:%02d-%02d-%02d-%04d", 
 | 
					my $time = sprintf("%02d:%02d:%02d-%02d-%02d-%04d", 
 | 
				
			||||||
		   $hour, $min, $sec, $month+1, $day, $year+1900);
 | 
							   $hour, $min, $sec, $month+1, $day, $year+1900);
 | 
				
			||||||
#print "$time\n";
 | 
					#print "$time\n";
 | 
				
			||||||
if (!-d "$tmp1/gbootroot_tmp$time") {   
 | 
					
 | 
				
			||||||
  $tmp = "$tmp1/gbootroot_tmp$time" if err_custom_perl(
 | 
					# Here's where stuff gets weird, to provide a predicatable place for non-root
 | 
				
			||||||
         "mkdir $tmp1/gbootroot_tmp$time",
 | 
					# users to mount the loop device via fstab when making a root_fs (because
 | 
				
			||||||
         "gBootRoot: ERROR: Could not make temporary directory") != 2;
 | 
					# $tmp is used), one place has to be designated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ( $< == 0 ) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!-d "$tmp1/gbootroot_tmp$time") {   
 | 
				
			||||||
 | 
						$tmp = "$tmp1/gbootroot_tmp$time" if err_custom_perl(
 | 
				
			||||||
 | 
							"mkdir $tmp1/gbootroot_tmp$time",
 | 
				
			||||||
 | 
							 "gBootRoot: ERROR: Could not make temporary directory") != 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (!-d "$tmp1/gbootroot_mnt$time") {
 | 
				
			||||||
 | 
						$mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl(
 | 
				
			||||||
 | 
						       "mkdir $tmp1/gbootroot_mnt$time",
 | 
				
			||||||
 | 
					               "gBootRoot: ERROR: Could not make mount directory") != 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Why?
 | 
				
			||||||
 | 
					    $tmp = "$tmp1/gbootroot_tmp$time";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if (!-d "$tmp1/gbootroot_mnt$time") {
 | 
					else {
 | 
				
			||||||
 $mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl(
 | 
					
 | 
				
			||||||
        "mkdir $tmp1/gbootroot_mnt$time",
 | 
					    # Hopefully only one user at a time.
 | 
				
			||||||
        "gBootRoot: ERROR: Could not make mount directory") != 2;
 | 
					    if (!-d "$tmp1/gboot_non_root") {   
 | 
				
			||||||
 | 
						$tmp = "$tmp1/gboot_non_root" if err_custom_perl(
 | 
				
			||||||
 | 
							"mkdir $tmp1/gboot_non_root",
 | 
				
			||||||
 | 
							 "gBootRoot: ERROR: Could not make temporary directory") != 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $tmp = "$tmp1/gboot_non_root";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!-d "$tmp1/gbootroot_mnt$time") {
 | 
				
			||||||
 | 
						$mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl(
 | 
				
			||||||
 | 
						       "mkdir $tmp1/gbootroot_mnt$time",
 | 
				
			||||||
 | 
					               "gBootRoot: ERROR: Could not make mount directory") != 2;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Why?
 | 
					 | 
				
			||||||
$tmp = "$tmp1/gbootroot_tmp$time";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Verbosity is universal for all methods, and controlled by a scale slider. 
 | 
					# Verbosity is universal for all methods, and controlled by a scale slider. 
 | 
				
			||||||
# Yard 
 | 
					# Yard 
 | 
				
			||||||
@ -526,6 +553,7 @@ my $verbosity = 1; # info & sys use this as Global
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## One hard copy log file is saved for the session, and the user can also 
 | 
					## One hard copy log file is saved for the session, and the user can also 
 | 
				
			||||||
## save from the verbosity box including saving a selection.
 | 
					## save from the verbosity box including saving a selection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $verbosefn = "$tmp/verbose"; # All verbosity
 | 
					my $verbosefn = "$tmp/verbose"; # All verbosity
 | 
				
			||||||
#my $verbosefn = "/tmp/verbose";  # Yard - always logged, but 0&1 = STDOUT
 | 
					#my $verbosefn = "/tmp/verbose";  # Yard - always logged, but 0&1 = STDOUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user