0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-10-17 10:06:53 +02:00

build: templatize autocomplete and pam-config

This commit is contained in:
Sayafdine Said 2023-09-12 22:37:53 +02:00
parent 5133d05141
commit 29f218d9dc
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4
6 changed files with 39 additions and 9 deletions

View file

@ -4,6 +4,8 @@
_howdy() {
local cur prev opts
local config_path="@config_path@"
source _variables
COMPREPLY=()
# The argument typed so far
cur="${COMP_WORDS[COMP_CWORD]}"
@ -20,7 +22,7 @@ _howdy() {
;;
# For disable, grab the current "disabled" config option and give the reverse
"disable")
local status=$(cut -d'=' -f2 <<< $(cat /etc/howdy/config.ini | grep 'disabled =') | xargs echo -n)
local status=$(cut -d'=' -f2 <<< $(cat $config_path | grep 'disabled =') | xargs echo -n)
[ "$status" == "false" ] && COMPREPLY="true" || COMPREPLY="false"
return 0

View file

@ -53,6 +53,21 @@ pam_module_conf_data = configuration_data(paths_dict)
pam_module_conf_data.set('compare_script_path', join_paths(pysourcesinstalldir, 'compare.py'))
pam_module_conf_data.set('config_file_path', config_path)
subdir('pam')
if get_option('install_pam_config')
# pamdir is inherited from the pam subproject
pam_config = configure_file(
input: 'pam-config/howdy.in',
output: 'pam-config',
configuration: {'pamdir': pamdir}
)
install_data(
pam_config,
install_dir: get_option('prefix') / get_option('datadir') / 'pam-configs',
install_mode: 'rwxr-xr-x',
install_tag: 'pam',
rename: 'howdy',
)
endif
if get_option('install_in_site_packages')
py.install_sources(
@ -73,6 +88,18 @@ else
endif
install_data('logo.png', install_tag: 'meta')
autocomplete = configure_file(
input: 'autocomplete/howdy.in',
output: 'autocomplete',
configuration: configuration_data({ 'config_path': config_path })
)
install_data(
autocomplete,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'bash-completion', 'completions'),
install_mode: 'rwxr--r--',
install_tag: 'bash_completion',
rename: 'howdy',
)
fs = import('fs')
if not fs.exists(config_path)

View file

@ -1,6 +0,0 @@
Name: Howdy
Default: yes
Priority: 512
Auth-Type: Primary
Auth:
[success=end default=ignore] /lib/security/howdy/pam_howdy.so

View file

@ -0,0 +1,6 @@
Name: Howdy
Default: yes
Priority: 512
Auth-Type: Primary
Auth:
[success=end default=ignore] @pamdir@/pam_howdy.so

View file

@ -1,7 +1,7 @@
project('howdy', 'cpp', license: 'MIT', version: 'beta', meson_version: '>= 0.64.0')
dlibdatadir = get_option('dlib_data_dir') != '' ? get_option('dlib_data_dir') : join_paths(get_option('prefix'), get_option('datadir'), 'dlib-data')
confdir = get_option('config_dir') != '' ? get_option('config_dir') : join_paths(get_option('prefix'), get_option('sysconfdir'), 'howdy')
dlibdatadir = get_option('dlib_data_dir') != '' ? get_option('dlib_data_dir') : join_paths(confdir, 'dlib-data')
usermodelsdir = get_option('user_models_dir') != '' ? get_option('user_models_dir') : join_paths(confdir, 'models')
logpath = get_option('log_path')

View file

@ -5,4 +5,5 @@ option('dlib_data_dir', type: 'string', value: '', description: 'Set the dlib da
option('user_models_dir', type: 'string', value: '', description: 'Set the user models directory')
option('log_path', type: 'string', value: '/var/log/howdy', description: 'Set the log file path')
option('install_in_site_packages', type: 'boolean', value: false, description: 'Install howdy python files in site packages')
option('py_sources_dir', type: 'string', value: '', description: 'Set the python sources directory')
option('py_sources_dir', type: 'string', value: '', description: 'Set the python sources directory')
option('install_pam_config', type: 'boolean', value: false, description: 'Install pam config file (for Debian/Ubuntu)')