diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 23a418e..285a785 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -1097,17 +1097,23 @@ sub copy_strip_file { ## non-root users will experience problems here so this is ## skipped. --freesource + + my($mode, $uid, $gid); + (undef, undef, $mode, undef, $uid, $gid) = stat $from; + my $from_base = basename($from); + if ( $> == 0 ) { - my($mode, $uid, $gid); - (undef, undef, $mode, undef, $uid, $gid) = stat $from; - my $from_base = basename($from); chown($uid, $gid, $to) or ($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 { + sys("$main::sudo chown $uid $gid $to"); + sys("$main::sudo chmod $mode $to"); + } } else { diff --git a/gbootroot b/gbootroot index 0372824..ff73099 100755 --- a/gbootroot +++ b/gbootroot @@ -129,7 +129,7 @@ my $home = "$ENV{HOME}/.gbootroot"; my $uml_xterm = "xterm -e"; $main::editor = "emacs --font 6x13"; $main::makefs = "mke2fs -F -m0 -i8192"; # Root Disk -my $sudo = "sudo"; +$main::sudo = "sudo"; # CHANGES # @@ -538,7 +538,7 @@ else { # auto defaults,noauto,user,loop 0 0 # # For the boot/root disks the administrator will have to give the user - # special su privileges (mknod) to make special devices. The $sudo + # special su privileges (mknod) to make special devices. The $main::sudo # variable can be set to sudo or super, fakeroot won't work. # These include: /dev/{console,null,ram0,ram1,tty0} # These two lines need to be added to create the boot_fs and the boot/root @@ -566,6 +566,7 @@ else { "mkdir $tmp1/gboot_non_root_mnt_" . $user, "gBootRoot: ERROR: Could not make mount directory") != 2; } + $mnt = "$tmp1/gboot_non_root_mnt" . $user; } @@ -3114,12 +3115,12 @@ sub initrd { } else { # This could be replaced by a devfs. - sys("$sudo mknod c 5 1 $tmp/initrd_mnt/dev/console"); - sys("$sudo mknod c 1 3 $tmp/initrd_mnt/dev/null"); - sys("$sudo mknod b 1 0 $tmp/initrd_mnt/dev/ram0"); - sys("$sudo mknod b 1 1 $tmp/initrd_mnt/dev/ram1"); - sys("$sudo mknod c 4 0 $tmp/initrd_mnt/dev/tty0"); - sys("$sudo mknod b 2 0 $tmp/initrd_mnt/dev/fd0"); + sys("$main::sudo mknod c 5 1 $tmp/initrd_mnt/dev/console"); + sys("$main::sudo mknod c 1 3 $tmp/initrd_mnt/dev/null"); + sys("$main::sudo mknod b 1 0 $tmp/initrd_mnt/dev/ram0"); + sys("$main::sudo mknod b 1 1 $tmp/initrd_mnt/dev/ram1"); + sys("$main::sudo mknod c 4 0 $tmp/initrd_mnt/dev/tty0"); + sys("$main::sudo mknod b 2 0 $tmp/initrd_mnt/dev/fd0"); } pb($I,7);