On 23 May 2012 20:25, <[email protected]> wrote: > Revision 4584 Author tv Date 2012-05-23 20:25:15 +0200 (Wed, 23 May 2012) > > Log Message > > (systemd_unit_exists) factorize > > Modified Paths > > drakx/trunk/perl-install/services.pm > > Modified: drakx/trunk/perl-install/services.pm > =================================================================== > --- drakx/trunk/perl-install/services.pm 2012-05-23 18:02:37 UTC (rev > 4583) > +++ drakx/trunk/perl-install/services.pm 2012-05-23 18:25:15 UTC (rev > 4584) > @@ -433,7 +433,7 @@ > if (my ($name, $l) = m!^(\S+)\s+(0:(on|off).*)!) { > # If we expect to use systemd (i.e. installer) only show those > # sysvinit scripts which are not masked by a native systemd > unit. > - my $has_systemd_unit = (-e > "$::prefix/lib/systemd/system/$name.service" or -l > "$::prefix/lib/systemd/system/$name.service"); > + my $has_systemd_unit = systemd_unit_exists($name); > if (!$has_systemd || !$has_systemd_unit) { > if ($::isInstall) { > $on_off = $l =~ /\d+:on/g; > @@ -466,12 +466,14 @@ > > > > +sub systemd_unit_exists { > + my ($name) = @_; > + -e "$::prefix/lib/systemd/system/$name.service" or -l > "$::prefix/lib/systemd/system/$name.service"; > +} > > - > - > sub service_exists { > my ($service) = @_; > - -x "$::prefix/etc/rc.d/init.d/$service" or -e > "$::prefix/lib/systemd/system/$service.service" or -l > "$::prefix/lib/systemd/system/$service.service"; > + -x "$::prefix/etc/rc.d/init.d/$service" or systemd_unit_exists($service); > }
BTW Colin your test is redundant. -e returns true for symlinks too (unless target doesn't exist in which case we don't care much anyway...)
