From 21a2eee53ad514061b2c8d5d21ec69fec219784d Mon Sep 17 00:00:00 2001 From: B Stack Date: Wed, 11 Mar 2020 10:45:48 -0400 Subject: add initial debuild stuff move bash completion to recommended one from lint improve make deplist with SEPARATOR --- .gitignore | 5 ++++ debian/README.Debian | 5 ++++ debian/changelog | 5 ++++ debian/compat | 1 + debian/control | 17 +++++++++++++ debian/copyright | 29 ++++++++++++++++++++++ debian/do-not-install | 1 + debian/logout-manager.dsc | 14 +++++++++++ debian/logout-manager.install | 0 debian/logout-manager.lintian-overrides | 4 +++ debian/patches/series | 1 + debian/rules | 18 ++++++++++++++ debian/source/format | 1 + debian/source/lintian-overrides | 2 ++ debian/source/local-options | 2 ++ debian/watch | 2 ++ src/Makefile | 6 ++--- src/etc/bash_completion.d/logout-manager | 12 --------- src/usr/bin/logout-manager-cli.py | 2 +- .../bash-completion/completions/logout-manager | 12 +++++++++ src/usr/share/doc/logout-manager/README.md | 10 ++++---- 21 files changed, 128 insertions(+), 21 deletions(-) create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/do-not-install create mode 100644 debian/logout-manager.dsc create mode 100644 debian/logout-manager.install create mode 100644 debian/logout-manager.lintian-overrides create mode 100644 debian/patches/series create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 debian/source/local-options create mode 100644 debian/watch delete mode 100644 src/etc/bash_completion.d/logout-manager create mode 100644 src/usr/share/bash-completion/completions/logout-manager diff --git a/.gitignore b/.gitignore index 8707833..371e499 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ *.2019-* *.swp __pycache__ +*debhelper* +debian/logout-manager/ +debian/files +*.substvars +gitmessage diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..810fad6 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,5 @@ +logout-manager for Devuan + +No changes + + -- Ben Stack Wed, 11 Mar 2020 08:38:11 -0400 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b206280 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +logout-manager (0.0.1-1) obs; urgency=low + + * Initial release. + + -- Ben Stack Wed, 11 Mar 2020 08:38:11 -0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f7edf05 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: logout-manager +Section: x11 +Priority: optional +Maintainer: Ben Stack +Build-Depends: debhelper (>=12~) +Standards-Version: 4.1.4 +Homepage: https://bgstack15.wordpress.com/ + +Package: logout-manager +Architecture: all +Multi-Arch: foreign +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: provide simple menu for logout-type actions + Designed for minimal DEs and window managers that + lack a menu for logging out, this tool provides + such a menu. + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6b39eaf --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: logout-manager +Source: +# +# Please double check copyright with the licensecheck(1) command. + +Files: .gitignore + README.md + src/Makefile + src/etc/bash_completion.d/logout-manager + src/etc/logout-manager.conf + src/etc/sudoers.d/30_logout-manager_sudo + src/etc/sysconfig/logout-manager + src/usr/bin/logout-manager-cli.py + src/usr/bin/logout-manager-gtk.py + src/usr/bin/logout-manager-ncurses.py + src/usr/bin/logout-manager-tcl.py + src/usr/libexec/logout-manager/lm-helper + src/usr/share/applications/logout-manager.desktop + src/usr/share/doc/logout-manager/README.md + src/usr/share/doc/logout-manager/logout-manager.conf.example + src/usr/share/logout-manager/__pycache__/lmlib.cpython-37.pyc + src/usr/share/logout-manager/lmlib.py +Copyright: __NO_COPYRIGHT_NOR_LICENSE__ +License: __NO_COPYRIGHT_NOR_LICENSE__ + +#---------------------------------------------------------------------------- +# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following +# license/copyright files. diff --git a/debian/do-not-install b/debian/do-not-install new file mode 100644 index 0000000..e752d8b --- /dev/null +++ b/debian/do-not-install @@ -0,0 +1 @@ +usr/bin/logout-manager diff --git a/debian/logout-manager.dsc b/debian/logout-manager.dsc new file mode 100644 index 0000000..63ef881 --- /dev/null +++ b/debian/logout-manager.dsc @@ -0,0 +1,14 @@ +Format: 3.0 (quilt) +Source: logout-manager +Binary: logout-manager +Architecture: all +Version: 0.0.1-1 +Maintainer: Ben Stack +Homepage: https://bgstack15.wordpress.com/ +Standards-Version: 4.1.4 +Build-Depends: debhelper (>= 12~) +Package-List: + logout-manager deb x11 optional arch=all +Files: + 00000000000000000000000000000000 1 logout-manager.orig.tar.gz + 00000000000000000000000000000000 1 logout-manager.debian.tar.xz diff --git a/debian/logout-manager.install b/debian/logout-manager.install new file mode 100644 index 0000000..e69de29 diff --git a/debian/logout-manager.lintian-overrides b/debian/logout-manager.lintian-overrides new file mode 100644 index 0000000..01f15e1 --- /dev/null +++ b/debian/logout-manager.lintian-overrides @@ -0,0 +1,4 @@ +binary-without-manpage +copyright-has-url-from-dh_make-boilerplate +copyright-without-copyright-notice +script-with-language-extension diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4a97dfa --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +# You must remove unused comment lines for the released package. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..c1fee5d --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f +# You must remove unused comment lines for the released package. +#export DH_VERBOSE = 1 +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +APPNAME=logout-manager + +%: + dh $@ --sourcedirectory=src + +override_dh_auto_install: + dh_auto_install -- prefix=/usr DEFAULTDIR='$$(DESTDIR)/etc/default' + +override_dh_gencontrol: + printf "misc:Depends=" > debian/${APPNAME}.substvars + make -C src deplist DISTRO=devuan SEPARATOR=',' | grep -vE 'make\[[0-9]' >> debian/${APPNAME}.substvars + dh_gencontrol diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..2da37ed --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,2 @@ +file-without-copyright-information +missing-license-paragraph-in-dep5-copyright diff --git a/debian/source/local-options b/debian/source/local-options new file mode 100644 index 0000000..00131ee --- /dev/null +++ b/debian/source/local-options @@ -0,0 +1,2 @@ +#abort-on-upstream-changes +#unapply-patches diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..fc70498 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +# You must remove unused comment lines for the released package. +version=4 diff --git a/src/Makefile b/src/Makefile index fa385cb..1ef600d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -30,7 +30,7 @@ LIBEXECDIR = $(DESTDIR)$(prefix)/libexec DOCDIR = $(SHAREDIR)/doc/$(APPNAME) APPDIR = $(SHAREDIR)/$(APPNAME) APPSDIR = $(SHAREDIR)/applications -BASHCDIR = $(SYSCONFDIR)/bash_completion.d +BASHCDIR = $(SHAREDIR)/bash-completion/completions SUDOERSDIR = $(SYSCONFDIR)/sudoers.d awkbin :=$(shell which awk) @@ -57,7 +57,7 @@ list: deplist: @if test -z "$(DISTRO)" ; then ${echobin} "Please run \`make deplist\` with DISTRO= one of: `make deplist_opts 2>&1 1>/dev/null | ${xargsbin}`. Aborted." ; exit 1 ; fi - @${grepbin} -h --exclude='Makefile' --exclude-dir='doc' -A5 -riIE dependencies $(SRCDIR) | ${awkbin} -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | awk 'BEGIN{cmd="${xargsbin} -n1"} $$0 !~ /\(/{print $$0 | cmd ; close(cmd);} $$0 ~ /\(/{print;}' | ${sortbin} | ${uniqbin} | ${xargsbin} + @${grepbin} -h --exclude='Makefile' --exclude-dir='doc' -A5 -riIE dependencies $(SRCDIR) | ${awkbin} -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | awk 'BEGIN{cmd="${xargsbin} -n1"} $$0 !~ /\(/{print $$0 | cmd ; close(cmd);} $$0 ~ /\(/{print;}' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/$$/$(SEPARATOR)/' | ${xargsbin} deplist_opts: @${echobin} "el7" 1>&2 @@ -67,12 +67,12 @@ install: @${echobin} Installing files to ${DESTDIR} ${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} ${APPSDIR} ${APPDIR} ${DOCDIR} ${BASHCDIR} ${SUDOERSDIR} ${cpbin} -pr ${SRCDIR}/etc/*.* ${SYSCONFDIR} - ${cpbin} -pr ${SRCDIR}/etc/bash_completion.d/* ${BASHCDIR} ${cpbin} -pr ${SRCDIR}/etc/sysconfig/* ${DEFAULTDIR} ${cpbin} -pr ${SRCDIR}/usr/bin/* ${BINDIR} ${cpbin} -pr ${SRCDIR}/usr/share/applications/* ${APPSDIR} ${cpbin} -pr ${SRCDIR}/usr/share/${APPNAME}/*.* ${APPDIR} ${cpbin} -pr ${SRCDIR}/usr/share/doc/${APPNAME}/* ${DOCDIR} + ${installbin} -m 0644 -t ${BASHCDIR} ${SRCDIR}/usr/share/bash-completion/completions/* ${installbin} -m 0640 -t ${SUDOERSDIR} ${SRCDIR}/etc/sudoers.d/* # symlink, when alternatives is not being used ${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager diff --git a/src/etc/bash_completion.d/logout-manager b/src/etc/bash_completion.d/logout-manager deleted file mode 100644 index fd1267f..0000000 --- a/src/etc/bash_completion.d/logout-manager +++ /dev/null @@ -1,12 +0,0 @@ -# File: /etc/bash_completion.d/logout-manager -# Reference: -# bgscripts-core: /usr/bin/bp -# man complete - -_lm_helper() { - local cur prev words cword; - _init_completion || return - COMPREPLY=($( compgen -W "$( ~/dev/logout-manager/src/usr/libexec/logout-manager/lm-helper options )" -- "$cur" )) - return 0 -} && \ -complete -F _lm_helper -o bashdefault lm-helper diff --git a/src/usr/bin/logout-manager-cli.py b/src/usr/bin/logout-manager-cli.py index db754b6..64ea133 100755 --- a/src/usr/bin/logout-manager-cli.py +++ b/src/usr/bin/logout-manager-cli.py @@ -13,7 +13,7 @@ # https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string/12025554#12025554 # Improve: # Dependencies: -# Devuan: python3-dotenv +# Devuan: python3-dotenv python3 # Documentation: import os, platform, sys, argparse diff --git a/src/usr/share/bash-completion/completions/logout-manager b/src/usr/share/bash-completion/completions/logout-manager new file mode 100644 index 0000000..fd1267f --- /dev/null +++ b/src/usr/share/bash-completion/completions/logout-manager @@ -0,0 +1,12 @@ +# File: /etc/bash_completion.d/logout-manager +# Reference: +# bgscripts-core: /usr/bin/bp +# man complete + +_lm_helper() { + local cur prev words cword; + _init_completion || return + COMPREPLY=($( compgen -W "$( ~/dev/logout-manager/src/usr/libexec/logout-manager/lm-helper options )" -- "$cur" )) + return 0 +} && \ +complete -F _lm_helper -o bashdefault lm-helper diff --git a/src/usr/share/doc/logout-manager/README.md b/src/usr/share/doc/logout-manager/README.md index cfc3843..d34f02c 100644 --- a/src/usr/share/doc/logout-manager/README.md +++ b/src/usr/share/doc/logout-manager/README.md @@ -9,6 +9,7 @@ Logout Manager is a python3 utility that provides a simple menu for logout-type ## Customization The `lm-helper` logout command needs to be customized for every desktop environment. Some may need extra configurationon the window manager/desktop environment side. + ### Fluxbox For Fluxbox, you need to set a value in ~/.fluxbox/init @@ -29,12 +30,11 @@ This project is partially a programming playground for the [original author](htt ## Upsides * This project is the first to [demonstrate SVG images in tkinter in python3](https://bgstack15.wordpress.com/2019/07/13/display-svg-in-tkinter-python3/) that I could find on the Internet. +* This project demonstrates how to have the Makefile and debian/rules build a dependency list, from the Dependencies tags of the files themselves. * I have learned how to work with ncurses, gtk, and tcl in python3. * This will make Fluxbox systems easier to use for general users. +* Does not use dbus! ## Downsides -This whole thing is more complex than just logging out of my user session, and selecting a logout-type action from the display manager. - -## Improve -* add debian/ dir - * and dsc file +* This whole thing is more complex than just logging out of my user session, and selecting a logout-type action from the display manager. +* Depends on sudo instead of using native tools. -- cgit