changeset 11:416a0219249d

misc: make dmenutools installable
author David Demelier <markand@malikania.fr>
date Wed, 08 Nov 2017 06:39:02 +0100
parents 34563a7481c2
children f004b506c789
files INSTALL.md LICENSE.md Makefile README.md dmenu_bg dmenu_filesel dmenu_power dmenu_ssh
diffstat 8 files changed, 87 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL.md	Wed Nov 08 06:39:02 2017 +0100
@@ -0,0 +1,21 @@
+dmenutools INSTALL
+==================
+
+Installation instructions.
+
+Requirements
+------------
+
+  - POSIX compatible shell.
+
+Basic installation
+------------------
+
+You can use all scripts directly or you can install it using `make install`. By
+default it will be installed to **/usr/local/bin**, this can be changed using
+PREFIX variable.
+
+Examples:
+
+	make install			# install to /usr/local/bin
+	make install PREFIX=/	# install to /bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.md	Wed Nov 08 06:39:02 2017 +0100
@@ -0,0 +1,16 @@
+dmenutools ISC LICENSE
+======================
+
+Copyright (c) 2017 David Demelier <markand@malikania.fr>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Nov 08 06:39:02 2017 +0100
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2017 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+PREFIX=/usr/local
+
+install:
+	install -D -m 0755 dmenu_bg ${PREFIX}/bin
+	install -D -m 0755 dmenu_filesel ${PREFIX}/bin
+	install -D -m 0755 dmenu_power ${PREFIX}/bin
+	install -D -m 0755 dmenu_ssh ${PREFIX}/bin
+	install -D -m 0644 dmenu.subr ${PREFIX}/libexec/dmenutools/dmenu.subr
--- a/README.md	Tue Nov 07 12:29:28 2017 +0100
+++ b/README.md	Wed Nov 08 06:39:02 2017 +0100
@@ -1,5 +1,5 @@
 dmenutools
-=====================================================================
+==========
 
 Some scripts using [dmenu][].
 
--- a/dmenu_bg	Tue Nov 07 12:29:28 2017 +0100
+++ b/dmenu_bg	Wed Nov 08 06:39:02 2017 +0100
@@ -17,17 +17,19 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
+TOOL="bg"
+TOP=$(dirname "$(readlink -f "$0")")
+
 dmt_bg_usage()
 {
     echo "usage: dmenu_bg [directory]" 1>&2;
     exit 1
 }
 
-if [ -r dmenu.subr ]; then
-    . ./dmenu.subr
-fi
-if [ -r /usr/local/libexec/dmenutools/dmenu.subr ]; then
-    . /usr/local/libexec/dmenutools/dmenu.subr
+if [ -r ${TOP}/dmenu.subr ]; then
+    . ${TOP}/dmenu.subr
+elif [ -r ${TOP}/../libexec/dmenutools/dmenu.subr ]; then
+    . ${TOP}/../libexec/dmenutools/dmenu.subr
 fi
 
 # Check for an optional directory.
@@ -56,7 +58,7 @@
 # Optional lines.
 lines=${bg_lines:-16}
 
-file=$(./dmenu_filesel -l ${lines} ${directory})
+file=$(${TOP}/dmenu_filesel -l ${lines} ${directory})
 
 if [ -n "${file}" ]; then
     ${bg_cmd} ${file}
--- a/dmenu_filesel	Tue Nov 07 12:29:28 2017 +0100
+++ b/dmenu_filesel	Wed Nov 08 06:39:02 2017 +0100
@@ -17,6 +17,9 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
+TOOL="filesel"
+TOP=$(dirname "$(readlink -f "$0")")
+
 dmt_filesel_usage()
 {
     echo "usage: dmenu_filesel [-t file|directory]" 1>&2;
--- a/dmenu_power	Tue Nov 07 12:29:28 2017 +0100
+++ b/dmenu_power	Wed Nov 08 06:39:02 2017 +0100
@@ -17,11 +17,13 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
-if [ -r dmenu.subr ]; then
-    . ./dmenu.subr
-fi
-if [ -r /usr/local/libexec/dmenutools/dmenu.subr ]; then
-    . /usr/local/libexec/dmenutools/dmenu.subr
+TOOL="power"
+TOP=$(dirname "$(readlink -f "$0")")
+
+if [ -r ${TOP}/dmenu.subr ]; then
+    . ${TOP}/dmenu.subr
+elif [ -r ${TOP}/../libexec/dmenutools/dmenu.subr ]; then
+    . ${TOP}/../libexec/dmenutools/dmenu.subr
 fi
 
 # Default user values.
--- a/dmenu_ssh	Tue Nov 07 12:29:28 2017 +0100
+++ b/dmenu_ssh	Wed Nov 08 06:39:02 2017 +0100
@@ -17,11 +17,13 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #
 
-if [ -r dmenu.subr ]; then
-    . ./dmenu.subr
-fi
-if [ -r /usr/local/libexec/dmenutools/dmenu.subr ]; then
-    . /usr/local/libexec/dmenutools/dmenu.subr
+TOOL="ssh"
+TOP=$(dirname "$(readlink -f "$0")")
+
+if [ -r ${TOP}/dmenu.subr ]; then
+    . ${TOP}/dmenu.subr
+elif [ -r ${TOP}/../libexec/dmenutools/dmenu.subr ]; then
+    . ${TOP}/../libexec/dmenutools/dmenu.subr
 fi
 
 # Default user values.