From b4b28d54a90fdc8e4d3967649e9b97d430552968 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Mon, 10 Jul 2017 10:19:58 -0500 Subject: [PATCH] systemd compatibility: use service(8) We documented (and used!) /etc/init.d/openafs-* directly in a few places, including afs-newcell. This is not the right thing to do in a systemd world, so use a portable scheme instead. service(8) is provided by init-system-helpers, which is essential. Change-Id: I1a94216732d1e4700a1536d5343071833b4b7076 --- debian/README.servers | 2 +- debian/afs-newcell | 8 ++++---- debian/afs.conf | 2 +- debian/changelog | 2 ++ debian/configuration-transcript.txt | 8 ++++---- debian/openafs-client.templates | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/debian/README.servers b/debian/README.servers index 00e9ce938..32b36f643 100644 --- a/debian/README.servers +++ b/debian/README.servers @@ -121,7 +121,7 @@ Creating a New Cell If you have already installed openafs-client and configured it for some other cell, you do need to configure it to point to your new cell for these instructions to work. Stop the AFS client on the - system with /etc/init.d/openafs-client stop and then run: + system with service openafs-client stop and then run: dpkg-reconfigure openafs-client diff --git a/debian/afs-newcell b/debian/afs-newcell index 456433fd0..87e05860f 100755 --- a/debian/afs-newcell +++ b/debian/afs-newcell @@ -104,7 +104,7 @@ while() { if (m:^AFS:) { print "The AFS client is currently running on this workstation.\n"; print "Please restart this script after running" - . " /etc/init.d/openafs-client stop\n"; + . " service openafs-client stop\n"; exit(1); } } @@ -119,7 +119,7 @@ unless ( -f "/etc/openafs/server/KeyFile") { # Stop the file server. print "If the fileserver is not running, this may hang for 30 seconds.\n"; -run("/etc/init.d/openafs-fileserver stop"); +run("service openafs-fileserver stop"); # Get the local hostname. Use the fully-qualified hostname to be safer. $server = `hostname -f`; @@ -194,7 +194,7 @@ print CELLSERVDB inet_ntoa($ip), "\t\t\t#$server\n"; close CELLSERVDB or die "Cannot write to /etc/openafs/server/CellServDB: $!\n"; # Now, we should be able to start bos and add the admin user. -run("/etc/init.d/openafs-fileserver start"); +run("service openafs-fileserver start"); $shutdown_needed = 1; run("bos adduser $server $afs_admin -localauth"); unwind("bos removeuser $server $afs_admin -localauth"); @@ -256,7 +256,7 @@ open(THIS, "> /etc/openafs/ThisCell") or die "ERROR: Cannot create /etc/openafs/ThisCell: $!\n"; print THIS "$cell\n"; close THIS or die "ERROR: Cannot write to /etc/openafs/ThisCell: $!\n"; -run("/etc/init.d/openafs-client force-start"); +run("service openafs-client force-start"); # Verify that AFS has managed to start. my $afs_running = 0; diff --git a/debian/afs.conf b/debian/afs.conf index f3eeb76f3..701d50f49 100644 --- a/debian/afs.conf +++ b/debian/afs.conf @@ -107,7 +107,7 @@ AFS_PRE_SHUTDOWN= # with open AFS files to be killed before unmounting AFS if the runlevel being # switched to is 0 or 6. # -# Warning: This means /etc/init.d/openafs-client stop will kill all processes +# Warning: This means service openafs-client stop will kill all processes # with files open in AFS rather than returning an error saying the file system # is busy. This is probably what you want when the whole system is shutting # down, but often *not* what you want when just stopping and restarting the diff --git a/debian/changelog b/debian/changelog index e2b6b48ac..eef1f6d7f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ openafs (1.6.21-1) UNRELEASED; urgency=medium * Switch openafs-fileserver.service to Type=simple and pass -nofork to bosserver. (Closes: #865962) * Update for policy version 4.0.0, honor nodoc in DEB_BUILD_OPTIONS + * Use service(8) instead of /etc/init.d/* directly in documentation and + helper scripts -- Benjamin Kaduk Thu, 06 Jul 2017 09:19:27 -0500 diff --git a/debian/configuration-transcript.txt b/debian/configuration-transcript.txt index 57cc3ba16..1acaeb61d 100644 --- a/debian/configuration-transcript.txt +++ b/debian/configuration-transcript.txt @@ -207,7 +207,7 @@ Should the Openafs filesystem be started and mounted at boot? Normally, most users who install the openafs-client package expect to run it at boot. However, if you are planning on setting up a new cell or are on a laptop, you may not want it started at boot time. If you -choose not to start AFS at boot , run /etc/init.d/openafs-client +choose not to start AFS at boot , run service openafs-client force-start to start the client when you wish to run it. Run Openafs client now and at boot? no @@ -303,13 +303,13 @@ In order to set up a new AFS cell, you must meet the following: Do you meet these requirements? [y/n] y If the fileserver is not running, this may hang for 30 seconds. -/etc/init.d/openafs-fileserver stop +service openafs-fileserver stop Stopping AFS Server: bos: could not find entry (can't find cell '' in cell database) bosserver. What administrative principal should be used? faheem/admin /etc/openafs/server/CellServDB already exists, renaming to .old -/etc/init.d/openafs-fileserver start +service openafs-fileserver start Starting AFS Server: bosserver. bos adduser riverside.dulci.biostat.duke.edu faheem.admin -localauth pt_util: /var/lib/openafs/db/prdb.DB0: Bad UBIK_MAGIC. Is 0 should be 354545 @@ -323,7 +323,7 @@ bos create riverside.dulci.biostat.duke.edu fs fs -cmd /usr/lib/openafs/fileserv Waiting for database elections: done. vos create riverside.dulci.biostat.duke.edu a root.afs -localauth Volume 536870912 created on partition /vicepa of riverside.dulci.biostat.duke.edu -/etc/init.d/openafs-client force-start +service openafs-client force-start Starting AFS services: afsd: All AFS daemons started. afsd. diff --git a/debian/openafs-client.templates b/debian/openafs-client.templates index 3002840c0..6df69f6db 100644 --- a/debian/openafs-client.templates +++ b/debian/openafs-client.templates @@ -36,7 +36,7 @@ _Description: Run Openafs client now and at boot? be mounted automatically at boot. However, if you are planning on setting up a new cell or are on a laptop, you may not want it started at boot time. If you choose not to start AFS at boot, run - /etc/init.d/openafs-client force-start to start the client when you wish + service openafs-client force-start to start the client when you wish to run it. Template: openafs-client/afsdb -- 2.39.5