summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/drakx-in-chroot29
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index 223ebb78b..e289ebbaf 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -77,20 +77,20 @@ if ($remote_repository) {
sys("curl --silent -o $local_mdkinst $repository/$COMPRESSED_FILE_REL");
mount_mdkinst($local_mdkinst);
} elsif (-d "$repository/$LIVE_LOCATION_REL") {
- sys("$sudo mount -o bind $repository/$LIVE_LOCATION_REL $STAGE2_LOCATION");
+ mount("$repository/$LIVE_LOCATION_REL", $STAGE2_LOCATION, "-o bind");
} elsif (-e "$repository/$COMPRESSED_FILE_REL") {
mount_mdkinst("$repository/$COMPRESSED_FILE_REL");
}
-sys("$sudo mount -o bind $dir $SLASH_LOCATION$prefix_ROOTED");
+mount($dir, "$SLASH_LOCATION$prefix_ROOTED", "-o bind");
$repository_uri ||= $repository_without_arch if !$remote_repository;
-sys("$sudo mount -o bind $repository_uri $SLASH_LOCATION$MEDIA_LOCATION_ROOTED") if $repository_uri;
+mount($repository_uri, "$SLASH_LOCATION$MEDIA_LOCATION_ROOTED", "-o bind") if $repository_uri;
-sys("$sudo mount --bind -o ro /dev $SLASH_LOCATION/dev");
-sys("$sudo mount -t proc none $SLASH_LOCATION/proc");
-sys("$sudo mount -t sysfs none $SLASH_LOCATION/sys");
-sys("$sudo mount -t debugfs none $SLASH_LOCATION/sys/kernel/debug");
-sys("$sudo mount -t tmpfs none $SLASH_LOCATION/run");
+mount('/dev', "$SLASH_LOCATION/dev", " --bind -o ro");
+mount('none', "$SLASH_LOCATION/proc", "-t proc");
+mount('none', "$SLASH_LOCATION/sys", "-t sysfs");
+mount('none', "$SLASH_LOCATION/sys/kernel/debug", "-t debugfs");
+mount('none', "$SLASH_LOCATION/run", "-t tmpfs");
# - Ensure we mount the udev run dir for various extra metadata from udevadm
# - If dracut has been used (and thus udev has yummy metadata) make sure
@@ -99,13 +99,13 @@ sys("$sudo mount -t tmpfs none $SLASH_LOCATION/run");
foreach my $dir (qw(initramfs udev blkid)) {
next if !-d "/run/$dir";
mkdir_p("$SLASH_LOCATION/run/$dir");
- sys("$sudo mount -o bind /run/$dir $SLASH_LOCATION/run/$dir");
+ mount("/run/$dir", "$SLASH_LOCATION/run/$dir", "-o bind");
}
if ($disk_iso_repository) {
my $repository_arch = $repository_arch || 'i586';
mkdir_p($LOOP_MOUNT_POINT);
- sys("$sudo mount -o loop,ro $disk_iso_repository $LOOP_MOUNT_POINT");
+ mount($disk_iso_repository, $LOOP_MOUNT_POINT, "-o loop,ro");
symlinkf('loop/' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); # FIXME: arch()
}
@@ -177,7 +177,7 @@ sub sys { &system_verbose; $? and die qq(running "@_" failed: $?\n) }
sub mount_mdkinst {
my ($mdkinst) = @_;
- sys("$sudo mount -t squashfs -o loop,ro $mdkinst $STAGE2_LOCATION");
+ mount($mdkinst, $STAGE2_LOCATION, "-t squashfs -o loop,ro");
}
sub create_initial_symlinks() {
foreach (cat_or_die("$STAGE2_LOCATION/usr/share/symlinks")) {
@@ -198,6 +198,11 @@ sub create_initial_symlinks() {
}
}
+sub mount {
+ my ($from, $mntpt, @opts) = @_;
+ sys("$sudo mount $from $mntpt " . join(' ', @opts));
+}
+
sub umount_all() {
my $err;
clean_stage2_updates();
@@ -253,7 +258,7 @@ sub apply_stage2_updates() {
undef $ARGV[$::i+1];
undef $ARGV[$::i+2];
push @stage2_updates, $dest;
- sys("$sudo mount --bind $file $STAGE2_LOCATION/$dest");
+ mount($file, "$STAGE2_LOCATION/$dest", " --bind");
}
}
} @ARGV;