Use install to create directories for modules

This commit is contained in:
Rezart Qelibari
2022-04-19 05:43:22 +02:00
parent 203cef9bf6
commit a6b1759302
4 changed files with 12 additions and 9 deletions

View File

@@ -96,10 +96,7 @@ function configure_system() {
local xpcConsumerPath="${dstDir}/astzweig-xpc-consumer"
local remapKeysPath="${dstDir}/remap-keys"
local launchDaemonPath="/Library/LaunchDaemons/${serviceName}.plist"
[[ -d ${dstDir} ]] || {
lop -- -e "Could not install remap-keys. Directory ${dstDir} does not exist."
return 10
}
ensurePathOrLogError ${dstDir} 'Could not install remap-keys.' || return 10
[[ -x ${remapKeysPath} ]] || indicateActivity createRemapKeysBinary 'Create remap-keys executable'
[[ -x ${xpcConsumerPath} ]] || createXPCConsumer 'Create XPC event consuer'
[[ -f ${launchDaemonPath} ]] || createLaunchDaemon 'Create Launch Daemon'

View File

@@ -9,10 +9,7 @@ function ensureRightAccess() {
function configure_system() {
local dstDir='/usr/local/bin'
[[ -d ${dstDir} ]] || {
lop -- -e "Could not install binaries. Directory ${dstDir} does not exist."
return 10
}
ensurePathOrLogError ${dstDir} 'Could not install binaries.' || return 10
pushd -q ${_DIR}/../bin
for file in *; do
indicateActivity cp,${file},${dstDir} "Copying ${file}"
@@ -24,6 +21,7 @@ function configure_system() {
function getExecPrerequisites() {
cmds=(
[cp]=''
[install]=''
)
}

View File

@@ -27,6 +27,14 @@ function getModuleAnswerByKeyRegEx() {
return 1
}
function ensurePathOrLogError() {
local dir=$1 msg=$2
[[ -d ${dir} ]] || install -m $(umask -S) -d $(getMissingPaths ${dir}) || {
lop -- -e "$msg" -e "Directory ${dir} does not exist and could not be created."
return 10
}
}
function checkCommands() {
local cmd
for cmd in ${(k)cmds}; do

2
zshlib

Submodule zshlib updated: dabb512461...a20db501bd