Skip to content

Commit

Permalink
bash: man: Drop .sh extension from scripts in $PATH
Browse files Browse the repository at this point in the history
The normal convention is that executables in $PATH do not have an
extension. This is to allow a re-write in a different language without
affecting the user.

Signed-off-by: Mark Grant <m.grant.prg@gmail.com>
  • Loading branch information
m-grant-prg committed Oct 16, 2023
1 parent 44a8fba commit 9267d2f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
14 changes: 8 additions & 6 deletions src/man/8/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#########################################################################
# #
# Script ID: src/man/8/Makefile.am #
# Author: Copyright (C) 2018-2019, 2021 Mark Grant #
# Author: Copyright (C) 2018-2019, 2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand All @@ -20,11 +20,13 @@
# 27/09/2018 MG 1.0.1 Initial release. #
# 20/04/2019 MG 1.0.2 Remove shebang. #
# 26/11/2021 MG 1.0.3 Tighten SPDX tag. #
# 16/10/2023 MG 1.0.4 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################


dosab.sh.8: Makefile
dosab.8: Makefile
mkdir -p $(@D)
rm -f $@ $@.tmp
$(edit) $(srcdir)/$(@F).man.in > $@.tmp
Expand All @@ -44,10 +46,10 @@ dosab.sh.8: Makefile
$@.tmp $@
rm -f $@.tmp

dosab.sh.8: $(srcdir)/dosab.sh.8.man.in
dosab.8: $(srcdir)/dosab.8.man.in

man_MANS = dosab.sh.8
man_MANS = dosab.8

EXTRA_DIST = $(srcdir)/dosab.sh.8.man.in
EXTRA_DIST = $(srcdir)/dosab.8.man.in

CLEANFILES = *.tmp dosab.sh.8
CLEANFILES = *.tmp dosab.8
6 changes: 3 additions & 3 deletions src/man/8/dosab.sh.8.man.in → src/man/8/dosab.8.man.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME
dosab.sh - Take action depending on server availability during boot.
dosab - Take action depending on server availability during boot.
SYNOPSIS
dosab.sh [OPTION]
dosab [OPTION]
DESCRIPTION
This script reads a list of servers from the config file server.list and
determines whether they are contactable. If they are, commands stored in the
Expand All @@ -25,7 +25,7 @@ Written by Mark Grant.
REPORTING BUGS
Report bugs to <m.grant.prg@gmail.com>
COPYRIGHT
Copyright 2018, 2021 Mark Grant.
Copyright 2018, 2021, 2023 Mark Grant.
.br
License GPLv3: GNU GPL version 3 only
.br
Expand Down
16 changes: 9 additions & 7 deletions src/prg/bash/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#########################################################################
# #
# Script ID: src/prg/bash/Makefile.am #
# Author: Copyright (C) 2018-2019, 2021 Mark Grant #
# Author: Copyright (C) 2018-2019, 2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
# #
# Purpose: #
# AutoMake script file to generate dosab.sh script from source. #
# AutoMake script file to generate dosab script from source. #
# #
#########################################################################

Expand All @@ -21,6 +21,8 @@
# 20/04/2019 MG 1.0.2 Remove shebang. #
# 24/08/2021 MG 1.0.3 Correct systemd action ordering. #
# 26/11/2021 MG 1.0.4 Tighten SPDX tag. #
# 16/10/2023 MG 1.0.5 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################

Expand All @@ -33,17 +35,17 @@
#########################################################################


dosab.sh: Makefile
dosab: Makefile
mkdir -p $(@D)
rm -f $@ $@.tmp
test -f ./$@.in || srcdir=$(srcdir)/; \
$(edit) $${srcdir}$(@F).in > $@.tmp
$(edit) $${srcdir}$(@F).sh.in > $@.tmp
mv $@.tmp $@
chmod a+x $@
dosab.sh: $(srcdir)/dosab.sh.in
dosab: $(srcdir)/dosab.sh.in


sbin_SCRIPTS = dosab.sh
sbin_SCRIPTS = dosab


# systemd requires some ordering of it's actions. Please refer to the comment in
Expand All @@ -56,5 +58,5 @@ endif

EXTRA_DIST = $(srcdir)/dosab.sh.in

CLEANFILES = *.tmp dosab.sh
CLEANFILES = *.tmp dosab

12 changes: 7 additions & 5 deletions src/prg/bash/dosab.sh.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#! @bashlocation@
#########################################################################
# #
# dosab.sh is automatically generated, #
# dosab is automatically generated, #
# please do not modify! #
# #
#########################################################################

#########################################################################
# #
# Script ID: dosab.sh #
# Author: Copyright (C) 2018-2019, 2021 Mark Grant #
# Script ID: dosab #
# Author: Copyright (C) 2018-2019, 2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand All @@ -18,7 +18,7 @@
# To determine if a server is contactable and conditional on that, #
# execute stored commands. #
# #
# Syntax: dosab.sh [ -h --help || -V --version ] #
# Syntax: dosab [ -h --help || -V --version ] #
# #
# Exit codes used:- #
# Bash standard Exit Codes: 0 - success #
Expand Down Expand Up @@ -75,6 +75,8 @@
# used. #
# Move script_exit() before it is used. #
# 26/11/2021 MG 1.1.4 Tighten SPDX tag. #
# 16/10/2023 MG 1.2.0 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################

Expand All @@ -84,7 +86,7 @@
##################

readonly outputprefix="$(basename $0):"
readonly version=1.1.4 # Script version
readonly version=1.2.0 # Script version
readonly etclocation=@sysconfdir@/dosab # Path to etc directory
readonly packageversion=@pkgversion@ # Package version

Expand Down
4 changes: 2 additions & 2 deletions src/systemd/dosab.service.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=Dependency On Server At Boot
Documentation=man:dosab.sh(8)
Documentation=man:dosab(8)
After=network-online.target remote-fs.target
Wants=network-online.target

[Service]
Type=exec

ExecStart=@sbindir@/dosab.sh
ExecStart=@sbindir@/dosab
Restart=no

[Install]
Expand Down

0 comments on commit 9267d2f

Please sign in to comment.