From 0014aa3355a4c848a5af261e428e7958d6eaca40 Mon Sep 17 00:00:00 2001 From: bdeshi Date: Wed, 5 Feb 2020 13:27:27 +0600 Subject: [PATCH] replace `cmd` invocations with $(cmd) --- Makefile | 22 +++++++++++----------- debian/postinst | 4 ++-- gophermap.sample | 8 ++++---- install-sh | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 281b322..c8b04b9 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ MAP = gophermap INETD = /etc/inetd.conf XINETD = /etc/xinetd.d # get OPTIONS line from gophernicus.env and use that also for inetd -INETOPT = `grep '^OPTIONS=' $(NAME).env | tail -n 1 | sed -e 's/OPTIONS="*//;s/"*$$//'` +INETOPT = $$(grep '^OPTIONS=' $(NAME).env | tail -n 1 | sed -e 's/OPTIONS="*//;s/"*$$//') INETLIN = "gopher stream tcp nowait nobody $(SBINDIR)/$(BINARY) $(BINARY) $(INETOPT)" INETPID = /var/run/inetd.pid LAUNCHD = /Library/LaunchDaemons @@ -44,7 +44,7 @@ LDFLAGS = IPCRM = /usr/bin/ipcrm all: - @case `uname` in \ + @case $$(uname) in \ Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDIr)" src/$(BINARY); ;; \ Haiku) $(MAKE) EXTRA_LIBS="-lnetwork" src/$(BINARY); ;; \ *) if [ -f "/usr/include/tcpd.h" ]; then $(MAKE) withwrap; else $(MAKE) src/$(BINARY); fi; ;; \ @@ -103,12 +103,12 @@ clean-deb: if [ -d debian/$(PACKAGE) ]; then fakeroot debian/rules clean; fi clean-shm: - if [ -x $(IPCRM) ]; then $(IPCRM) -M `awk '/SHM_KEY/ { print $$3 }' src/$(NAME).h` || true; fi + if [ -x $(IPCRM) ]; then $(IPCRM) -M $$(awk '/SHM_KEY/ { print $$3 }' src/$(NAME).h) || true; fi # Install cases install: clean-shm - @case `uname` in \ + @case $$(uname) in \ Darwin) $(MAKE) ROOT="$(OSXROOT)" DESTDIR="$(OSXDIR)" install-files install-docs install-root install-osx install-done; ;; \ Haiku) $(MAKE) SBINDIR=/boot/common/bin DOCDIR=/boot/common/share/doc/$(PACKAGE) \ install-files install-docs install-root install-haiku install-done; ;; \ @@ -128,7 +128,7 @@ install-done: @echo "Gophernicus has now been succesfully installed. To try it out, launch" @echo "your favorite gopher browser and navigate to your gopher root." @echo - @echo "Gopher URL...: gopher://`hostname`/" + @echo "Gopher URL...: gopher://$$(hostname)/" @for CONFFILE in /etc/sysconfig/gophernicus \ /etc/default/gophernicus \ /Library/LaunchDaemons/org.gophernicus.server.plist \ @@ -167,7 +167,7 @@ install-inetd: install-files install-docs install-root echo "::::: Gopher entry in $(INETD) already present -- please check! :::::"; \ else echo "Trying to add gopher entry to $(INETD)" ; \ echo "$(INETLIN)" >> $(INETD) ; \ - if [ -r $(INETPID) ] ; then kill -HUP `cat $(INETPID)` ; \ + if [ -r $(INETPID) ] ; then kill -HUP $$(cat $(INETPID)) ; \ else echo "::::: No PID for inetd found, not restarted -- please check! :::::" ; fi ; \ fi ; \ fi @@ -175,14 +175,14 @@ install-inetd: install-files install-docs install-root install-xinetd: install-files install-docs install-root if [ -d "$(XINETD)" -a ! -f "$(XINETD)/$(NAME)" ]; then \ - sed -e "s/@HOSTNAME@/`hostname`/g" $(NAME).xinetd > $(XINETD)/$(NAME); \ + sed -e "s/@HOSTNAME@/$$(hostname)/g" $(NAME).xinetd > $(XINETD)/$(NAME); \ [ -x /sbin/service ] && /sbin/service xinetd reload; \ fi @echo install-osx: if [ -d "$(LAUNCHD)" -a ! -f "$(LAUNCHD)/$(PLIST)" ]; then \ - sed -e "s/@HOSTNAME@/`hostname`/g" src/$(PLIST) > $(LAUNCHD)/$(PLIST); \ + sed -e "s/@HOSTNAME@/$$(hostname)/g" src/$(PLIST) > $(LAUNCHD)/$(PLIST); \ launchctl load $(LAUNCHD)/$(PLIST); \ fi @echo @@ -191,13 +191,13 @@ install-osx: @echo install-haiku: - if [ -f "$(NET_SRV)" -a ! "`grep -m1 gopher $(NET_SRV)`" ]; then \ + if [ -f "$(NET_SRV)" -a ! "$$(grep -m1 gopher $(NET_SRV))" ]; then \ (echo ""; \ echo "service gopher {"; \ echo " family inet"; \ echo " protocol tcp"; \ echo " port 70"; \ - echo " launch $(BINARY) -h `hostname`"; \ + echo " launch $(BINARY) -h $$(hostname)"; \ echo "}") >> $(NET_SRV); \ fi @echo @@ -243,7 +243,7 @@ uninstall-inetd: else if grep '^gopher' $(INETD) >/dev/null 2>&1 && \ sed -i .bak -e 's/^gopher/#gopher/' $(INETD) ; then \ echo "commented out gopher entry in $(INETD), reloading inetd" ; \ - [ -r $(INETPID) ] && kill -HUP `cat $(INETPID)` ; \ + [ -r $(INETPID) ] && kill -HUP $$(cat $(INETPID)) ; \ else echo "::::: could not find gopher entry in $(INETD) :::::" ; \ fi ; \ fi diff --git a/debian/postinst b/debian/postinst index 9729019..3d83d23 100644 --- a/debian/postinst +++ b/debian/postinst @@ -6,7 +6,7 @@ . /usr/share/debconf/confmodule # Configuration -HOSTNAME="`hostname`" +HOSTNAME="$(hostname)" ROOT=/var/gopher PACKAGE=gophernicus LOGDIR=/var/log/$PACKAGE @@ -18,7 +18,7 @@ USER=nobody # Get hostname from debconf db_get gophernicus/fqdn if [ "$RET" ]; then - HOSTNAME="`echo $RET | tr -cd 'A-Za-z0-9.-'`" + HOSTNAME="$(echo $RET | tr -cd 'A-Za-z0-9.-')" fi # Configure gophernicus diff --git a/gophermap.sample b/gophermap.sample index f2a7ac9..f37405d 100644 --- a/gophermap.sample +++ b/gophermap.sample @@ -19,17 +19,17 @@ directory and replace this page. # Generic information: =echo " your ip address: $REMOTE_ADDR" -=echo " server time....: `date`" -=echo " server uptime..: `uptime | sed 's/.*up *\([^,]*\), .*/\1/'`" +=echo " server time....: $(date)" +=echo " server uptime..: $(uptime | sed 's/.*up *\([^,]*\), .*/\1/')" =echo " server version.: $SERVER_VERSION \"$SERVER_CODENAME\"" =echo " server platform: $SERVER_ARCH" =echo " description....: $SERVER_DESCRIPTION" Server configuration: -=echo " config file....: `for FILE in /etc/sysconfig/gophernicus /etc/default/gophernicus /Library/LaunchDaemons/org.gophernicus.server.plist /boot/common/settings/network/services /lib/systemd/system/gophernicus\@.service /etc/xinetd.d/gophernicus /etc/inetd.conf; do if [ -f $FILE ]; then echo $FILE; break; fi; done`" +=echo " config file....: $(for FILE in /etc/sysconfig/gophernicus /etc/default/gophernicus /Library/LaunchDaemons/org.gophernicus.server.plist /boot/common/settings/network/services /lib/systemd/system/gophernicus\@.service /etc/xinetd.d/gophernicus /etc/inetd.conf; do if [ -f $FILE ]; then echo $FILE; break; fi; done)" =echo " server hostname: $SERVER_HOST" =echo " root directory.: $DOCUMENT_ROOT" -=echo " running as user: `whoami`" +=echo " running as user: $(whoami)" =echo " output charset.: $GOPHER_CHARSET" =echo " output width...: $COLUMNS characters" diff --git a/install-sh b/install-sh index 6781b98..0a32938 100755 --- a/install-sh +++ b/install-sh @@ -215,7 +215,7 @@ if test -z "$dir_arg"; then else u_plus_rw='% 200' fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + cp_umask=$(expr '(' 777 - $mode % 1000 ')' $u_plus_rw);; *) if test -z "$stripcmd"; then u_plus_rw= @@ -267,11 +267,11 @@ do exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dst=$dstdir/$(basename "$src") dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` + dstdir=$( (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ @@ -295,7 +295,7 @@ do q } s/.*/./; q' - ` + ) test -d "$dstdir" dstdir_status=$? @@ -309,17 +309,17 @@ do '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` + umask=$(umask) case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) - mkdir_umask=`expr $umask + 22 \ + mkdir_umask=$(expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 - `;; + );; *) mkdir_umask=$umask,go-w;; esac @@ -349,14 +349,14 @@ do # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` + ls_ld_tmpdir=$(ls -ld "$tmpdir") case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + ls_ld_tmpdir_1=$(ls -ld "$tmpdir") test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } @@ -416,7 +416,7 @@ do test -d "$prefix" || exit 1 else case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *\'*) qprefix=$(echo "$prefix" | sed "s/'/'\\\\\\\\''/g");; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" @@ -465,8 +465,8 @@ do # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + old=$(LC_ALL=C ls -dlL "$dst" 2>/dev/null) && + new=$(LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null) && eval "$initialize_posix_glob" && $posix_glob set -f &&