[pve-devel] [PATCH container] setup: add ct_is_executable wrapper
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Apr 11 08:57:14 CEST 2016
(This is only a minor fix since these functions are run
while chrooted into the container directory anyway.)
---
src/PVE/LXC/Setup/Base.pm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
index e65b04a..1490578 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -158,7 +158,7 @@ sub setup_init {
sub setup_systemd_console {
my ($self, $conf) = @_;
- my $systemd_dir_rel = -x "/lib/systemd/systemd" ?
+ my $systemd_dir_rel = $self->ct_is_executable("/lib/systemd/systemd") ?
"/lib/systemd/system" : "/usr/lib/systemd/system";
my $systemd_getty_service_rel = "$systemd_dir_rel/getty\@.service";
@@ -199,7 +199,7 @@ sub setup_systemd_console {
sub setup_container_getty_service {
my ($self, $nosubdir) = @_;
- my $systemd_dir_rel = -x "/lib/systemd/systemd" ?
+ my $systemd_dir_rel = $self->ct_is_executable("/lib/systemd/systemd") ?
"/lib/systemd/system" : "/usr/lib/systemd/system";
my $servicefile = "$systemd_dir_rel/container-getty\@.service";
my $raw = $self->ct_file_get_contents($servicefile);
@@ -530,6 +530,11 @@ sub ct_is_symlink {
return -l $file;
}
+sub ct_is_executable {
+ my ($self, $file) = @_;
+ return -x $file
+}
+
sub ct_stat {
my ($self, $file) = @_;
return File::stat::stat($file);
--
2.1.4
More information about the pve-devel
mailing list