Merge pull request #282 from simensen/bin-link-chmod-fix

Change permission of bin links if they exist and are already links
main
Jordi Boggiano 13 years ago
commit 1733f08f40

@ -147,6 +147,12 @@ class LibraryInstaller implements InstallerInterface
foreach ($package->getBinaries() as $bin) { foreach ($package->getBinaries() as $bin) {
$link = $this->binDir.'/'.basename($bin); $link = $this->binDir.'/'.basename($bin);
if (file_exists($link)) { if (file_exists($link)) {
if (is_link($link)) {
// likely leftover from a previous install, make sure
// that the target is still executable in case this
// is a fresh install of the vendor.
chmod($link, 0755);
}
$this->io->write('Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file'); $this->io->write('Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file');
continue; continue;
} }
@ -156,14 +162,14 @@ class LibraryInstaller implements InstallerInterface
// add unixy support for cygwin and similar environments // add unixy support for cygwin and similar environments
if ('.bat' !== substr($bin, -4)) { if ('.bat' !== substr($bin, -4)) {
file_put_contents($link, $this->generateUnixyProxyCode($bin, $link)); file_put_contents($link, $this->generateUnixyProxyCode($bin, $link));
chmod($link, 0777); chmod($link, 0755);
$link .= '.bat'; $link .= '.bat';
} }
file_put_contents($link, $this->generateWindowsProxyCode($bin, $link)); file_put_contents($link, $this->generateWindowsProxyCode($bin, $link));
} else { } else {
symlink($bin, $link); symlink($bin, $link);
} }
chmod($link, 0777); chmod($link, 0755);
} }
} }

Loading…
Cancel
Save