From 293813b0209cdcdff47bdff81dc5f11a4a6b4e39 Mon Sep 17 00:00:00 2001 From: B. Watson Date: Mon, 7 Aug 2023 02:30:18 -0400 Subject: misc/grc: Updated for version 1.13, new maintainer, support csh. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- misc/grc/README | 49 ++++++++++++++++++++++++++----- misc/grc/doinst.sh | 20 +++++++++---- misc/grc/grc.SlackBuild | 78 ++++++++++++++++++++----------------------------- misc/grc/grc.csh | 48 ++++++++++++++++++++++++++++++ misc/grc/grc.info | 10 +++---- 5 files changed, 139 insertions(+), 66 deletions(-) create mode 100644 misc/grc/grc.csh (limited to 'misc') diff --git a/misc/grc/README b/misc/grc/README index 08d4689320..c95ff92d76 100644 --- a/misc/grc/README +++ b/misc/grc/README @@ -1,13 +1,46 @@ grc (generic colouriser) -grc provides two programs: grc and grcat. The main is grcat, which -acts as a filter, i.e. taking standard input, colourising it and -writing to standard output. grcat takes as a parameter the name of +grc provides two programs: grc and grcat. The main one is grcat, +which acts as a filter, i.e. taking standard input, colourising it +and writing to standard output. grcat takes as a parameter the name of configuration file. -NOTE: to use, add following lines into your ~/.bashrc, ~/.zshrc or in -~/.config/fish/config.fish: +One major use of grc is to colorize the output of commonly-used shell +commands. For this to work, grc has to set up the environment of your +shell when it starts up. How you do this depends on which shell you +use. -[[ -s "/etc/profile.d/grc.bashrc" ]] && source /etc/profile.d/grc.bashrc -[[ -s "/etc/profile.d/grc.zsh" ]] && source /etc/profile.d/grc.zsh -[[ -s "/etc/profile.d/grc.fish" ]] && source /etc/profile.d/grc.fish +bash, ksh, other POSIX-like shells +---------------------------------- +To enable this globally for all users: + + chmod +x /etc/profile.d/grc.sh + +Or, you can enable it for just your user by adding this line to one of +your shell startup scripts (.profile, .bashrc, .kshrc, etc): + + [ -e /etc/profile.d/grc.sh ] && . /etc/profile.d/grc.sh + +csh, tcsh +--------- +To enable this globally for all users: + + chmod +x /etc/profile.d/grc.csh + +Or, for one user, add to your .cshrc: + + if ( -e /etc/profile.d/grc.csh ) then + source /etc/profile.d/grc.csh + endif + +zsh +--- +Add this line to your ~/.zshrc: + + [ -e /etc/grc.zsh ] && source /etc/grc.zsh + +fish +---- +Add this line to your ~/.config/fish/config.fish: + + [ -e /etc/grc.fish ] && source /etc/grc.fish diff --git a/misc/grc/doinst.sh b/misc/grc/doinst.sh index 7be6ad2127..b50214f79e 100644 --- a/misc/grc/doinst.sh +++ b/misc/grc/doinst.sh @@ -1,17 +1,25 @@ config() { NEW="$1" OLD="$(dirname $NEW)/$(basename $NEW .new)" - # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then - # toss the redundant copy rm $NEW fi - # Otherwise, we leave the .new copy for the admin to consider... } +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/profile.d/grc.csh.new +preserve_perms etc/profile.d/grc.sh.new config etc/grc.conf.new -config etc/profile.d/grc.bashrc.new -config etc/profile.d/grc.zsh.new -config etc/profile.d/grc.fish.new +config etc/default/grc.new diff --git a/misc/grc/grc.SlackBuild b/misc/grc/grc.SlackBuild index a30fd30a99..dd048f8482 100644 --- a/misc/grc/grc.SlackBuild +++ b/misc/grc/grc.SlackBuild @@ -3,7 +3,8 @@ # Slackware build script for grc. # # Copyright 2015-2018 Edinaldo P. Silva, Rio de Janeiro, Brazil. -# Copyright 2020 Ricardo J. Barberis +# Copyright 2020 Ricardo J. Barberis +# Copyright 2023 B. Watson # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -23,25 +24,23 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20230806 bkw: +# - take over maintenance. +# - ARCH=noarch since it's just python. +# - update for v1.13. +# - expand README, fix the fish command so it actually works. +# - add profile script for (t)csh. +# - preserve_perms for profile.d scripts in doinst.sh. + cd $(dirname $0) ; CWD=$(pwd) PRGNAM="grc" -VERSION=${VERSION:-1.11.3} +VERSION=${VERSION:-1.13} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} +ARCH=noarch -if [ -z "$ARCH" ]; then - case "$( uname -m )" in - i?86) ARCH=i586 ;; - arm*) ARCH=arm ;; - *) ARCH=$( uname -m ) ;; - esac -fi - -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -51,20 +50,6 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i586" ]; then - SLKCFLAGS="-O2 -march=i586 -mtune=i686" - LIBDIRSUFFIX="" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686 -mtune=i686" - LIBDIRSUFFIX="" -elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" - LIBDIRSUFFIX="64" -else - SLKCFLAGS="-O2" - LIBDIRSUFFIX="" -fi - set -e rm -rf $PKG @@ -74,33 +59,32 @@ rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM-$VERSION chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + -./install.sh $PKG/usr $PKG +# Hardcoded man path sucks... +sed -i 's,/share/man,/man,' install.sh -mv $PKG/etc/grc.conf $PKG/etc/grc.conf.new - -# for Bash, Fish and Zsh. -mv $PKG/etc/profile.d/grc.bashrc $PKG/etc/profile.d/grc.bashrc.new -install -m644 grc.zsh $PKG/etc/profile.d/grc.zsh.new -install -m644 grc.fish $PKG/etc/profile.d/grc.fish.new +./install.sh $PKG/usr $PKG +gzip -9 $PKG/usr/man/man*/* install -Dm644 _grc $PKG/usr/share/zsh/site-functions/_grc -mv $PKG/usr/share/man $PKG/usr/man -find $PKG/usr/man -type f -exec gzip -9 {} \; -for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +mv $PKG/etc/grc.conf $PKG/etc/grc.conf.new +mv $PKG/etc/profile.d/grc.sh $PKG/etc/profile.d/grc.sh.new + +# Might as well include this, so enabling for bourne-like shells +# will be a one-step process (chmod +x /etc/profile.d/grc.sh). +mkdir -p $PKG/etc/default +echo "GRC_ALIASES=true" > $PKG/etc/default/grc.new -DOCS="contrib debian/changelog debian/copyright CREDITS INSTALL \ -README.markdown Regexp.txt TODO" +# 20230806 bkw: (t)csh support. For shiggles. +install -m0644 -oroot -groot $CWD/grc.csh $PKG/etc/profile.d/grc.csh.new -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -r $DOCS $PKG/usr/doc/$PRGNAM-$VERSION/ -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKGDOC +cp -r contrib debian/{changelog,copyright} CREDITS README* *.txt TODO $PKGDOC +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/misc/grc/grc.csh b/misc/grc/grc.csh new file mode 100644 index 0000000000..b0a83b3c55 --- /dev/null +++ b/misc/grc/grc.csh @@ -0,0 +1,48 @@ +# aliases for grc(1) + +tty -s +if ( $status == 0 && "$TERM" != "" && "$TERM" != "dumb" ) then + alias colourify "grc -es" + alias blkid 'colourify blkid' + alias configure 'colourify ./configure' + alias df 'colourify df' + alias diff 'colourify diff' + alias docker 'colourify docker' + alias docker-compose 'colourify docker-compose' + alias docker-machine 'colourify docker-machine' + alias du 'colourify du' +# alias env 'colourify env' + alias free 'colourify free' + alias fdisk 'colourify fdisk' + alias findmnt 'colourify findmnt' + alias make 'colourify make' + alias gcc 'colourify gcc' + alias g++ 'colourify g++' + alias id 'colourify id' + alias ip 'colourify ip' + alias iptables 'colourify iptables' + alias as 'colourify as' + alias gas 'colourify gas' + alias journalctl 'colourify journalctl' + alias kubectl 'colourify kubectl' + alias ld 'colourify ld' + #alias ls 'colourify ls' + alias lsof 'colourify lsof' + alias lsblk 'colourify lsblk' + alias lspci 'colourify lspci' + alias netstat 'colourify netstat' + alias ping 'colourify ping' + alias ss 'colourify ss' + alias traceroute 'colourify traceroute' + alias traceroute6 'colourify traceroute6' + alias head 'colourify head' + alias tail 'colourify tail' + alias dig 'colourify dig' + alias mount 'colourify mount' + alias ps 'colourify ps' + alias mtr 'colourify mtr' + alias semanage 'colourify semanage' + alias getsebool 'colourify getsebool' + alias ifconfig 'colourify ifconfig' + alias sockstat 'colourify sockstat' +endif diff --git a/misc/grc/grc.info b/misc/grc/grc.info index dec1ab4f81..7ba09e0e50 100644 --- a/misc/grc/grc.info +++ b/misc/grc/grc.info @@ -1,10 +1,10 @@ PRGNAM="grc" -VERSION="1.11.3" +VERSION="1.13" HOMEPAGE="https://github.com/garabik/grc" -DOWNLOAD="https://github.com/garabik/grc/archive/v1.11.3/grc-1.11.3.tar.gz" -MD5SUM="17f9a0b014c771b9e4cd060113309073" +DOWNLOAD="https://github.com/garabik/grc/archive/v1.13/grc-1.13.tar.gz" +MD5SUM="9800a42aa081dd64dbaaf928bb5796fe" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Ricardo J. Barberis" -EMAIL="ricardo.barberis@gmail.com" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" -- cgit v1.2.3