From d6532488f89a963a6ce73edd8b282f0ae4b93613 Mon Sep 17 00:00:00 2001 From: Mike Small Date: Tue, 16 Jun 2020 10:31:12 -0400 Subject: [PATCH 1/4] sudo (or doas) should be outside Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e141e82..5e1d08e 100644 --- a/Makefile +++ b/Makefile @@ -3,5 +3,5 @@ check: perlcritic frfac install: - sudo install -o root -g wheel -m 0755 -d /usr/local/bin - sudo install -o root -g wheel -m 0555 frfac /usr/local/bin + install -o root -g wheel -m 0755 -d /usr/local/bin + install -o root -g wheel -m 0555 frfac /usr/local/bin From d3447ded0c6eb2ee7283dbeb9f8927234a79d9a6 Mon Sep 17 00:00:00 2001 From: Mike Small Date: Tue, 16 Jun 2020 10:49:09 -0400 Subject: [PATCH 2/4] Stop hardcoding perl path. --- frfac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frfac b/frfac index f070826..6c51f09 100755 --- a/frfac +++ b/frfac @@ -1,4 +1,4 @@ -#!/usr/pkg/bin/perl +#!/usr/bin/env perl # Print the URI of the most recent rfi francais facile episode. # Feed this to a downloader. (This script doesn't itself download.) From 04d4063eaf4611f648fec2ef1bb200f7cbf8fabf Mon Sep 17 00:00:00 2001 From: Mike Small Date: Sun, 21 Jun 2020 11:45:18 -0400 Subject: [PATCH 3/4] Provide me a way to run in Slackware 14.2 This is probably a silly way to deal with uniq not being in the older List::Util vs. providing an implementation. But 15 is just around the corner anyway? Also add an uninstall target. --- Makefile | 8 ++++++++ frfac.wrapper | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 frfac.wrapper diff --git a/Makefile b/Makefile index 5e1d08e..4c0006f 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,11 @@ check: install: install -o root -g wheel -m 0755 -d /usr/local/bin install -o root -g wheel -m 0555 frfac /usr/local/bin + +install_with_newcore_hack: + install -o root -g wheel -m 0755 -d /usr/local/bin + install -o root -g wheel -m 0555 frfac /usr/local/share/perl5/ + install -o root -g wheel -m 0555 frfac.wrapper /usr/local/bin/frfac + +uninstall: + rm -f /usr/local/bin/frfac /usr/local/share/perl5/frfac diff --git a/frfac.wrapper b/frfac.wrapper new file mode 100644 index 0000000..9e72736 --- /dev/null +++ b/frfac.wrapper @@ -0,0 +1,13 @@ +#!/bin/sh + +# Use a newer List::Util than that in core of the +# system Perl. E.g. Slackware 14.2's perl is +# 5.22.2 and only has version 1.41 of List::Util. +# That version lacks the uniq function. +# The directory /usr/local/share/newperlcore is +# expected to have a new List::Util under it +# install via... +# perl Makefile.PL INSTALL_BASE=/usr/local/share/newperlcore + +perl -I /usr/local/share/newperlcore /usr/local/share/perl5/frfac + From 69348dc2d4ed81a7d8dd68382c0606c6281b60b7 Mon Sep 17 00:00:00 2001 From: Mike Small Date: Fri, 3 Jul 2020 11:45:52 -0400 Subject: [PATCH 4/4] Handle Slackware 14.2 in a cleaner way via pkgsrc Didn't like the hack I was using to work around an old perl before. So when I noticed that using pkgsrc in Slackware pretty soon puts down a recent perl as a dependency to many things I decided that using that would be better than overlaying a newer List::Util version on perl 5.22. This change detects the newest perl on the system at install time and puts that in the script interpreter line. It removes the wrapper that included a library tree with new versions of core Perl modules. --- Makefile | 19 ++++++++++--------- frfac => frfac.in | 2 +- frfac.wrapper | 13 ------------- latest_perl | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 23 deletions(-) rename frfac => frfac.in (98%) delete mode 100644 frfac.wrapper create mode 100755 latest_perl diff --git a/Makefile b/Makefile index 4c0006f..70e6992 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,16 @@ -check: - perl -wc frfac - perlcritic frfac +frfac: + sed "1d;2i #!`./latest_perl`" frfac.in > frfac -install: +check: + `./latest_perl` -wc frfac.in + perlcritic frfac.in + +install: frfac install -o root -g wheel -m 0755 -d /usr/local/bin install -o root -g wheel -m 0555 frfac /usr/local/bin -install_with_newcore_hack: - install -o root -g wheel -m 0755 -d /usr/local/bin - install -o root -g wheel -m 0555 frfac /usr/local/share/perl5/ - install -o root -g wheel -m 0555 frfac.wrapper /usr/local/bin/frfac +clean: + rm -f frfac uninstall: - rm -f /usr/local/bin/frfac /usr/local/share/perl5/frfac + rm -f /usr/local/bin/frfac diff --git a/frfac b/frfac.in similarity index 98% rename from frfac rename to frfac.in index 6c51f09..3080f03 100755 --- a/frfac +++ b/frfac.in @@ -1,4 +1,4 @@ -#!/usr/bin/env perl +#!/usr/bin/perl # Print the URI of the most recent rfi francais facile episode. # Feed this to a downloader. (This script doesn't itself download.) diff --git a/frfac.wrapper b/frfac.wrapper deleted file mode 100644 index 9e72736..0000000 --- a/frfac.wrapper +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Use a newer List::Util than that in core of the -# system Perl. E.g. Slackware 14.2's perl is -# 5.22.2 and only has version 1.41 of List::Util. -# That version lacks the uniq function. -# The directory /usr/local/share/newperlcore is -# expected to have a new List::Util under it -# install via... -# perl Makefile.PL INSTALL_BASE=/usr/local/share/newperlcore - -perl -I /usr/local/share/newperlcore /usr/local/share/perl5/frfac - diff --git a/latest_perl b/latest_perl new file mode 100755 index 0000000..3dff960 --- /dev/null +++ b/latest_perl @@ -0,0 +1,15 @@ +#!/bin/sh +bestv=0 +for p in $(whereis perl) +do + if [ "$p" != "${p%bin/perl}" ]; + then + v=$($p -V:PERL_VERSION | sed "s/[^']*'//;s/'.*\$//") + if [ $v -gt $bestv ]; then + best=$p + bestv=$($p -V:PERL_VERSION | + sed "s/[^']*'//;s/'.*\$//") + fi + fi +done +echo $best