From 76c6a9b42a3604d30911c96d5ce4ae3c9be4de97 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 27 Jul 2019 17:00:47 -0400 Subject: Shell script style pass --- bin/html.sh | 6 +++--- etc/tf/link.sh | 6 +++--- install.sh | 26 +++++++++++++------------- link.sh | 24 ++++++++++++------------ prune.sh | 8 ++++---- www/text.causal.agency/Makefile | 14 +++++++------- www/text.causal.agency/feed.sh | 39 ++++++++++++++++++++------------------- 7 files changed, 62 insertions(+), 61 deletions(-) mode change 100755 => 100644 www/text.causal.agency/feed.sh diff --git a/bin/html.sh b/bin/html.sh index cb7f1a66..924cb278 100644 --- a/bin/html.sh +++ b/bin/html.sh @@ -6,9 +6,9 @@ readonly GiteaURL='https://code.causal.agency/june/src/src/branch/master/bin' src=$1 man=${2:-} -./hi -f html -o document,tab=4 -n "${src}" /dev/null | sed '/
${src} in git
 EOF
-[ -f "${man}" ] && man -P cat "${PWD}/${man}" | ./ttpre
-./hi -f html -o anchor "${src}"
+[ -f "$man" ] && man -P cat "${PWD}/${man}" | ./ttpre
+./hi -f html -o anchor "$src"
diff --git a/etc/tf/link.sh b/etc/tf/link.sh
index 2c75d075..03bd25e5 100755
--- a/etc/tf/link.sh
+++ b/etc/tf/link.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
-set -e -u
+set -eu
 
-tf="$HOME/Library/Application Support/Steam/steamapps/common/Team Fortress 2/tf"
+tf="${HOME}/Library/Application Support/Steam/steamapps/common/Team Fortress 2/tf"
 for cfg in cfg/*.cfg; do
-	ln -s -f "$PWD/$cfg" "$tf/$cfg"
+	ln -fs "${PWD}/${cfg}" "${tf}/${cfg}"
 done
diff --git a/install.sh b/install.sh
index d970b363..2d34c373 100755
--- a/install.sh
+++ b/install.sh
@@ -15,25 +15,25 @@ Darwin() {
 	if [ ! -d /opt/pkg ]; then
 		tar="bootstrap-trunk-x86_64-${pkgsrcTag}.tar.gz"
 		url="https://pkgsrc.joyent.com/packages/Darwin/bootstrap/${tar}"
-		curl -O "${url}"
-		sudo tar -pxz -f "${tar}" -C /
-		rm "${tar}"
+		curl -O "$url"
+		sudo tar -pxz -f "$tar" -C /
+		rm "$tar"
 	fi
 	sudo pkgin update
-	sudo pkgin install ${pkgDarwin}
+	sudo pkgin install $pkgDarwin
 	sudo ln -fs /opt/pkg/bin/gpg2 /usr/local/bin/gpg
 	if [ ! -f /usr/local/bin/nvim ]; then
-		tar="nvim-macos.tar.gz"
-		base="https://github.com/neovim/neovim/releases/download"
+		tar='nvim-macos.tar.gz'
+		base='https://github.com/neovim/neovim/releases/download'
 		url="${base}/${neovimTag}/${tar}"
-		curl -L -O "${url}"
-		sudo tar -x -f "${tar}" -C /usr/local --strip-components 1
-		rm "${tar}"
+		curl -L -O "$url"
+		sudo tar -x -f "$tar" -C /usr/local --strip-components 1
+		rm "$tar"
 	fi
 }
 
 FreeBSD() {
-	pkg install ${pkgFreeBSD}
+	pkg install $pkgFreeBSD
 }
 
 NetBSD() {
@@ -41,15 +41,15 @@ NetBSD() {
 		base="ftp://ftp.NetBSD.org/pub/pkgsrc/packages"
 		export PKG_PATH="${base}/$(uname -s)/$(uname -p)/$(uname -r)/All"
 		pkg_add pkgin
-		echo "${PKG_PATH}" > /usr/pkg/etc/pkgin/repositories.conf
+		echo "$PKG_PATH" > /usr/pkg/etc/pkgin/repositories.conf
 	fi
 	pkgin update
-	pkgin install ${pkgNetBSD}
+	pkgin install $pkgNetBSD
 	ln -fs /usr/pkg/bin/gpg2 /usr/local/bin/gpg
 }
 
 Linux() {
-	pacman -Sy --needed ${pkgLinux}
+	pacman -Sy --needed $pkgLinux
 }
 
 $(uname)
diff --git a/link.sh b/link.sh
index 0f1f49aa..d74f4788 100755
--- a/link.sh
+++ b/link.sh
@@ -1,18 +1,18 @@
 #!/bin/sh
-set -e -u
+set -eu
 
 if [ $# -eq 1 ]; then
-	linkPath=$1
-	filePath="$PWD/home/${linkPath#$HOME/}"
-	[ ! -f "$filePath" ]
-	mkdir -p "$(dirname "$filePath")"
-	mv "$linkPath" "$filePath"
+	link=$1
+	file="${PWD}/home/${link#${HOME}/}"
+	[ ! -f "$file" ]
+	mkdir -p "${file%/*}"
+	mv "$link" "$file"
 fi
 
-find home -type f | while read -r findPath; do
-	filePath="$PWD/$findPath"
-	linkPath="$HOME/${findPath#home/}"
-	mkdir -p "$(dirname "$linkPath")"
-	[ \( -f "$linkPath" -a -L "$linkPath" \) -o ! -f "$linkPath" ]
-	ln -s -f "$filePath" "$linkPath"
+find home -type f | while read -r find; do
+	file="${PWD}/${find}"
+	link="${HOME}/${find#home/}"
+	mkdir -p "${link%/*}"
+	[ \( -f "$link" -a -L "$link" \) -o ! -f "$link" ]
+	ln -fs "$file" "$link"
 done
diff --git a/prune.sh b/prune.sh
index 31ab30cf..d41c6bc6 100755
--- a/prune.sh
+++ b/prune.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
-set -e -u
+set -eu
 
-find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do
-	rm "$linkPath"
-	echo "$linkPath"
+find -L ~ -type l -lname "${PWD}/*" | while read -r link; do
+	echo "$link"
+	rm "$link"
 done
diff --git a/www/text.causal.agency/Makefile b/www/text.causal.agency/Makefile
index 8f2a55a1..09076305 100644
--- a/www/text.causal.agency/Makefile
+++ b/www/text.causal.agency/Makefile
@@ -6,18 +6,18 @@ TXTS += 003-pleasant-c.txt
 TXTS += 004-uloc.txt
 TXTS += 005-testing-c.txt
 
-all: $(TXTS)
+all: ${TXTS}
 
 .SUFFIXES: .7 .txt
 
 .7.txt:
-	mandoc $< | col -b -x > $@
+	mandoc $< | col -bx > $@
 
-feed.atom: $(TXTS)
-	./feed.sh > feed.atom
+feed.atom: feed.sh ${TXTS}
+	sh feed.sh > feed.atom
 
 clean:
-	rm -f $(TXTS) feed.atom
+	rm -f ${TXTS} feed.atom
 
-install: $(TXTS) feed.atom
-	install -p -m 644 $(TXTS) feed.atom $(WEBROOT)
+install: ${TXTS} feed.atom
+	install -p -m 644 ${TXTS} feed.atom ${WEBROOT}
diff --git a/www/text.causal.agency/feed.sh b/www/text.causal.agency/feed.sh
old mode 100755
new mode 100644
index 3c6e6589..21b1d4a3
--- a/www/text.causal.agency/feed.sh
+++ b/www/text.causal.agency/feed.sh
@@ -1,29 +1,30 @@
 #!/bin/sh
-set -e -u
+set -eu
 
 updated=$(date -u '+%FT%TZ')
-cat <
-
-Causal Agency
-Junejune@causal.agency
-
-https://text.causal.agency/
-${updated}
+cat <<- EOF
+	
+	
+	Causal Agency
+	Junejune@causal.agency
+	
+	https://text.causal.agency/
+	${updated}
 EOF
 for entry in *.7; do
 	url="https://text.causal.agency/${entry%.7}.txt"
 	title=$(grep '^\.Nm' "$entry" | cut -c 5-)
 	summary=$(grep '^\.Nd' "$entry" | cut -c 5-)
-	updated=$(date -j -u -f '%s' "$(stat -f '%m' "$entry")" '+%FT%TZ')
-	cat <
-	${title}
-	${summary}
-	
-	${url}
-	${updated}
-	
-EOF
+	mtime=$(stat -f '%m' "$entry")
+	updated=$(date -ju -f '%s' "$mtime" '+%FT%TZ')
+	cat <<- EOF
+		
+		${title}
+		${summary}
+		
+		${url}
+		${updated}
+		
+	EOF
 done
 echo ''
-- 
cgit 1.4.1