summaryrefslogtreecommitdiffstats
path: root/system/rename.pl/rename.pl.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'system/rename.pl/rename.pl.SlackBuild')
-rw-r--r--system/rename.pl/rename.pl.SlackBuild46
1 files changed, 35 insertions, 11 deletions
diff --git a/system/rename.pl/rename.pl.SlackBuild b/system/rename.pl/rename.pl.SlackBuild
index d0c9e8e508..6888606c81 100644
--- a/system/rename.pl/rename.pl.SlackBuild
+++ b/system/rename.pl/rename.pl.SlackBuild
@@ -24,20 +24,28 @@
# added some new options that do look useful (-0, -d, -e, -E), but it
# doesn't look like a good tradeoff to me.
+# There's also a completely different rename.pl here:
+# https://github.com/kugland/rename.pl
+# ...which AUR ships at version 2.0.0, so repology keeps telling me
+# this is outdated. Wish there were a way to fix that.
+
# Since the name "rename" conflicts with util-linux, I've named this
# rename.pl, and gone to some trouble to make sure its documentation
# refers to rename.pl consistently (particularly the example commands,
# which wouldn't work if you copy/pasted them as-is).
-# This version of rename is from 2014. It's either "feature complete"
-# or "unmaintained", depending on whether you love or hate it.
+# This version of rename is still actively maintained, as of 20230226.
+
+# 20230905 bkw: updated for v1.14, tweak man page, add shell completions.
+# 20221228 bkw: updated for v1.12, fix PKGTYPE assignment.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=rename.pl
-VERSION=${VERSION:-1.9}
+VERSION=${VERSION:-1.14}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
SRCNAM=rename
@@ -66,16 +74,14 @@ chmod 755 . bin
# rename => rename.pl in embedded docs. Tricky because the word
# "rename" is also used as a normal verb and shouldn't be changed in
-# that case.
+# that case. Also fix typos in embedded docs, and clean up the
+# shell completion.
sed -i \
-e '/^rename - renames/s,rename,rename.pl,' \
-e '/^ *rename /s,rename,rename.pl,' \
+ -e 's,rename prompts,rename.pl prompts,g' \
-e 's,<rename>,<rename.pl>,g' \
-e '/make sure rename doesn.t/s,rename,B<rename.pl>,' \
- bin/$SRCNAM.PL
-
-# Fix typos in embedded docs:
-sed -i \
-e 's,Us it,Use it,' \
-e 's,mv prompts,<rename.pl> prompts,' \
-e 's,fo details,for details,' \
@@ -85,13 +91,19 @@ sed -i \
-e 's,<-no-stdin>,<--no-stdin>,' \
-e 's,I<rename\.pl>,B<rename.pl>,' \
-e 's, <rename\.pl>, B<rename.pl>,' \
+ -e 's,destionation,destination,' \
+ -e 's,_comp_rename,_comp_rename_pl,' \
+ -e '/comp/s,rename;,rename.pl;,' \
bin/$SRCNAM.PL
perl Makefile.PL
make
-# Generated man page still calls itself RENAME.
-sed -i '/^\./s,\<RENAME\>,&.PL,' blib/man1/$SRCNAM.1
+# Generated man page still calls itself RENAME. Also, fix the
+# version info.
+sed -i -e '/^\./s,\<RENAME\>,&.PL,' \
+ -e '/^\.TH/s,"perl v5[^"]*","rename.pl-'$VERSION'",' \
+ blib/man1/$SRCNAM.1
# This really is just a perl script and a man page. 'make install'
# creates lib(64) dirs and a perllocal.pod that we don't need.
@@ -99,6 +111,18 @@ mkdir -p $PKG/usr/bin $PKG/usr/man/man1
install -m0755 bin/$SRCNAM $PKG/usr/bin/$PRGNAM
gzip -9c < blib/man1/$SRCNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
+# 20230905 bkw: go ahead and include shell completions in the pkg.
+# Thanks to TommyC on libera IRC for assistance with the zsh stuff.
+ZSHDIR=$PKG/usr/share/zsh/site-functions
+BASHDIR=$PKG/usr/share/bash-completion/completions
+mkdir -p $ZSHDIR $BASHDIR
+
+echo "#compdef $PRGNAM" > $ZSHDIR/_$PRGNAM
+./bin/$SRCNAM --shell-completion=zsh >> $ZSHDIR/_$PRGNAM
+
+mkdir -p $PKG/usr/share/bash-completion/completions
+./bin/$SRCNAM --shell-completion=bash > $BASHDIR/$PRGNAM
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Changes README.md $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
@@ -107,4 +131,4 @@ mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE