Bug 280137 - sysutils/bacula*-server: fix filename of the rc scripts to comply to the rc scripting recommendations + service jails options
Summary: sysutils/bacula*-server: fix filename of the rc scripts to comply to the rc s...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dan Langille
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-05 09:00 UTC by Alexander Leidinger
Modified: 2024-07-05 14:57 UTC (History)
1 user (show)

See Also:
dvl: maintainer-feedback+


Attachments
rename rc scripts to comply to recommendations (6.76 KB, patch)
2024-07-05 09:00 UTC, Alexander Leidinger
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2024-07-05 09:00:16 UTC
Created attachment 251879 [details]
rename rc scripts to comply to recommendations

Hi,

The attached patch fixes some issues with the rc script.

A generic discussion about the rc scripts in the ports collection which contains a lot more background information about the "why" of this patch is at 
    https://lists.freebsd.org/archives/freebsd-ports/2024-July/006342.html

Short:
 - the filename shall be the same as the content of the name variable inside the script
 - (already OK) PROVIDE shall be the same as the content of the name variable inside the script
 - this fixes the use of the script with service jails (new feature in -current)

Additionally to what is discussed there and fixed in the patch, I made the following additional changes:
 - add an UPATING entry (date needs to be adapted, this may conflict at the time when you apply/commit)
 - add service jails options to the scripts to enable the use in service jails (new feature in -current)
   the svcj_options allow the use of the host-network, if you want to allow sysvipc you need to replace
   "net_basic" with "net_basic sysvipc" (inherits/shares the sysv stuff, "sysipcnew" if the sysvipc parts shall be uniq to the specific service)
   if no network access is required for a service, you can set it hard to empty (bacula_XXX_svcj_options="")

The service jails part will not cause issues when service jails are not enabled. If bacula works inside a jail, it will work inside service jails too, the only question is which kind of jail permissions need to be enabled for the services. The handbook has more info about service jails:
    https://docs.freebsd.org/en/books/handbook/jails/#service-jails
    https://docs.freebsd.org/en/articles/rc-scripting/#rcng-service-jails

You may want to run the following before applying the patch:
  for d in sysutils/bacula*-server/files; do      
    git mv $d/bacula-dir.in $d/bacula_dir.in                                                                       
    git mv $d/bacula-sd.in $d/bacula_sd.in                                                                         
  done
  
Bye,
Alexander.
Comment 1 Dan Langille freebsd_committer freebsd_triage 2024-07-05 12:23:35 UTC
I think the path also needs to update bacula-fd
Comment 2 Dan Langille freebsd_committer freebsd_triage 2024-07-05 12:28:51 UTC
(In reply to Dan Langille from comment #1)
*patch
Comment 3 Alexander Leidinger freebsd_committer freebsd_triage 2024-07-05 12:38:34 UTC
I do not see bacula-fd in RC_SUBR in bacula*-server.

# grep RC_SUBR sysutils/bacula*-server/Makefile                                                                         
sysutils/bacula11-server/Makefile:USE_RC_SUBR?= bacula_dir bacula_sd
sysutils/bacula13-server/Makefile:USE_RC_SUBR?= bacula_dir bacula_sd
sysutils/bacula15-server/Makefile:USE_RC_SUBR?= bacula_dir bacula_sd
sysutils/bacula9-server/Makefile:USE_RC_SUBR?=  bacula_dir bacula_sd
Comment 4 Dan Langille freebsd_committer freebsd_triage 2024-07-05 13:22:54 UTC
It took me a while to find it too. It's over here. No action required. I'm nearly done my testports.

[13:22 pkg01 dvl ~/ports/head] % git diff sysutils/bacula9-client/Makefile
diff --git a/sysutils/bacula9-client/Makefile b/sysutils/bacula9-client/Makefile
index 57ae8f72a757..19359d0fea42 100644
--- a/sysutils/bacula9-client/Makefile
+++ b/sysutils/bacula9-client/Makefile
@@ -7,7 +7,7 @@ BROKEN_aarch64=         Fails to link: missing sbrk
 BROKEN_riscv64=                Fails to link: missing sbrk
 
 WITH_CLIENT_ONLY=yes
-USE_RC_SUBR=   bacula-fd
+USE_RC_SUBR=   bacula_fd
 
 PLIST=         ${PKGDIR}/pkg-plist.client
 MASTERDIR=     ${.CURDIR}/../../sysutils/bacula9-server
[13:22 pkg01 dvl ~/ports/head] %
Comment 5 Dan Langille freebsd_committer freebsd_triage 2024-07-05 13:44:37 UTC
How should we name the UPDATING entry?

sysutils/bacula*-server|client

I think it needs to be a proper glob.  This seems to work:

[13:43 pkg01 dvl ~/ports/head] % ls -d sysutils/bacula*-{client,server}
sysutils/bacula11-client/ sysutils/bacula13-client/ sysutils/bacula15-client/ sysutils/bacula9-client/
sysutils/bacula11-server/ sysutils/bacula13-server/ sysutils/bacula15-server/ sysutils/bacula9-server/
Comment 6 Dan Langille freebsd_committer freebsd_triage 2024-07-05 13:47:05 UTC
This is my proposed UPDATING entry:

20240705:
  AFFECTS: sysutils/bacula*-{client,server}
  AUTHOR: netchildFreeBSD.org

  The start scripts of bacula have been renamed to bacula_fd, bacula_dir and
  bacula_sd for improved compatibility with other parts of the
  system. The automatic start at boot (rc.conf variable settings) is
  not affected, but if you have some other automatism you may want to
  change
    ".../etc/rc.d/bacula-fd"  to ".../etc/rc.d/bacula_fd"
    ".../etc/rc.d/bacula-dir" to ".../etc/rc.d/bacula_dir"
    ".../etc/rc.d/bacula-sd"  to ".../etc/rc.d/bacula_sd"
  or
    "service bacula-fd ..."  to "service bacula_fd ..."
    "service bacula-dir ..." to "service bacula_dir ..."
    "service bacula-sd ..."  to "service bacula_sd ..."
Comment 7 Alexander Leidinger freebsd_committer freebsd_triage 2024-07-05 14:05:49 UTC
Whatever pleases you for the UPDATING part. :-)

I suggest to add a line to bacula_fd for the svcj_options similar to the others...
: ${bacula_fd_svcj_options:="net_basic"}
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-07-05 14:54:03 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8636c2e7142ea93b5c23609c5f06f4e52aa0ad31

commit 8636c2e7142ea93b5c23609c5f06f4e52aa0ad31
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2024-07-05 14:34:34 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2024-07-05 14:36:51 +0000

    sysutils/bacula*-{client,server}: fix rc script names

    The filenames now comply with the rc scripting recommendations and
    service jails options.

    Users may have to update any personal scripts they have which depend
    upon those rc.d script names. See UPDATING for 20240705

    PR:             280137

 UPDATING                                                | 17 +++++++++++++++++
 sysutils/bacula11-client/Makefile                       |  2 +-
 sysutils/bacula11-server/Makefile                       |  4 ++--
 .../files/{bacula-dir.in => bacula_dir.in}              |  1 +
 .../bacula-fd.in => bacula11-server/files/bacula_fd.in} |  1 +
 .../bacula-sd.in => bacula11-server/files/bacula_sd.in} |  1 +
 sysutils/bacula13-client/Makefile                       |  2 +-
 sysutils/bacula13-server/Makefile                       |  4 ++--
 .../files/bacula_dir.in}                                |  1 +
 .../bacula-fd.in => bacula13-server/files/bacula_fd.in} |  1 +
 .../bacula-sd.in => bacula13-server/files/bacula_sd.in} |  1 +
 sysutils/bacula15-client/Makefile                       |  2 +-
 sysutils/bacula15-server/Makefile                       |  4 ++--
 .../files/bacula_dir.in}                                |  1 +
 .../files/{bacula-fd.in => bacula_fd.in}                |  1 +
 .../bacula-sd.in => bacula15-server/files/bacula_sd.in} |  1 +
 sysutils/bacula9-client/Makefile                        |  2 +-
 sysutils/bacula9-server/Makefile                        |  2 +-
 .../files/bacula_dir.in}                                |  1 +
 .../bacula9-server/files/{bacula-fd.in => bacula_fd.in} |  1 +
 .../bacula-sd.in => bacula9-server/files/bacula_sd.in}  |  1 +
 21 files changed, 40 insertions(+), 11 deletions(-)
Comment 9 Dan Langille freebsd_committer freebsd_triage 2024-07-05 14:57:27 UTC
(In reply to Alexander Leidinger from comment #7)
Thank you for that suggestion. I included it in the commit.

Thank you for the work on this. It made it much easier.