aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--COPYING3
-rw-r--r--ChangeLog35
-rw-r--r--HACKING47
-rw-r--r--Makefile12
l---------README1
-rw-r--r--README.md33
-rw-r--r--README.org28
-rw-r--r--doc/pinentry-rofi.texi69
-rw-r--r--guix.scm87
-rw-r--r--hall.scm31
-rwxr-xr-xpinentry-rofi.scm48
-rw-r--r--scripts/pinentry-rofi.in63
-rwxr-xr-xtests/pinentry-rofi.scm (renamed from test.scm)15
13 files changed, 370 insertions, 102 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..f658e91
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,3 @@
+This project's license is GPL 3+.
+
+You can read the full license at https://www.gnu.org/licenses/gpl.html.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..8b7fa3a
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,35 @@
+2020-06-12 Fredrik Salomonsson <plattfot@gmail.com>
+ * 1.1.0:
+ Using Hall to handle the project.
+2020-05-11 Fredrik Salomonsson <plattfot@gmail.com>
+ * 1.0.2:
+ Fixed crash when rofi is aborted.
+2020-05-11 Fredrik Salomonsson <plattfot@gmail.com>
+ * 1.0.1:
+ Propper newline between error and description.
+ More unit test coverage.
+ Fixed hang when run via gpg, that was introduced in 1.0.0.
+2020-05-11 Fredrik Salomonsson <plattfot@gmail.com>
+ * 1.0.0:
+ Added unit tests.
+ Added support for popup.
+ Added support for underline characters in message.
+ Fixed high CPU usage bug - thanks to em0lar and n0emis.
+2020-04-21 Fredrik Salomonsson <plattfot@gmail.com>
+ * 0.5.0 :
+ Added support to ask again if password is wrong.
+2019-06-06 Fredrik Salomonsson <plattfot@gmail.com>
+ * 0.4.0 :
+ Removed compiling of script.
+ Behaves better with the REPL.
+2018-11-10 Fredrik Salomonsson <plattfot@gmail.com>
+ * 0.3.0 :
+ Removed dependency on systemd.
+ Works with gpg.
+ Removed conflict with pinentry-rofi.
+2018-11-04 Fredrik Salomonsson <plattfot@gmail.com>
+ * 0.2.0 :
+ Forcing the output.
+2018-11-04 Fredrik Salomonsson <plattfot@gmail.com>
+ * 0.1.0 :
+ Initial release. Matching functionality as the pinentry-rofi gist.
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..4af07cc
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,47 @@
+-*- mode: org; coding: utf-8; -*-
+
+#+TITLE: Hacking pinentry-rofi
+
+* Contributing
+
+By far the easiest way to hack on pinentry-rofi is to develop using Guix:
+
+#+BEGIN_SRC bash
+ # Obtain the source code
+ cd /path/to/source-code
+ guix environment -l guix.scm
+ # In the new shell, run:
+ hall dist --execute && autoreconf -vif && ./configure && make check
+#+END_SRC
+
+You can now hack this project's files to your heart's content, whilst
+testing them from your `guix environment' shell.
+
+To try out any scripts in the project you can now use
+
+#+BEGIN_SRC bash
+ ./pre-inst-env scripts/${script-name}
+#+END_SRC
+
+If you'd like to tidy the project again, but retain the ability to test the
+project from the commandline, simply run:
+
+#+BEGIN_SRC bash
+ ./hall clean --skip "scripts/${script-name},pre-inst-env" --execute
+#+END_SRC
+
+** Manual Installation
+
+If you do not yet use Guix, you will have to install this project's
+dependencies manually:
+ - autoconf
+ - automake
+ - pkg-config
+ - texinfo
+ - guile-hall
+
+Once those dependencies are installed you can run:
+
+#+BEGIN_SRC bash
+ hall dist -x && autoreconf -vif && ./configure && make check
+#+END_SRC
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 18d9f8a..0000000
--- a/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-
-PREFIX ?=
-PREFIX_BIN ?= $(PREFIX)/usr/bin
-
-.PHONY: install
-install:
- @install -DT pinentry-rofi.scm $(PREFIX_BIN)/pinentry-rofi-guile
-
-.PHONY: test
-test:
- @./test.scm
-
diff --git a/README b/README
new file mode 120000
index 0000000..314e17d
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.org \ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index cedc669..0000000
--- a/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# Description
-Based on [this gist](https://gist.github.com/sardemff7/759cbf956bea20d382a6128c641d2746)
-
-Simple pinentry gui using rofi written in GNU guile.
-
-It's similar in functionality as the gist but this one doesn't force
-the width to be 27 and doesn't depend on systemd.
-
-I also wanted a small project which I could use to practice writing
-GNU guile.
-
-# Install
-## From source
-
-```bash
-$ git clone https://github.com/plattfot/pinentry-rofi.git
-$ cd pinentry-rofi
-$ make PREFIX=<install dir>
-```
-
-Where <install dir> is where you want to install it. By default it
-will install the script in /usr/bin and the compiled source to where
-the site cache for guile is configured to.
-
-## Arch Linux
-Clone my aur reop and the build the package using the PKGBUILD:
-
-```bash
-$ git clone https://github.com/plattfot/pinentry-rofi-aur.git
-$ cd pinentry-rofi-aur
-$ makepkg -ic
-```
diff --git a/README.org b/README.org
new file mode 100644
index 0000000..9a4e12d
--- /dev/null
+++ b/README.org
@@ -0,0 +1,28 @@
+-*- mode: org; coding: utf-8; -*-
+
+#+TITLE: README for Pinentry-Rofi
+
+* Description
+ Based on [[https://gist.github.com/sardemff7/759cbf956bea20d382a6128c641d2746][this gist]]
+
+ Simple pinentry gui using rofi written in GNU guile.
+
+ It's similar in functionality as the gist but this one doesn't force
+ the width to be 27 and doesn't depend on systemd.
+
+ I also wanted a small project which I could use to practice writing
+ GNU guile.
+
+* Install
+** From Source
+
+ See [[file:HACKING][HACKING]] on how to build this from source
+
+** Arch Linux
+ Clone my aur reop and the build the package using the PKGBUILD:
+
+ #+begin_src bash
+ git clone https://github.com/plattfot/pinentry-rofi-aur.git
+ cd pinentry-rofi-aur
+ makepkg -ic
+ #+end_src
diff --git a/doc/pinentry-rofi.texi b/doc/pinentry-rofi.texi
new file mode 100644
index 0000000..288de38
--- /dev/null
+++ b/doc/pinentry-rofi.texi
@@ -0,0 +1,69 @@
+
+\input texinfo
+@c -*-texinfo-*-
+
+@c %**start of header
+@setfilename pinentry-rofi.info
+@documentencoding UTF-8
+@settitle Pinentry-Rofi Reference Manual
+@c %**end of header
+
+@include version.texi
+
+@copying
+Copyright @copyright{} 2020 Fredrik Salomonsson
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
+copy of the license is included in the section entitled ``GNU Free
+Documentation License''.
+@end copying
+
+@dircategory The Algorithmic Language Scheme
+@direntry
+* Pinentry-Rofi: (pinentry-rofi).
+@end direntry
+
+@titlepage
+@title The Pinentry-Rofi Manual
+@author Fredrik Salomonsson
+
+@page
+@vskip 0pt plus 1filll
+Edition @value{EDITION} @*
+@value{UPDATED} @*
+
+@insertcopying
+@end titlepage
+
+@contents
+
+@c *********************************************************************
+@node Top
+@top Pinentry-Rofi
+
+This document describes Pinentry-Rofi version @value{VERSION}.
+
+@menu
+* Introduction:: Why Pinentry-Rofi?
+@end menu
+
+@c *********************************************************************
+@node Introduction
+@chapter Introduction
+
+Based on
+@url{https://gist.github.com/sardemff7/759cbf956bea20d382a6128c641d2746,this
+gist}
+
+Simple pinentry gui using @command{rofi} written in GNU guile.
+
+It's similar in functionality as the gist but this one doesn't force
+the width to be 27 and doesn't depend on systemd.
+
+I also wanted a small project which I could use to practice writing
+GNU guile.
+
+@bye
diff --git a/guix.scm b/guix.scm
new file mode 100644
index 0000000..744eede
--- /dev/null
+++ b/guix.scm
@@ -0,0 +1,87 @@
+(use-modules
+ (guix packages)
+ ((guix licenses) #:prefix license:)
+ (guix download)
+ (guix build-system gnu)
+ (gnu packages)
+ (gnu packages autotools)
+ (gnu packages guile)
+ (gnu packages guile-xyz)
+ (gnu packages pkg-config)
+ (gnu packages texinfo))
+
+(package
+ (name "pinentry-rofi")
+ (version "1.1.0")
+ (source "./pinentry-rofi-1.1.0.tar.gz")
+ (build-system gnu-build-system)
+ (arguments
+ `(#:modules
+ ((ice-9 match)
+ (ice-9 ftw)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (modify-phases
+ %standard-phases
+ (add-after
+ 'install
+ 'hall-wrap-binaries
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((compiled-dir
+ (lambda (out version)
+ (string-append
+ out
+ "/lib/guile/"
+ version
+ "/site-ccache")))
+ (uncompiled-dir
+ (lambda (out version)
+ (string-append
+ out
+ "/share/guile/site"
+ (if (string-null? version) "" "/")
+ version)))
+ (dep-path
+ (lambda (env modules path)
+ (list env
+ ":"
+ 'prefix
+ (cons modules
+ (map (lambda (input)
+ (string-append
+ (assoc-ref inputs input)
+ path))
+ ,''())))))
+ (out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin/"))
+ (site (uncompiled-dir out "")))
+ (match (scandir site)
+ (("." ".." version)
+ (for-each
+ (lambda (file)
+ (wrap-program
+ (string-append bin file)
+ (dep-path
+ "GUILE_LOAD_PATH"
+ (uncompiled-dir out version)
+ (uncompiled-dir "" version))
+ (dep-path
+ "GUILE_LOAD_COMPILED_PATH"
+ (compiled-dir out version)
+ (compiled-dir "" version))))
+ ,''("pinentry-rofi"))
+ #t))))))))
+ (native-inputs
+ `(("autoconf" ,autoconf)
+ ("automake" ,automake)
+ ("pkg-config" ,pkg-config)
+ ("texinfo" ,texinfo)))
+ (inputs `(("guile" ,guile-3.0)))
+ (propagated-inputs `())
+ (synopsis "Rofi frontend to pinentry")
+ (description
+ "Simple pinentry gui using rofi, it is written in GNU guile.")
+ (home-page
+ "https://github.com/plattfot/pinentry-rofi/")
+ (license license:gpl3+))
+
diff --git a/hall.scm b/hall.scm
new file mode 100644
index 0000000..e721f40
--- /dev/null
+++ b/hall.scm
@@ -0,0 +1,31 @@
+(hall-description
+ (name "pinentry-rofi")
+ (prefix "")
+ (version "1.1.0")
+ (author "Fredrik Salomonsson")
+ (copyright (2020))
+ (synopsis "Rofi frontend to pinentry")
+ (description
+ "Simple pinentry gui using rofi, it is written in GNU guile.")
+ (home-page
+ "https://github.com/plattfot/pinentry-rofi/")
+ (license gpl3+)
+ (dependencies `())
+ (files (libraries
+ ((scheme-file "pinentry-rofi")
+ (directory "pinentry-rofi" ())))
+ (tests ((directory
+ "tests"
+ ((scheme-file "pinentry-rofi")))))
+ (programs
+ ((directory "scripts" ((in-file "pinentry-rofi")))))
+ (documentation
+ ((org-file "README")
+ (symlink "README" "README.org")
+ (text-file "HACKING")
+ (text-file "COPYING")
+ (directory "doc" ((texi-file "pinentry-rofi")))
+ (text-file "ChangeLog")
+ (text-file "ChangeLog")))
+ (infrastructure
+ ((scheme-file "guix") (scheme-file "hall")))))
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm
index d016e04..410d76a 100755
--- a/pinentry-rofi.scm
+++ b/pinentry-rofi.scm
@@ -1,7 +1,3 @@
-#! /usr/bin/guile \
---no-auto-compile -e (pinentry-rofi) -s
-!#
-
;; Copyright © 2016 Quentin "Sardem FF7" Glidic
;; Copyright © 2018-2020 Fredrik "PlaTFooT" Salomonsson
;;
@@ -30,10 +26,7 @@
#:use-module (srfi srfi-9) ;; For records
#:use-module (ice-9 format)
#:use-module (ice-9 regex)
- #:use-module (ice-9 getopt-long)
- #:export (main
- pinentry-rofi-guile-version
- make-pinentry
+ #:export (make-pinentry
pinentry?
pinentry-ok set-pinentry-ok!
pinentry-prompt set-pinentry-prompt!
@@ -76,9 +69,6 @@
pinentry-bye
pinentry-loop))
-
-(define pinentry-rofi-guile-version "1.0.1")
-
(when (equal? (system-file-name-convention) 'windows)
(format #t "Only support posix systems!")
(exit #f))
@@ -442,39 +432,3 @@ Return the input from the user if succeeded else #f."
(format #t "OK\n")
(force-output))
(pinentry-loop pinentry input-port))))
-
-(define (main args)
- (let* ((option-spec
- '((display (single-char #\d) (value #t))
- (xauthority (single-char #\a) (value #t))
- (version (single-char #\v) (value #f))
- (log (value #t))
- (help (single-char #\h) (value #f))))
- (default-display ":0")
- (options (getopt-long (command-line) option-spec))
- (pinentry (make-pinentry #t "Passphrase:" "Ok" "Cancel"
- (option-ref options 'display default-display)
- (let ((logfile (option-ref options 'log #f)))
- (when logfile
- (open-output-file
- (format #f "~a.~a" logfile (getpid))))))))
- (when (option-ref options 'help #f)
- (format #t "\
-Usage: ~a [OPTIONS]
-Options:
- -d, --display DISPLAY Set display, default is ~s.
- --log LOGFILE Log unknown commands to LOGFILE
- -v, --version Display version.
- -h, --help Display this help.
-Author:
-Fredrik \"PlaTFooT\" Salomonsson
-"
- (car (command-line))
- default-display)
- (exit #t))
- (when (option-ref options 'version #f)
- (format #t "pinentry-rofi-guile version ~a\n" pinentry-rofi-guile-version)
- (exit #t))
- (format #t "OK Please go ahead\n")
- (force-output)
- (pinentry-loop pinentry (current-input-port))))
diff --git a/scripts/pinentry-rofi.in b/scripts/pinentry-rofi.in
new file mode 100644
index 0000000..377fbf7
--- /dev/null
+++ b/scripts/pinentry-rofi.in
@@ -0,0 +1,63 @@
+#! /usr/bin/guile \
+--no-auto-compile -e main -s
+!#
+;; bin/pinentry-rofi --- pinentry-rofi cli -*- coding: utf-8 -*-
+;; Copyright © 2016 Quentin "Sardem FF7" Glidic
+;; Copyright © 2018-2020 Fredrik "PlaTFooT" Salomonsson
+;;
+;; Permission is hereby granted, free of charge, to any person obtaining a copy
+;; of this software and associated documentation files (the "Software"), to deal
+;; in the Software without restriction, including without limitation the rights
+;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+;; copies of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+;;
+;; The above copyright notice and this permission notice shall be included in
+;; all copies or substantial portions of the Software.
+;;
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+;; THE SOFTWARE.
+
+(use-modules (ice-9 getopt-long)
+ (ice-9 format)
+ (pinentry-rofi pinentry-rofi))
+(define (main args)
+ (let* ((option-spec
+ '((display (single-char #\d) (value #t))
+ (xauthority (single-char #\a) (value #t))
+ (version (single-char #\v) (value #f))
+ (log (value #t))
+ (help (single-char #\h) (value #f))))
+ (default-display ":0")
+ (options (getopt-long (command-line) option-spec))
+ (pinentry (make-pinentry #t "Passphrase:" "Ok" "Cancel"
+ (option-ref options 'display default-display)
+ (let ((logfile (option-ref options 'log #f)))
+ (when logfile
+ (open-output-file
+ (format #f "~a.~a" logfile (getpid))))))))
+ (when (option-ref options 'help #f)
+ (format #t "\
+Usage: ~a [OPTIONS]
+Options:
+ -d, --display DISPLAY Set display, default is ~s.
+ --log LOGFILE Log unknown commands to LOGFILE
+ -v, --version Display version.
+ -h, --help Display this help.
+Author:
+@AUTHOR@
+"
+ (car (command-line))
+ default-display)
+ (exit #t))
+ (when (option-ref options 'version #f)
+ (format #t "@HVERSION@\n")
+ (exit #t))
+ (format #t "OK Please go ahead\n")
+ (force-output)
+ (pinentry-loop pinentry (current-input-port))))
diff --git a/test.scm b/tests/pinentry-rofi.scm
index e7051b3..928fcce 100755
--- a/test.scm
+++ b/tests/pinentry-rofi.scm
@@ -1,7 +1,3 @@
-#!/usr/bin/guile \
---no-auto-compile -l pinentry-rofi.scm -s
-!#
-
;; Copyright © 2020 Fredrik "PlaTFooT" Salomonsson
;;
;; Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,14 +18,13 @@
;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
;; THE SOFTWARE.
-
-(use-modules (srfi srfi-64)
- (ice-9 popen)
- (ice-9 textual-ports)
- (pinentry-rofi))
+(define-module (tests-pinentry-rofi)
+ #:use-module (srfi srfi-64)
+ #:use-module (ice-9 popen)
+ #:use-module (ice-9 textual-ports)
+ #:use-module (pinentry-rofi))
(test-begin "pinentry-rofi")
-(test-assert (string? pinentry-rofi-guile-version))
(test-begin "pinentry")
(let ((pinentry (make-pinentry #t "Prompt" "Ok" "Cancel" ":1" "test.log")))