|
@ -129,6 +129,7 @@ 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 = "mke2fs -F -m0 -i8192"; # Root Disk |
|
|
$main::makefs = "mke2fs -F -m0 -i8192"; # Root Disk |
|
|
|
|
|
my $sudo = "sudo"; |
|
|
|
|
|
|
|
|
# CHANGES |
|
|
# CHANGES |
|
|
# |
|
|
# |
|
@ -505,7 +506,7 @@ 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); |
|
|
|
|
|
|
|
|
# Here's where stuff gets intersting, non-root users can create root_fs, |
|
|
# Here's where stuff gets intersting, non-root users can create root_fs, |
|
|
# which is great for UML. |
|
|
# which is great for UML, and a boot disk. |
|
|
|
|
|
|
|
|
if ( $> == 0 ) { |
|
|
if ( $> == 0 ) { |
|
|
|
|
|
|
|
@ -528,12 +529,29 @@ else { |
|
|
|
|
|
|
|
|
# The Administrator just needs to add a line like the one below to the |
|
|
# The Administrator just needs to add a line like the one below to the |
|
|
# fstab for each non-root user who wants to be able to create root_fs. |
|
|
# fstab for each non-root user who wants to be able to create root_fs. |
|
|
# Ofcourse, the user is locked into the ext2 fs in this example, and |
|
|
# In this example, `id -u` has to be the actual effective numeric user |
|
|
# `id -u` has to be the actual effective numeric user id. |
|
|
# id, and the root_fs has to always be named root_fs when it is being |
|
|
|
|
|
# made, but it can be renamed afterwards. |
|
|
# |
|
|
# |
|
|
# /tmp/gboot_non_root_`id -u`/root_fs \ |
|
|
# /tmp/gboot_non_root_`id -u`/root_fs \ |
|
|
# /tmp/gboot_non_root_`id -u`/loopback \ |
|
|
# /tmp/gboot_non_root_`id -u`/loopback \ |
|
|
# ext2 defaults,noauto,user,loop 0 0 |
|
|
# 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 |
|
|
|
|
|
# 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 |
|
|
|
|
|
# disk. In this example the user is locked into using one type of device |
|
|
|
|
|
# for the boot/root |
|
|
|
|
|
# |
|
|
|
|
|
# /tmp/gboot_not_root_`id -u`/initrd_image \ |
|
|
|
|
|
# /tmp/gboot_not_root_'id -u1`/initrd_mnt \ |
|
|
|
|
|
# auto defaults,noauto,user,loop 0 0 |
|
|
|
|
|
# |
|
|
|
|
|
# /dev/fd0 /tmp/gboot_not_root_mnt_`id -u` auto defaults,noauto,user 0 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $user = $>; |
|
|
my $user = $>; |
|
|
|
|
|
|
|
@ -544,9 +562,9 @@ else { |
|
|
} |
|
|
} |
|
|
$tmp = "$tmp1/gboot_non_root_" . $user; |
|
|
$tmp = "$tmp1/gboot_non_root_" . $user; |
|
|
|
|
|
|
|
|
if (!-d "$tmp1/gbootroot_mnt$time") { |
|
|
if (!-d "$tmp1/gboot_non_root_mnt_" . $user) { |
|
|
$mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl( |
|
|
$mnt = "$tmp1/gboot_non_root_mnt_" . $user if err_custom_perl( |
|
|
"mkdir $tmp1/gbootroot_mnt$time", |
|
|
"mkdir $tmp1/gboot_non_root_mnt_" . $user, |
|
|
"gBootRoot: ERROR: Could not make mount directory") != 2; |
|
|
"gBootRoot: ERROR: Could not make mount directory") != 2; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2615,7 +2633,15 @@ sub lilo_put_it_together { |
|
|
info(0, "Umount device\n"); |
|
|
info(0, "Umount device\n"); |
|
|
info(0, "Remount device\n"); |
|
|
info(0, "Remount device\n"); |
|
|
pb($B,6); |
|
|
pb($B,6); |
|
|
return if errm(sys("mount -t ext2 $entry_advanced[0] $mnt")) == 2; |
|
|
|
|
|
|
|
|
# Real device |
|
|
|
|
|
if ( $> == 0 ) { |
|
|
|
|
|
return if errm(sys("mount -t ext2 $entry_advanced[0] $mnt")) == 2; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return if errm(sys("mount $mnt")) == 2; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
info(0, "Configuring lilo\n"); |
|
|
info(0, "Configuring lilo\n"); |
|
|
pb($B,7); |
|
|
pb($B,7); |
|
|
chdir("$mnt"); #"boot_root: ERROR: Could not change directories\n"; |
|
|
chdir("$mnt"); #"boot_root: ERROR: Could not change directories\n"; |
|
@ -3046,9 +3072,15 @@ sub initrd { |
|
|
if (!-d "$tmp/initrd_mnt") { |
|
|
if (!-d "$tmp/initrd_mnt") { |
|
|
return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2; |
|
|
return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2; |
|
|
} |
|
|
} |
|
|
return if errm(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt")) |
|
|
|
|
|
== 2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Here the loop device is made on tmp, not mnt |
|
|
|
|
|
if ( $> == 0 ) { |
|
|
|
|
|
return if errm(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt")) |
|
|
|
|
|
== 2; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return if errm(sys("mount $tmp/initrd_mnt")) |
|
|
|
|
|
} |
|
|
pb($I,4); |
|
|
pb($I,4); |
|
|
|
|
|
|
|
|
info(0, "Putting everything together\n"); |
|
|
info(0, "Putting everything together\n"); |
|
@ -3070,10 +3102,21 @@ sub initrd { |
|
|
return if err(sys("cp -a $container[BOOT_DEVICE] $mnt/dev")) == 2; |
|
|
return if err(sys("cp -a $container[BOOT_DEVICE] $mnt/dev")) == 2; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return if errcp( |
|
|
if ( $> == 0 ) { |
|
|
sys("cp -a /dev/{console,null,ram0,ram1,tty0} $tmp/initrd_mnt/dev")) == 2; |
|
|
return if errcp( |
|
|
return if errcp(sys("cp -a $container[BOOT_DEVICE] $tmp/initrd_mnt/dev")) |
|
|
sys("cp -a /dev/{console,null,ram0,ram1,tty0} $tmp/initrd_mnt/dev")) == 2; |
|
|
|
|
|
return if errcp(sys("cp -a $container[BOOT_DEVICE] $tmp/initrd_mnt/dev")) |
|
|
== 2; |
|
|
== 2; |
|
|
|
|
|
} |
|
|
|
|
|
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"); |
|
|
|
|
|
} |
|
|
pb($I,7); |
|
|
pb($I,7); |
|
|
|
|
|
|
|
|
# This and libs should be user accessible |
|
|
# This and libs should be user accessible |
|
@ -3451,8 +3494,9 @@ sub mtab_check { |
|
|
sys("mke2fs -F -m0 -i8192 $entry_advanced[3] $root_device_size"); |
|
|
sys("mke2fs -F -m0 -i8192 $entry_advanced[3] $root_device_size"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# BOOT_DEVICE |
|
|
# BOOT_DEVICE |
|
|
elsif ($count == 0) { |
|
|
elsif ($count == 0) { |
|
|
sys("mke2fs -F -m0 -i8192 $entry_advanced[0] $container[SIZE]"); |
|
|
sys("mke2fs -F -m0 -i8192 $entry_advanced[0] $container[SIZE]"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -3464,12 +3508,22 @@ sub mtab_check { |
|
|
|
|
|
|
|
|
# ROOT_DEVICE |
|
|
# ROOT_DEVICE |
|
|
if ($count == 1) { |
|
|
if ($count == 1) { |
|
|
return if errm(sys("mount -t ext2 $entry_advanced[3] $mnt")) == 2; |
|
|
if ( $> == 0 ) { |
|
|
|
|
|
return if errm(sys("mount -t ext2 $entry_advanced[3] $mnt")) == 2; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return if errm(sys("mount $mnt")) == 2; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# BOOT_DEVICE |
|
|
# BOOT_DEVICE |
|
|
elsif ($count == 0) { |
|
|
elsif ($count == 0) { |
|
|
return if errm(sys("mount -t ext2 $entry_advanced[0] $mnt")) == 2; |
|
|
if ( $> == 0 ) { |
|
|
|
|
|
return if errm(sys("mount -t ext2 $entry_advanced[0] $mnt")) == 2; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return if errm(sys("mount $mnt")) == 2; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|