aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Verbovetsky <alik@ejik.org>2017-08-14 12:13:35 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-08-19 07:10:38 +0700
commitea837431d1ff3abbb7d7821ab033c86fd2c9c175 (patch)
treea8f0c132a34535cbd4cbbab2aa345f94d8a0cd90
parent62a5b29b269a95fb5f01a2183f7168bcf124674a (diff)
system/nvme-cli: Fixed bash completion script.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
-rw-r--r--system/nvme-cli/doinst.sh14
-rw-r--r--system/nvme-cli/nvme-cli.SlackBuild10
2 files changed, 22 insertions, 2 deletions
diff --git a/system/nvme-cli/doinst.sh b/system/nvme-cli/doinst.sh
new file mode 100644
index 0000000000000..b5a41d1d89880
--- /dev/null
+++ b/system/nvme-cli/doinst.sh
@@ -0,0 +1,14 @@
+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...
+}
+
+config etc/bash_completion.d/nvme.new
diff --git a/system/nvme-cli/nvme-cli.SlackBuild b/system/nvme-cli/nvme-cli.SlackBuild
index 515b3665abb33..1b7de2c2c6b4a 100644
--- a/system/nvme-cli/nvme-cli.SlackBuild
+++ b/system/nvme-cli/nvme-cli.SlackBuild
@@ -71,18 +71,24 @@ make install DESTDIR=$PKG PREFIX=/usr SBINDIR=/usr/sbin
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+mkdir -p $PKG/etc/bash_completion.d
+mv $PKG/usr/share/bash_completion.d/nvme $PKG/etc/bash_completion.d/nvme.new
+rmdir $PKG/usr/share/bash_completion.d/
+
mv $PKG/usr/share/man $PKG/usr/
rmdir --ignore-fail-on-non-empty $PKG/usr/share/
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
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a CONTRIBUTING.md README.md LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/completions
+cp -a CONTRIBUTING.md README.md LICENSE scripts $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a completions/{README,_nvme} $PKG/usr/doc/$PRGNAM-$VERSION/completions
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}