Re: [pve-devel] [PATCH rebased container] setup: add ct_is_executable wrapper

2016-05-12 Thread Dietmar Maurer
applied

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH rebased container] setup: add ct_is_executable wrapper

2016-05-12 Thread Wolfgang Bumiller
(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 d54c0cd..927f779 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -159,7 +159,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";
@@ -200,7 +200,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);
@@ -549,6 +549,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


___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel