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
Executables in $PATH should not have extensions. This enables a re-write
in a different language.

Signed-off-by: Mark Grant <[email protected]>
  • Loading branch information
m-grant-prg committed Oct 9, 2023
1 parent 4d96a4e commit cbc6969
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 31 deletions.
16 changes: 9 additions & 7 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) 2014-2021 Mark Grant #
# Author: Copyright (C) 2014-2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand Down Expand Up @@ -36,11 +36,13 @@
# 22/05/2020 MG 1.0.9 Rename script to have .sh extension. #
# Add apt-key-scripts.sh man page. #
# 22/11/2021 MG 1.0.10 Tighten SPDX tag. #
# 09/10/2023 MG 1.0.11 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################


agmaint.sh.8 apt-key-scripts.sh.8: Makefile
agmaint.8 apt-key-scripts.8: Makefile
mkdir -p $(@D)
rm -f $@ $@.tmp
$(edit) $(srcdir)/$(@F).man.in > $@.tmp
Expand All @@ -59,13 +61,13 @@ agmaint.sh.8 apt-key-scripts.sh.8: Makefile
txt2manwrap $(@F) $$section "agmaint Manual" $@.tmp $@
rm -f $@.tmp

agmaint.sh.8: $(srcdir)/agmaint.sh.8.man.in
apt-key-scripts.sh.8: $(srcdir)/apt-key-scripts.sh.8.man.in
agmaint.8: $(srcdir)/agmaint.8.man.in
apt-key-scripts.8: $(srcdir)/apt-key-scripts.8.man.in

man_MANS = agmaint.sh.8 apt-key-scripts.sh.8
man_MANS = agmaint.8 apt-key-scripts.8

EXTRA_DIST = $(srcdir)/agmaint.sh.8.man.in $(srcdir)/apt-key-scripts.sh.8.man.in
EXTRA_DIST = $(srcdir)/agmaint.8.man.in $(srcdir)/apt-key-scripts.8.man.in


CLEANFILES = *.tmp agmaint.sh.8 apt-key-scripts.sh.8
CLEANFILES = *.tmp agmaint.8 apt-key-scripts.8

8 changes: 4 additions & 4 deletions src/man/8/agmaint.sh.8.man.in → src/man/8/agmaint.8.man.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
NAME
agmaint.sh - agmaint script
agmaint - agmaint script
SYNOPSIS
agmaint.sh [OPTION]
agmaint [OPTION]
DESCRIPTION
A script to automate running of daily apt-get maintenance commands.

Any arguments after a -- will get passed straight to the apt-get commands. This
is useful for automatically assuming yes. e.g.
.br
agmaint.sh -- -y
agmaint -- -y
OPTIONS
-h, --help prints usage information

Expand All @@ -24,7 +24,7 @@ Written by Mark Grant.
REPORTING BUGS
Report bugs to <[email protected]>
COPYRIGHT
Copyright (C) 2014-2017, 2019-2021 Mark Grant.
Copyright (C) 2014-2017, 2019-2021, 2023 Mark Grant.
.br
License GPLv3: GNU GPL version 3 only
.br
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
NAME
apt-key-scripts.sh - A script to manage scripts to retrieve APT keys and store
apt-key-scripts - A script to manage scripts to retrieve APT keys and store
them in APT keyrings.
SYNOPSIS
apt-key-scripts.sh [OPTION]
apt-key-scripts [OPTION]
DESCRIPTION
This is a helper script to simplify management of apt keys. The process is
envisaged to go something like this:-
Expand All @@ -20,12 +20,12 @@ curl -fsSL"$verbose" http://hermes.mgent.home/aptrepos/hermes.gpg \

2 ... Install the script by
.RS
apt-key-scripts.sh --install 'script_name'
apt-key-scripts --install 'script_name'
.RE

3 ... Run the script by
.RS
apt-key-scripts.sh --exec 'script_name'
apt-key-scripts --exec 'script_name'
.RE
OPTIONS
-a or --exec-all Execute all the available scripts
Expand Down Expand Up @@ -60,7 +60,7 @@ Example scripts can be found in @pkgdatadir@/trusted.sh.d
AUTHOR
Written by Mark Grant.
COPYRIGHT
Copyright (C) 2020-2022 Mark Grant.
Copyright (C) 2020-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,7 +1,7 @@
#########################################################################
# #
# Script ID: src/prg/bash/Makefile.am #
# Author: Copyright (C) 2014-2021 Mark Grant #
# Author: Copyright (C) 2014-2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
# SPDX-License-Identifier: GPL-3.0-only #
Expand Down Expand Up @@ -32,23 +32,25 @@
# 21/05/2020 MG 1.0.9 Change script extension .sh #
# Add apt-key-scripts.sh #
# 22/11/2021 MG 1.0.10 Tighten SPDX tag. #
# 09/10/2023 MG 1.0.11 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################


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

sbin_SCRIPTS = agmaint.sh apt-key-scripts.sh
sbin_SCRIPTS = agmaint apt-key-scripts

EXTRA_DIST = $(srcdir)/agmaint.sh.in $(srcdir)/apt-key-scripts.sh.in

CLEANFILES = *.tmp agmaint.sh apt-key-scripts.sh
CLEANFILES = *.tmp agmaint apt-key-scripts

10 changes: 6 additions & 4 deletions src/prg/bash/agmaint.sh.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#! @bashlocation@
#########################################################################
# #
# agmaint.sh is automatically generated, #
# agmaint is automatically generated, #
# please do not modify! #
# #
#########################################################################

#########################################################################
# #
# Script ID: agmaint.sh #
# Script ID: agmaint #
# Author: Copyright (C) 2014-2017, 2019-2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
Expand All @@ -17,7 +17,7 @@
# Purpose: #
# To simplify the running of daily apt-get maintenance commands. #
# #
# Syntax: agmaint.sh [ -h || --help ] || [ -V || --version ] #
# Syntax: agmaint [ -h || --help ] || [ -V || --version ] #
# #
# Exit codes used:- #
# Bash standard Exit Codes: 0 - success #
Expand Down Expand Up @@ -83,14 +83,16 @@
# 22/11/2021 MG 1.1.3 Tighten SPDX tag. #
# 26/06/2023 MG 1.1.4 Fix shellcheck warnings. #
# 10/07/2023 MG 1.1.5 Treat cli_extra_args as an array. #
# 09/10/2023 MG 1.1.6 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################


##################
# Init variables #
##################
readonly version=1.1.5 # Script version
readonly version=1.1.6 # Script version
readonly packageversion=@pkgversion@ # Package version

cli_extra_args=()
Expand Down
10 changes: 6 additions & 4 deletions src/prg/bash/apt-key-scripts.sh.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#! @bashlocation@
#########################################################################
# #
# apt-key-scripts.sh is automatically generated, #
# apt-key-scripts is automatically generated, #
# please do not modify! #
# #
#########################################################################

#########################################################################
# #
# Script ID: apt-key-scripts.sh #
# Script ID: apt-key-scripts #
# Author: Copyright (C) 2020, 2021, 2023 Mark Grant #
# #
# Released under the GPLv3 only. #
Expand All @@ -18,7 +18,7 @@
# To manage and execute scripts for maintaining apt trusted keys and #
# keyrings. #
# #
# Syntax: apt-key-scripts.sh [ -a || --exec-all ] || #
# Syntax: apt-key-scripts [ -a || --exec-all ] || #
# [ -c || --cat ] || #
# [ -e || --exec ] || #
# [ -h || --help ] || #
Expand Down Expand Up @@ -69,14 +69,16 @@
# 22/11/2021 MG 1.0.3 Tighten SPDX tag. #
# 26/06/2023 MG 1.0.4 Fix shellcheck warnings. #
# 07/07/2023 MG 1.0.5 Handle verbose as an array. #
# 09/10/2023 MG 1.0.6 Drop .sh extension from scripts in #
# $PATH. #
# #
#########################################################################


##################
# Init variables #
##################
readonly version=1.0.5 # Script version
readonly version=1.0.6 # Script version
readonly packageversion=@pkgversion@ # Package version

readonly scriptloc=@sysconfdir@/@pkgtarname@/trusted.sh.d # Live scripts
Expand Down

0 comments on commit cbc6969

Please sign in to comment.