From 378502256e28b6f70ae2d5172c0591639a94a413 Mon Sep 17 00:00:00 2001 From: "koizumi.aoi" Date: Sat, 26 Nov 2022 14:15:17 +0000 Subject: [PATCH] Update configuration format, add switch to install(1) in mkfile Signed-off-by: Aoi K git-svn-id: file:///srv/svn/repo/kanako/trunk@14 62e5d677-aa6e-8c4a-b8cb-b9416171cb8e --- kanako | 30 +++++++++++++++--------------- kanako.conf.example | 30 +++++++++++++++--------------- kanako.conf.mdoc | 16 +++++++++++----- kanako.mdoc | 33 +++++++++++++++++++++++++++++++-- mkfile | 8 ++++---- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/kanako b/kanako index 290e71d..6940bf8 100755 --- a/kanako +++ b/kanako @@ -1,4 +1,5 @@ -#!/bin/sh -e +#!/bin/sh +# $KyokoNet: kanako,v 1.7 2022/11/26 08:44:11 akoizumi Exp $ readonly kanako_conf_dir="${kanako_conf_dir:-$HOME/.config/kanako}" readonly kanako_key_dir="${kanako_key_dir:-$HOME/.kanako}" @@ -22,16 +23,16 @@ else fi fn_copy() { - fn_view $1 | "${clip_cmd}" + fn_view $1 | "${kanako_clip_cmd}" } fn_edit() { - ${encrypt_cmd} ${decrypt_args} ${1%%.enc}.enc > ${1%%.enc} + ${kanako_encrypt_cmd} ${kanako_decrypt_args} ${1%%.enc}.enc > ${1%%.enc} "${EDITOR}" "${1%%.enc}" - ${encrypt_cmd} ${encrypt_args} ${1%%.enc} > ${1%%.enc}.enc + ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${1%%.enc} > ${1%%.enc}.enc rm "${1%%.enc}" } fn_list() { - "${list_cmd}" "${store_dir}" + "${kanako_list_cmd}" "${kanako_store_dir}/" } fn_new() { test -d $1 && fn_usage && exit 1 @@ -40,26 +41,25 @@ fn_new() { "${EDITOR}" "${tmpfile}" mkdir -p "$(dirname "$1")" - ${encrypt_cmd} ${encrypt_args} ${tmpfile} > ${1%%.enc}.enc + ${kanako_encrypt_cmd} ${kanako_encrypt_args} ${tmpfile} > ${1%%.enc}.enc rm ${tmpfile} } fn_trash_directory() { - rm -rf $@ + rm -rf "$@" } -fn_trash_entry() { +fn_trash_file() { rm -f "${1}${2}".enc } fn_usage() { - cat < -EOF + printf "Usage: %s [-c|-e|-h|-l|-n|-R|-r|-v [file or directory]]\n" "$0" + printf "The arguments for all switches except for '-h' are relative to\n" + printf "\t\$kanako_store_dir which is set to %s\n\n" "{$kanako_store_dir}" } fn_view() { if [ -f "${1%%.enc}".enc ]; then - ${encrypt_cmd} ${decrypt_args} "${1%%.enc}".enc + ${kanako_encrypt_cmd} ${kanako_decrypt_args} "${1%%.enc}".enc elif [ -d "${1:-.}" ]; then - ${list_cmd} "${1:-.}" + ${kanako_list_cmd} "${1:-.}" else fn_usage fi @@ -70,8 +70,8 @@ case $1 in -e) fn_edit $2 ;; -l) fn_list ;; -n) fn_new $2 ;; - -r) fn_trash_entry $2 ;; -R) fn_trash_directory $2 ;; + -r) fn_trash_file $2 ;; -v) fn_view $2 ;; *) fn_usage ;; esac diff --git a/kanako.conf.example b/kanako.conf.example index a65f7fe..75e8897 100644 --- a/kanako.conf.example +++ b/kanako.conf.example @@ -1,25 +1,25 @@ # Configuration file for kanako(1) -#clip="xclip -i" -#clip="wl-copy --primary" -#list_cmd="tree" +#kanako_clip_cmd="xclip -i" +#kanako_clip_cmd="wl-copy --primary" +#kanako_list_cmd="tree" ## age -#encrypt_cmd="age" -#encrypt_args="-e -R ${key_dir}/pub.age --armor" -#decrypt_args="-d -i ${key_dir}/priv.age" +#kanako_encrypt_cmd="age" +#kanako_encrypt_args="-e -R ${kanako_key_dir}/pub.key --armor" +#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.key" ## cream -#encrypt_cmd="cream" -#encrypt_args="-e -f" -#decrypt_args="-d" +#kanako_encrypt_cmd="cream" +#kanako_encrypt_args="-e -f" +#kanako_decrypt_args="-d" ## gpg -#encrypt_cmd="gpg" -#encrypt_args="-e --recipient ${key_dir}/pub.gpg" -#decrypt_args="-d" +#kanako_encrypt_cmd="gpg" +#kanako_encrypt_args="-e --recipient ${kanako_key_dir}/pub.key" +#kanako_decrypt_args="-d" ## salty -#encrypt_cmd="salty" -#encrypt_args="-e -r $(cat ${key_dir}/pub.slt)" -#decrypt_args="-d -i ${key_dir}/priv.slt" +#kanako_encrypt_cmd="salty" +#kanako_encrypt_args="-e -r $(cat ${kanako_key_dir}/pub.slt)" +#kanako_decrypt_args="-d -i ${kanako_key_dir}/priv.slt" \ No newline at end of file diff --git a/kanako.conf.mdoc b/kanako.conf.mdoc index 071b538..08ef9d4 100644 --- a/kanako.conf.mdoc +++ b/kanako.conf.mdoc @@ -1,4 +1,4 @@ -.Dd Bureaucracy 65, 3188 +.Dd Bureaucracy 73, 3188 .Dt KANAKO.CONF 5 .Os .Sh NAME @@ -9,11 +9,17 @@ .Ss General section .Bl -tag -width 11n -compact .It clip_cmd -Clipboard executable to use with -the program. +Clipboard manager command +.It debug +Controls whether to use debug +mode or not. Any value other +than false is interpreted as +true. .It list_cmd -Listing executable to use -with the program. +Command used to print a listing +of the password store +.It menu_cmd +Menu command for kanako_menu .El .Ss Encryption section .Bl -tag -width 11n -compact diff --git a/kanako.mdoc b/kanako.mdoc index 97f1946..0c052a5 100644 --- a/kanako.mdoc +++ b/kanako.mdoc @@ -1,11 +1,39 @@ -.Dd Bureaucracy 72, 3188 +.Dd Bureaucracy 73, 3188 .Dt KANAKO 1 .Os .Sh NAME .Nm kanako .Nd the adaptable password manager +.Sh SYNOPSIS +.Nm +.Fl c +.Ar args +.Nm +.Fl e +.Ar args +.Nm +.Fl l +.Nm +.Fl n +.Ar args +.Nm +.Fl r +.Ar args +.Nm +.Fl R +.Ar args +.Nm +.Fl v +.Ar args .Sh DESCRIPTION - +It is a clean rewrite of +.Xr ayu 1 +supporting multiple backends +and having more add-ons for +use with it. However, it +may be pretty unstable compared +to said tool, but should work +well for its purpose. .Sh USAGE .Bl -tag -width 11n -compact .It -n @@ -26,6 +54,7 @@ View an entry .El .Sh SEE ALSO .Xr age 1 +.Xr cream 1 .Xr gpg 1 .Xr kanako.conf 5 .Xr pwgen 1 diff --git a/mkfile b/mkfile index f3484f7..165cf04 100644 --- a/mkfile +++ b/mkfile @@ -4,12 +4,12 @@ install:V: install-bin install-examples install-man uninstall:V: uninstall-bin uninstall-examples uninstall-man install-bin: - install -m$EXEC_MODE kanako $PREFIX/bin/kanako + install -Dm$EXEC_MODE kanako $PREFIX/bin/kanako install-examples: - install -m$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf + install -Dm$FILE_MODE kanako.conf.example $PREFIX/share/examples/kanako/kanako.conf install-man: - install -m$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1 - install -m$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5 + install -Dm$FILE_MODE kanako.mdoc $PREFIX/share/man/man1/kanako.1 + install -Dm$FILE_MODE kanako.conf.mdoc $PREFIX/share/man/man5/kanako.conf.5 uninstall-bin: rm -f $PREFIX/bin/kanako uninstall-examples: