summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2020-09-15 13:29:01 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2020-09-15 13:29:01 +0100
commita6c0b23905965b787b46a4cf13b42b600d5b67e7 (patch)
treec613e1bf351ebe0190fe51cb849b33bcffa083ca
parent7c3631482286d17a2983a47295ce9b0872780a8d (diff)
downloaddrakx-a6c0b23905965b787b46a4cf13b42b600d5b67e7.tar
drakx-a6c0b23905965b787b46a4cf13b42b600d5b67e7.tar.gz
drakx-a6c0b23905965b787b46a4cf13b42b600d5b67e7.tar.bz2
drakx-a6c0b23905965b787b46a4cf13b42b600d5b67e7.tar.xz
drakx-a6c0b23905965b787b46a4cf13b42b600d5b67e7.zip
Fix saned activation/deactivation in scanner functions.
Our saned package switched from xinetd to systemd socket activation back in 2019.
-rw-r--r--perl-install/scanner.pm33
-rwxr-xr-xperl-install/standalone/scannerdrake17
2 files changed, 11 insertions, 39 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm
index 8967dd7d0..777f7192f 100644
--- a/perl-install/scanner.pm
+++ b/perl-install/scanner.pm
@@ -177,7 +177,7 @@ sub nonroot_access_for_parport {
# Desired state of this facility: 1: Enable, 0: Disable
my ($enable, $in) = @_;
# Is saned running?
- my $sanedrunning = services::starts_on_boot("saned");
+ my $sanedrunning = services::starts_on_boot("saned.socket");
# Is the "net" SANE backend active
my $netbackendactive = find { /^\s*net\s*$/ }
cat_("/etc/sane.d/dll.conf");
@@ -191,11 +191,9 @@ sub nonroot_access_for_parport {
# Install/start saned
if (!$sanedrunning) {
- # Make sure saned and xinetd is installed and
- # running
- if (!files_exist('/usr/sbin/xinetd',
- '/usr/sbin/saned')) {
- if (!$in->do_pkgs->install('xinetd', 'saned')) {
+ # Make sure saned is installed and running
+ if (!files_exist('/usr/sbin/saned')) {
+ if (!$in->do_pkgs->install('saned')) {
$in->ask_warn(N("Scannerdrake"),
N("Could not install the packages needed to share your scanner(s).") . " " .
N("Your scanner(s) will not be available for non-root users."));
@@ -204,12 +202,6 @@ sub nonroot_access_for_parport {
}
}
- # Modify /etc/xinetd.d/saned to let saned run as root
- my @sanedxinetdconf = cat_("/etc/xinetd.d/saned");
- s/(user\s*=\s*).*$/$1root/ foreach @sanedxinetdconf;
- s/(group\s*=\s*).*$/$1root/ foreach @sanedxinetdconf;
- output("/etc/xinetd.d/saned", @sanedxinetdconf);
-
# Read list of hosts to where to export the local scanners
my @exports = cat_("/etc/sane.d/saned.conf");
# Read list of hosts from where to import scanners
@@ -230,22 +222,7 @@ sub nonroot_access_for_parport {
# (Re)start saned and make sure that it gets started on
# every boot
- services::start_service_on_boot("saned");
- services::start_service_on_boot("xinetd");
- services::restart("xinetd");
-
- } else {
- # Disable non-root access
-
- if (-r "/etc/xinetd.d/saned") {
- # Modify /etc/xinetd.d/saned to let saned run as saned
- my @sanedxinetdconf = cat_("/etc/xinetd.d/saned");
- s/(user\s*=\s*).*$/$1saned/ foreach @sanedxinetdconf;
- s/(group\s*=\s*).*$/$1saned/ foreach @sanedxinetdconf;
- output("/etc/xinetd.d/saned", @sanedxinetdconf);
- # Restart xinetd
- services::restart("xinetd") if $sanedrunning;
- }
+ services::enable("saned.socket");
}
return 1;
diff --git a/perl-install/standalone/scannerdrake b/perl-install/standalone/scannerdrake
index 2e48bcfce..947c4c086 100755
--- a/perl-install/standalone/scannerdrake
+++ b/perl-install/standalone/scannerdrake
@@ -570,7 +570,7 @@ sub sharewindow {
my ($menuimports, $menuimports_inv) =
makeimportmenues(@imports);
# Is saned running?
- my $sanedrunning = services::starts_on_boot("saned");
+ my $sanedrunning = services::starts_on_boot("saned.socket");
my $oldsanedrunning = $sanedrunning;
# Is the "net" SANE backend active
my $netbackendactive = find { /^\s*net\s*$/ }
@@ -944,16 +944,14 @@ sub sharewindow {
# Turn on/off saned
if ($sanedrunning != $oldsanedrunning) {
if ($sanedrunning) {
- # Make sure saned and xinetd is installed and
- # running
- if (!files_exist('/usr/sbin/xinetd',
- '/usr/sbin/saned')) {
+ # Make sure saned is installed and running
+ if (!files_exist('/usr/sbin/saned')) {
if (!$in->ask_yesorno(N("Warning"), N("saned needs to be installed to share the local scanner(s).
Do you want to install the saned package?"))) {
$in->ask_warn("Warning",
N("Your scanner(s) will not be available on the network."));
- } elsif (!$in->do_pkgs->install('xinetd', 'saned')) {
+ } elsif (!$in->do_pkgs->install('saned')) {
$in->ask_warn(N("Error"),
N("Could not install the packages needed to share your scanner(s).") . " " .
N("Your scanner(s) will not be available on the network."));
@@ -961,14 +959,11 @@ Do you want to install the saned package?"))) {
}
# Start saned and make sure that it gets started on
# every boot
- services::start_service_on_boot("saned");
- services::start_service_on_boot("xinetd");
- services::restart("xinetd");
+ services::enable("saned.socket");
} else {
# Stop saned and make sure that it does not get
# started when booting
- services::do_not_start_service_on_boot("saned");
- services::restart("xinetd");
+ services::disable("saned.socket");
}
}
# Turn on/off "net" SANE backend