Discussion:
[software/drakx] 04/05: introduce mount() function
root-odJJhXpcy38dnm+
2014-10-22 22:23:23 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

tv pushed a commit to branch master
in repository software/drakx.

commit a7065e441c7f46cf430ad9f2aa4ea6f7e48906ac
Author: Thierry Vignaud <thierry.vignaud-***@public.gmane.org>
Date: Tue Oct 21 23:33:35 2014 +0200

introduce mount() function

more readable & needed for next commit
---
Commit Link:
http://gitweb.mageia.org/software/drakx/commit/?id=a7065e441c7f46cf430ad9f2aa4ea6f7e48906ac

tools/drakx-in-chroot | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index 223ebb7..e289ebb 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;
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-22 22:23:24 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

tv pushed a commit to branch master
in repository software/drakx.

commit f4cd3076f00884833aff775414c1132237be922e
Author: Thierry Vignaud <thierry.vignaud-***@public.gmane.org>
Date: Thu Oct 23 00:21:03 2014 +0200

try harder to umount everything when sg went havroc
---
Commit Link:
http://gitweb.mageia.org/software/drakx/commit/?id=f4cd3076f00884833aff775414c1132237be922e

perl-install/install/NEWS | 1 +
tools/drakx-in-chroot | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index b76115f..0f741f8 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,6 +1,7 @@
- drakx-in-chroot:
o document --stage2-update in --help
o mount /dev -o ro
+ o try harder to umount everything when sg went havroc

Version 16.43 - 20 October 2014

diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index e289ebb..dbc3190 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -56,6 +56,9 @@ if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}

+my @mounts;
+my $_b = before_leaving { sys("$sudo umount $_") foreach reverse @mounts };
+
undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files

if (-d $SLASH_LOCATION) {
@@ -200,6 +203,7 @@ sub create_initial_symlinks() {

sub mount {
my ($from, $mntpt, @opts) = @_;
+ push @mounts, $mntpt;
sys("$sudo mount $from $mntpt " . join(' ', @opts));
}
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-22 22:23:20 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

tv pushed a commit to branch master
in repository software/drakx.

commit 83f911b151adc8f31db9a4fa51f31174452f8e78
Author: Thierry Vignaud <thierry.vignaud-***@public.gmane.org>
Date: Tue Oct 21 22:36:33 2014 +0200

mount /dev -o ro

(prevent rm -fr going havroc on some error pathes)
---
Commit Link:
http://gitweb.mageia.org/software/drakx/commit/?id=83f911b151adc8f31db9a4fa51f31174452f8e78

perl-install/install/NEWS | 3 +++
tools/drakx-in-chroot | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index e8c65d6..2eeda98 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,6 @@
+- drakx-in-chroot:
+ o mount /dev -o ro
+
Version 16.43 - 20 October 2014

- drakx-in-chroot:
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index b66df87..f8a37c7 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -85,7 +85,7 @@ sys("$sudo mount -o bind $dir $SLASH_LOCATION$prefix_ROOTED");
$repository_uri ||= $repository_without_arch if !$remote_repository;
sys("$sudo mount -o bind $repository_uri $SLASH_LOCATION$MEDIA_LOCATION_ROOTED") if $repository_uri;

-sys("$sudo mount --bind /dev $SLASH_LOCATION/dev");
+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");
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-22 22:23:22 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

tv pushed a commit to branch master
in repository software/drakx.

commit 1b94db0c531b1d9f7a3fc095a5b646fccffc20ec
Author: Thierry Vignaud <thierry.vignaud-***@public.gmane.org>
Date: Tue Oct 21 23:34:13 2014 +0200

perl_checker cleanups
---
Commit Link:
http://gitweb.mageia.org/software/drakx/commit/?id=1b94db0c531b1d9f7a3fc095a5b646fccffc20ec

tools/drakx-in-chroot | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index b8a211a..223ebb7 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -188,8 +188,8 @@ sub create_initial_symlinks() {
symlink $from, $to or die "symlinking $to failed\n";
}
}
- $from = "$STAGE2_LOCATION_ROOTED/usr";
- $to = "$SLASH_LOCATION/usr";
+ my $from = "$STAGE2_LOCATION_ROOTED/usr";
+ my $to = "$SLASH_LOCATION/usr";
symlink $from, $to or die "symlinking $to failed\n";
foreach ('bin', 'sbin', 'lib', 'lib64') {
$from = "usr/$_";
--
Mageia Git Monkeys.
root-odJJhXpcy38dnm+
2014-10-22 22:23:21 UTC
Permalink
This is an automated email from the git hooks/post-receive script.

tv pushed a commit to branch master
in repository software/drakx.

commit 8d32986d9ceae07aa986c81c85d03645d51792ae
Author: Thierry Vignaud <thierry.vignaud-***@public.gmane.org>
Date: Tue Oct 21 23:37:31 2014 +0200

document --stage2-update in --help
---
Commit Link:
http://gitweb.mageia.org/software/drakx/commit/?id=8d32986d9ceae07aa986c81c85d03645d51792ae

perl-install/install/NEWS | 1 +
tools/drakx-in-chroot | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 2eeda98..b76115f 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,4 +1,5 @@
- drakx-in-chroot:
+ o document --stage2-update in --help
o mount /dev -o ro

Version 16.43 - 20 October 2014
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index f8a37c7..b8a211a 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -27,6 +27,7 @@ my ($disk_iso_repository, $repository_uri);
--repository=<path> path of packages repository
--text text mode installer
--depth=XX set screen color depth
+ --stage2-update X,Y will mount --bind X on Y
";

(my $repository, my $dir, @ARGV) = @ARGV;
--
Mageia Git Monkeys.
Loading...