Compare commits
No commits in common. "31f67370ed0a02d873be9f73b98e7a36932662ac" and "d5faffd04ce7010bad0457d901a5fbc2dc83d254" have entirely different histories.
31f67370ed
...
d5faffd04c
63
global.funcs.zsh
Normal file
63
global.funcs.zsh
Normal file
@ -0,0 +1,63 @@
|
||||
typeset -g globaldots_path="${HOME}/.global"
|
||||
if [[ -a $(realpath -m $(dirname $0)/../../.globaldir ) ]]
|
||||
then
|
||||
typeset -g globaldots_path=$(realpath -m $(dirname $0)/../../)
|
||||
fi
|
||||
|
||||
if [[ -n ${GLOBALDOTS_PATH} ]]
|
||||
then
|
||||
typeset -g globaldots_path=${GLOBALDOTS_PATH}
|
||||
fi
|
||||
|
||||
if [[ -z $globaldots_path ]]; then
|
||||
echo 'functions require $globaldots_path to be set!'
|
||||
fi
|
||||
|
||||
# ZCONFIG
|
||||
|
||||
## stuff for global dotfiles
|
||||
|
||||
function global_path_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_path_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
||||
|
||||
function global_fpath_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_fpath_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
||||
|
||||
function global_set_useropts()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
||||
|
||||
function global_configure()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
||||
|
||||
function global_config_setup()
|
||||
{
|
||||
zshlibs_log global "expanding path with '$path_extra'"
|
||||
global_path_expand $path_extra
|
||||
zshlibs_log global "expanding fpath with '$fpath_extra'"
|
||||
global_fpath_expand vanilla
|
||||
zshlibs_log global "done loading noninteractive config"
|
||||
}
|
||||
|
||||
function global_boot()
|
||||
{
|
||||
global_configure
|
||||
global_config_setup
|
||||
}
|
||||
|
||||
## normal functions
|
||||
|
||||
|
18
global.zsh
18
global.zsh
@ -1,18 +0,0 @@
|
||||
typeset -g globaldots_path="${HOME}/.global"
|
||||
if [[ -a $(realpath -m $(dirname $0)/../../.globaldir ) ]]
|
||||
then
|
||||
typeset -g globaldots_path=$(realpath -m $(dirname $0)/../../)
|
||||
fi
|
||||
|
||||
if [[ -n ${GLOBALDOTS_PATH} ]]
|
||||
then
|
||||
typeset -g globaldots_path=${GLOBALDOTS_PATH}
|
||||
fi
|
||||
|
||||
if [[ -z $globaldots_path ]]; then
|
||||
echo 'functions require $globaldots_path to be set!'
|
||||
fi
|
||||
|
||||
autoload global_path_expand global_fpath_expand global_set_useropts \
|
||||
global_configure global_config_setup global_boot
|
||||
fpath+=(${zshlibs_install}/global)
|
@ -1,5 +0,0 @@
|
||||
function global_boot()
|
||||
{
|
||||
global_configure
|
||||
global_config_setup
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
function global_config_setup()
|
||||
{
|
||||
zshlibs_log global "expanding path with '$path_extra'"
|
||||
global_path_expand $path_extra
|
||||
zshlibs_log global "expanding fpath with '$fpath_extra'"
|
||||
global_fpath_expand vanilla
|
||||
zshlibs_log global "done loading noninteractive config"
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
function global_configure()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
function global_fpath_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_fpath_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
function global_path_expand()
|
||||
{
|
||||
local bin_base=${globaldots_path}/bin
|
||||
for pathnew in ${*}; do
|
||||
zshlibs_path_add "${bin_base}/${pathnew}"
|
||||
done;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
function global_set_useropts()
|
||||
{
|
||||
typeset -a -g path_extra
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
autoload zshlibs_boot zshlibs_log zshlibs_ensure zshlibs_fpath_add \
|
||||
zshlibs_path_add zshlibs_start zshlibs_update
|
||||
function zbootstrap()
|
||||
{
|
||||
autoload zshlibs_boot zshlibs_log zshlibs_ensure zshlibs_fpath_add \
|
||||
zshlibs_path_add zshlibs_start zshlibs_update
|
||||
zshlibs_start
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ else
|
||||
zshlibs_update
|
||||
fi
|
||||
|
||||
|
||||
source ${zshlibs_install}/tools.zsh
|
||||
source ${zshlibs_install}/zconfig.zsh
|
||||
source ${zshlibs_install}/global.zsh
|
||||
source ${zshlibs_install}/zconfig.funcs.zsh
|
||||
source ${zshlibs_install}/global.funcs.zsh
|
||||
source ${zshlibs_install}/zssh.zsh
|
||||
|
82
zconfig.funcs.zsh
Normal file
82
zconfig.funcs.zsh
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
function zconfig_checkload()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
if [[ ! ${zconfig_loaded[(r)${1}]} ]]
|
||||
then
|
||||
zshlibs_log zconfig "sourcing config '$1'"
|
||||
. -- $1 2>&1 >(zshlibs_log zconfig)
|
||||
zconfig_loaded+=("$1")
|
||||
zshlibs_log zconfig "end sourcing config '$1'"
|
||||
else
|
||||
zshlibs_log zconfig "config '$1' already loaded"
|
||||
zshlibs_log zconfig "currently loaded configs: ${zconfig_loaded}"
|
||||
fi
|
||||
}
|
||||
|
||||
function zconfigs_load()
|
||||
{
|
||||
zshlibs_log zconfig "loading supplied config names"
|
||||
for configfile in ${*}; do
|
||||
zconfig_checkload $configfile
|
||||
done
|
||||
}
|
||||
|
||||
function zconfigs_local_load()
|
||||
{
|
||||
if [[ ! -a ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "local config missing, recreating from '${zconfig_shared_path}/zshconfig.example'"
|
||||
mkdir -p -m 700 "${zconfig_local_path}"
|
||||
cp ${zconfig_shared_path}/zshconfig.example ${zconfig_local_path}/local.config.zsh
|
||||
fi
|
||||
if [[ ! -d ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "local config appears to be a file, loading '${zconfig_local_path}'"
|
||||
zconfig_checkload ${zconfig_local_path}
|
||||
else
|
||||
zshlibs_log zconfig "local config is a directory, loading '${zconfig_local_path}/*.config.zsh'"
|
||||
zconfigs_load ${zconfig_local_path}/*.config.zsh;
|
||||
fi
|
||||
}
|
||||
|
||||
# zconfig bootup
|
||||
|
||||
function zconfig_boot()
|
||||
{
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
zconfig_setup_interactive
|
||||
}
|
||||
|
||||
function zconfig_configure()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
typeset -a -g config_extra # user populatable config names in zshlibs location
|
||||
typeset -g zconfig_shared_path="${zshlibs_install}/config"
|
||||
typeset -g zconfig_local_path="${HOME}/.config/zsh"
|
||||
}
|
||||
|
||||
function zbootstrap_noninteractive()
|
||||
{
|
||||
zshlibs_log zconfig "WARNING: legacy function called"
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
}
|
||||
|
||||
function zconfig_setup()
|
||||
{
|
||||
zshlibs_log zconfig 'load global config'
|
||||
zconfig_checkload ${zconfig_shared_path}/global.config.zsh
|
||||
zshlibs_log zconfig 'load local configs'
|
||||
zconfigs_local_load
|
||||
for zconfig in $config_extra; do
|
||||
zshlibs_log zconfig 'load config extra $zconfig'
|
||||
zconfig_checkload ${zconfig_shared_path}/${zconfig}.config.zsh
|
||||
done
|
||||
}
|
||||
|
||||
function zconfig_setup_interactive()
|
||||
{
|
||||
zshlibs_log zconfig "loading interactive config"
|
||||
zconfig_checkload ${zconfig_shared_path}/global.style.zsh
|
||||
zshlibs_log zconfig "done loading interactive config"
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
fpath+=(${zshlibs_install}/zconfig)
|
||||
autoload zconfig_boot zconfig_checkload zconfig_configure \
|
||||
zconfig_setup zconfig_setup_interactive zconfigs_load \
|
||||
zconfigs_local_load
|
@ -1,6 +0,0 @@
|
||||
function zconfig_boot()
|
||||
{
|
||||
zconfig_configure
|
||||
zconfig_setup
|
||||
zconfig_setup_interactive
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
function zconfig_checkload()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
if [[ ! ${zconfig_loaded[(r)${1}]} ]]
|
||||
then
|
||||
zshlibs_log zconfig "sourcing config '$1'"
|
||||
. -- $1 2>&1 >(zshlibs_log zconfig)
|
||||
zconfig_loaded+=("$1")
|
||||
zshlibs_log zconfig "end sourcing config '$1'"
|
||||
else
|
||||
zshlibs_log zconfig "config '$1' already loaded"
|
||||
zshlibs_log zconfig "currently loaded configs: ${zconfig_loaded}"
|
||||
fi
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
function zconfig_configure()
|
||||
{
|
||||
typeset -a -g zconfig_loaded
|
||||
typeset -a -g config_extra # user populatable config names in zshlibs location
|
||||
typeset -g zconfig_shared_path="${zshlibs_install}/config"
|
||||
typeset -g zconfig_local_path="${HOME}/.config/zsh"
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
function zconfig_setup()
|
||||
{
|
||||
zshlibs_log zconfig 'load global config'
|
||||
zconfig_checkload ${zconfig_shared_path}/global.config.zsh
|
||||
zshlibs_log zconfig 'load local configs'
|
||||
zconfigs_local_load
|
||||
for zconfig in $config_extra; do
|
||||
zshlibs_log zconfig 'load config extra $zconfig'
|
||||
zconfig_checkload ${zconfig_shared_path}/${zconfig}.config.zsh
|
||||
done
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
function zconfig_setup_interactive()
|
||||
{
|
||||
zshlibs_log zconfig "loading interactive config"
|
||||
zconfig_checkload ${zconfig_shared_path}/global.style.zsh
|
||||
zshlibs_log zconfig "done loading interactive config"
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
function zconfigs_load()
|
||||
{
|
||||
zshlibs_log zconfig "loading supplied config names"
|
||||
for configfile in ${*}; do
|
||||
zconfig_checkload $configfile
|
||||
done
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
function zconfigs_local_load()
|
||||
{
|
||||
if [[ ! -a ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "local config missing, recreating from '${zconfig_shared_path}/zshconfig.example'"
|
||||
mkdir -p -m 700 "${zconfig_local_path}"
|
||||
cp ${zconfig_shared_path}/zshconfig.example ${zconfig_local_path}/local.config.zsh
|
||||
fi
|
||||
if [[ ! -d ${zconfig_local_path} ]]; then
|
||||
zshlibs_log zconfig "local config appears to be a file, loading '${zconfig_local_path}'"
|
||||
zconfig_checkload ${zconfig_local_path}
|
||||
else
|
||||
zshlibs_log zconfig "local config is a directory, loading '${zconfig_local_path}/*.config.zsh'"
|
||||
zconfigs_load ${zconfig_local_path}/*.config.zsh;
|
||||
fi
|
||||
}
|
5
zssh.zsh
5
zssh.zsh
@ -1,6 +1,3 @@
|
||||
fpath+=(${zshlibs_install}/zssh/)
|
||||
autoload zssh_configure zssh_process zssh_check_pubkeys zssh_enumeratenodes \
|
||||
zssh_generate_config4 zssh_generate_hostaccessconfig zssh_generate_privkey4 \
|
||||
zssh_host_info zssh_install_peers zssh_mail_pubkey2 zssh_node_info \
|
||||
zssh_publish_configs zssh_publish_pubkeys zssh_boot
|
||||
autoload zssh_boot
|
||||
|
||||
|
@ -7,6 +7,10 @@ function zssh_boot()
|
||||
typeset -g zssh_private_configs="${zssh_ssh_dotdir}/config.d"
|
||||
typeset -g zssh_global_configs=${globaldots_path}/config/ssh
|
||||
typeset -g zssh_global_pubkeys=${globaldots_path}/keys/ssh
|
||||
autoload zssh_configure zssh_process zssh_check_pubkeys zssh_enumeratenodes \
|
||||
zssh_generate_config4 zssh_generate_hostaccessconfig zssh_generate_privkey4 \
|
||||
zssh_host_info zssh_install_peers zssh_mail_pubkey2 zssh_node_info \
|
||||
zssh_publish_configs zssh_publish_pubkeys
|
||||
zssh_configure
|
||||
zssh_process
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user