HOKAY; XDG_* refactor

This commit is contained in:
Wryn (yage) Wagner 2024-08-16 09:41:26 -06:00
parent 7b70567a67
commit 9301a32090
Signed by: wrynegade
SSH Key Fingerprint: SHA256:zBGO05Uz1oT7pnehoPelgUmYX632oFjt3MBH0MlEvrs
31 changed files with 358 additions and 138 deletions

5
bin/pikachu/default Executable file
View File

@ -0,0 +1,5 @@
#!/bin/zsh
xrandr --auto
scwrypts desktop i3 set background -- $(scwrypts -n get theme).jpg

View File

@ -4,7 +4,6 @@
exit 1
}
MAX_CHARGE_THRESHOLD=$1
[ "$MAX_CHARGE_THRESHOLD" ] \
|| MAX_CHARGE_THRESHOLD=75

3
config/bpython.conf Normal file
View File

@ -0,0 +1,3 @@
[general]
hist_file = ~/.local/state/python/bpythhon_hist

View File

@ -8,14 +8,32 @@
CA__DIRS=()
for __CA_DIR_LOOKUP in \
"$HOME/Projects" \
#####################################################################
__BASE_DIR="$(readlink -f -- "${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code")"
[ "${__BASE_DIR}" ] && {
[ -d "${HOME}/Projects" ] && mv "${HOME}/Projects" "${__BASE_DIR}" # TODO : remove after everyone is moved to xdg home
[ -d "${__BASE_DIR}" ] || mkdir -p -- "${__BASE_DIR}"
for __PROJECT_GROUP in \
brown-bag \
gizmos \
open-source \
python \
yage \
zsh \
;
do
__CA_DIR_LOOKUP="$(readlink -f -- "$__CA_DIR_LOOKUP")"
[ "$__CA_DIR_LOOKUP" ] && [ -d "$__CA_DIR_LOOKUP" ] && CA__DIRS+=($(find "$__CA_DIR_LOOKUP" -mindepth 1 -maxdepth 1 -type d | sed 's/\/$//'))
mkdir -p "${__BASE_DIR}/${__PROJECT_GROUP}"
done
unset __CA_DIR_LOOKUP
CA__DIRS+=($(find "${__BASE_DIR}" -mindepth 1 -maxdepth 1 -type d | sed 's/\/$//'))
}
unset __BASE_DIR
#####################################################################
# additional cloning targets; MUST END IN ':' or '/'
# e.g. 'git@my.githost.com:' or 'git@github.com:w0ryn/'

View File

@ -2,9 +2,6 @@
### default .wryn configuration settings ############################
#####################################################################
# installation path for this repository
export DOTWRYN="$HOME/.wryn"
# order of editor preference
export PREFERRED_EDITORS=(vim vi nano)
@ -16,6 +13,6 @@ PS1_USER='%m'
# run at each zsh login
WELCOME () {
[[ $TERM =~ tmux ]] && return 0
[[ ${TERM} =~ tmux ]] && return 0
{ figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy'; } | lolcat
}

View File

@ -1,29 +1,50 @@
[user]
email = yage@yage.io
name = yage
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICk2AL/QX5yr2UR2FsHg74bVLpQUpr1/lbgvoFi85J0c
[push]
default = current
[difftool]
trustExitCode = true
prompt = false
[diff]
tool = vimdiff
[merge]
tool = vimdiff
[pull]
default = current
rebase = true
[rebase]
autostash = true
[color]
diff = always
status = always
branch = always
[submodule]
recurse = true
[alias]
serve = !git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
[init]
defaultBranch = main
[safe]
directory = /opt/flutter
[gpg]
format = ssh
[gpg "ssh"]
program = /opt/1Password/op-ssh-sign
[commit]
gpgsign = true

View File

@ -170,7 +170,7 @@ bindsym $mod+shift+z gaps outer current minus 2; gaps inner current minus 2;
exec --no-startup-id compton
exec --no-startup-id 1password --silent
exec --no-startup-id scwrypts omni tmux
exec --no-startup-id scwrypts omni tmux -- --background
# color settings
set $FOCUSED_BORDER #006942

2
config/npmrc Normal file
View File

@ -0,0 +1,2 @@
cache=~/.cache/npm
prefix=~/.local/share/npm

View File

@ -9,7 +9,7 @@ SCWRYPTS_ENVIRONMENT__SHOW_ENV_HELP=false
SCWRYPTS_ENVIRONMENT__PREFERRED_EDIT_MODE=quiet
for SEARCH_DIR in \
"$HOME/.wryn/scwrypts" \
"$DOTWRYN/scwrypts" \
"$HOME/Projects/yage/" \
;
do

View File

@ -0,0 +1,2 @@
--- # local.altaria > dotwryn
# no configuration set

View File

@ -0,0 +1,2 @@
--- # local.altaria > remote
# no configuration set

View File

@ -0,0 +1,10 @@
--- # local.altaria > scwrypts
media-sync:
targets:
value:
- Pictures
- Documents
- Media
- .local/.porn
- Games/roms
- .local/share/dolphin-emu

View File

@ -17,3 +17,7 @@ wryn:
home server data
server-hostnames:
.ENVIRONMENT: WRYN__SERVER_HOSTNAMES
dotwryn:
.DESCRIPTION: >-
path to the local installation of wrynegade/dotwryn
.ENVIRONMENT: DOTWRYN

View File

@ -11,13 +11,13 @@ MAIN() {
case $SELECTION in
random )
feh --recursive --randomize --bg-fill $WALLPAPER_PATH
feh --no-fehbg --recursive --randomize --bg-fill $WALLPAPER_PATH
;;
* )
[ ! -f $DESKTOP__WALLPAPER_PATH/$SELECTION ] \
&& FAIL 2 "no such wallpaper '$SELECTION' in wallpaper path"
feh --bg-fill $DESKTOP__WALLPAPER_PATH/$SELECTION
feh --no-fehbg --bg-fill $DESKTOP__WALLPAPER_PATH/$SELECTION
;;
esac
}

View File

@ -231,7 +231,7 @@ SET_THEME() {
local WALLPAPER="$(find "$DESKTOP__WALLPAPER_PATH" -type f -name $THEME_NAME.\* 2>/dev/null | head -n1)"
[ "$WALLPAPER" ] && command -v feh &>/dev/null \
&& feh --bg-fill "$WALLPAPER"
&& feh --no-fehbg --bg-fill "$WALLPAPER"
CHECK_ERRORS --no-usage \
&& echo "$THEME_NAME" > "$ACTIVE_THEME_PATH/name.txt"

View File

@ -31,6 +31,23 @@ USAGE__description="
MAIN() {
[[ $TERM =~ tmux ]] && ERROR "\n Cannot run tmux-omni within a tmux session!\n "
local BACKGROUND_LAUNCH=false
local _S
while [[ $# -gt 0 ]]
do
_S=1
case $1 in
--background ) BACKGROUND_LAUNCH=true ;;
esac
[[ $_S -le $# ]] \
&& shift $_S \
|| ERROR "missing argument for '$1'" \
|| shift $# \
;
done
CHECK_ERRORS
local OMNI_SOCKET="omni.socket"
@ -48,6 +65,11 @@ MAIN() {
OMNI_TMUX new -d -s omni-manager "$SCWRYPTS_ROOT__remote/tmux/manager"
}
[[ $BACKGROUND_LAUNCH =~ true ]] && {
SUCCESS "omni server activated"
return 0
}
STATUS 'connecting to omni server'
OMNI_TMUX a -t=omni
}

View File

@ -19,16 +19,16 @@ function SETUP__CONFIG() {
GENERATE_INITIAL_LOCAL_CONFIG() {
local HOSTNAME="$(hostnamectl --static)"
[ $HOSTNAME ] || return 0
[ ${HOSTNAME} ] || return 0
mkdir -p "$DOTWRYN_PATH/bin/$HOSTNAME"
mkdir -p "${DOTWRYN_PATH}/bin/${HOSTNAME}"
local ENV_DIR="$DOTWRYN_PATH/config/scwrypts/environments"
local ENV_DIR="${DOTWRYN_PATH}/config/scwrypts/environments"
local GROUP
for GROUP in $(find "$ENV_DIR" -type f -name \*env.yaml | sed -n 's|.*/local\.\([^.]*\)\.env\.yaml|\1|p')
for GROUP in $(find "${ENV_DIR}" -type f -name \*env.yaml | sed -n 's|.*/local\.\([^.]*\)\.env\.yaml|\1|p')
do
[ -f "$ENV_DIR/local.$HOSTNAME.$GROUP.env.yaml" ] \
|| cp "$ENV_DIR/local.altaria.$GROUP.env.yaml" "$ENV_DIR/local.$HOSTNAME.$GROUP.env.yaml"
[ -f "${ENV_DIR}/local.${HOSTNAME}.${GROUP}.env.yaml" ] \
|| cp "${ENV_DIR}/local.altaria.${GROUP}.env.yaml" "${ENV_DIR}/local.${HOSTNAME}.${GROUP}.env.yaml"
done
}
@ -41,14 +41,14 @@ CONFIG__ZSH() {
}
CONFIG__SET_DEFAULT_SHELL() {
local DEFAULT_SHELL=$(awk -F: -v user="$USER" '$1 == user {print $NF}' /etc/passwd)
[[ $DEFAULT_SHELL =~ zsh ]] && return 0
local DEFAULT_SHELL=$(awk -F: -v user="${USER}" '$1 == user {print $NF}' /etc/passwd)
[[ ${DEFAULT_SHELL} =~ zsh ]] && return 0
[ $FORCE_ROOT ] && return 0
[ ${FORCE_ROOT} ] && return 0
STATUS 'setting zsh as default shell'
sudo chsh -s $(which zsh) $(whoami) 2>&1 \
&& SUCCESS "set zsh as default shell for '$USER'" \
&& SUCCESS "set zsh as default shell for '${USER}'" \
|| FAIL 1 'failed to set zsh as default shell' \
;
}
@ -69,7 +69,7 @@ CONFIG__VIM() {
CONFIG__VIM__LINK_SUPERUSER_RC() {
sudo [ /root/.vimrc ] && return 0
echo "let $DOTWRYN=\"$DOTWRYN_PATH\"\nsource \"$DOTWRYN_PATH/vim/rc.vim\"" \
echo "let ${DOTWRYN}=\"${DOTWRYN_PATH}\"\nsource \"${DOTWRYN_PATH}/vim/rc.vim\"" \
| sudo tee /root/.vimrc >/dev/null
sudo mkdir -p /root/.vim
@ -85,54 +85,67 @@ CONFIG__SYSTEM() {
#####################################################################
CONFIG__ENV() {
local DEFAULT_CONFIG="$DOTWRYN_PATH/config/dotwryn.env.$1"
local LOCAL_CONFIG="$HOME/.config/wryn/env.$1"
local DEFAULT_CONFIG="${DOTWRYN_PATH}/config/dotwryn.env.$1"
local LOCAL_CONFIG="${HOME}/.config/wryn/env.$1"
[ -f $LOCAL_CONFIG ] && {
case $OVERWRITE_EXISTING in
[ -f ${LOCAL_CONFIG} ] && {
case ${OVERWRITE_EXISTING} in
0 ) return 0 ;;
1 )
WARNING "local $1 configuration exists ($LOCAL_CONFIG)"
WARNING "local $1 configuration exists (${LOCAL_CONFIG})"
yN 'overwrite this configuration?' || return 0
mv "$LOCAL_CONFIG" "$LOCAL_CONFIG.bak" >/dev/null 2>&1 \
&& INFO "created backup of local configuration ($LOCAL_CONFIG.bak)"
mv "${LOCAL_CONFIG}" "${LOCAL_CONFIG}.bak" >/dev/null 2>&1 \
&& INFO "created backup of local configuration (${LOCAL_CONFIG}.bak)"
esac
}
STATUS "setting up $1 configuration ($LOCAL_CONFIG)"
STATUS "setting up $1 configuration (${LOCAL_CONFIG})"
case $1 in
zsh ) COMMENT='#' ;;
esac
{
echo "source $DEFAULT_CONFIG"
echo -e "\\n$COMMENT\n$COMMENT .wryn configuration overrides\n$COMMENT\n"
sed "s/^[^$COMMENT].*/$COMMENT&/" $DEFAULT_CONFIG
} > $LOCAL_CONFIG \
echo "source ${DEFAULT_CONFIG}"
echo -e "\\n${COMMENT}\n${COMMENT} .wryn configuration overrides\n${COMMENT}\n"
sed "s/^[^${COMMENT}].*/${COMMENT}&/" ${DEFAULT_CONFIG}
} > ${LOCAL_CONFIG} \
&& SUCCESS "created $1 configuration" \
|| FAIL 1 "unable to create $1 configuration" \
;
EDITOR=vim VISUAL=vim EDIT "$LOCAL_CONFIG"
EDITOR=vim VISUAL=vim EDIT "${LOCAL_CONFIG}"
}
CONFIG__RC() {
local TYPE="$1"
local RC="$HOME/.${TYPE}rc";
local SOURCE_LINE
case $TYPE in
zsh ) SOURCE_LINE="source $DOTWRYN_PATH/zsh/rc" ;;
vim ) SOURCE_LINE="source $DOTWRYN_PATH/vim/rc.vim" ;;
local RC
case ${TYPE} in
vim )
RC="${XDG_CONFIG_HOME:-${HOME}/.config}/vim/vimrc"
mkdir -p -- "$(dirname -- "${RC}")"
[ -f "${HOME}/.vimrc" ] \
&& cat "${HOME}/.vimrc" >> "${XDG_CONFIG_HOME:-${HOME}/.config}/vim/vimrc" \
&& rm "${HOME}/.vimrc" \
;
;;
* ) RC="${HOME}/.${TYPE}rc";
;;
esac
grep -q "^$SOURCE_LINE$" "$RC" \
|| echo "$SOURCE_LINE" >> $RC
local SOURCE_LINE
case ${TYPE} in
zsh ) SOURCE_LINE="source ${DOTWRYN_PATH}/zsh/rc" ;;
vim ) SOURCE_LINE="source ${DOTWRYN_PATH}/vim/rc.vim" ;;
esac
grep -q "^$SOURCE_LINE$" "$RC" \
grep -q "^${SOURCE_LINE}$" "${RC}" \
|| echo "${SOURCE_LINE}" >> ${RC}
grep -q "^${SOURCE_LINE}$" "${RC}" \
&& SUCCESS "${TYPE}rc is configured correctly" \
|| FAIL 1 "failed to configure ${TYPE}rc" \
;

View File

@ -1,26 +1,80 @@
#####################################################################
SETUP__GIT() {
STATUS 'updating remotes for .wryn'
cd $DOTWRYN_PATH
git remote add upstream git@github.com:wrynegade/dotwryn.git
git remote set-url --add --push upstream git@github.com:wrynegade/dotwryn.git
git remote set-url --add --push upstream git@yage.io:wrynegade/dotwryn.git
git remote set-url --add --push upstream git@bitbucket.org:wrynegade/dotwryn.git
local SOURCES_DIR="${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code"
STATUS 'updating upstream for zsh/plugins/code-activator'
cd $DOTWRYN_PATH/zsh/plugins/code-activator
git remote rm upstream 2>/dev/null
git remote add upstream git@yage.io:zsh/code-activator.git
git remote set-url --add --push upstream git@yage.io:zsh/code-activator.git
git remote set-url --add --push upstream git@github.com:wrynegade/code-activator-zsh.git
SOURCE_DIR="${DOTWRYN_PATH}" \
TARGET_DIR="${SOURCES_DIR}/yage/dotwryn" \
REMOTE_UPSTREAMS=(
'git@github.com:wrynegade/dotwryn.git'
'git@yage.io:wrynegade/dotwryn.git'
'git@bitbucket.org:wrynegade/dotwryn.git'
) SETUP__GIT__REMOTES '.wryn'
STATUS 'updating upstream for zsh/plugins/scwrypts'
cd $DOTWRYN_PATH/zsh/plugins/scwrypts
git remote rm upstream 2>/dev/null
git remote add upstream git@yage.io:zsh/code-activator
git remote set-url --add --push upstream git@yage.io:zsh/code-activator
git remote set-url --add --push upstream git@github.com:wrynegade/scwrypts.git
SOURCE_DIR="${DOTWRYN_PATH}/zsh/plugins/code-activator" \
TARGET_DIR="${SOURCES_DIR}/zsh/code-activator" \
REMOTE_UPSTREAMS=(
'git@yage.io:zsh/code-activator.git'
'git@github.com:wrynegade/code-activator.git'
) SETUP__GIT__REMOTES 'zsh-plugins/code-activator'
cd $DOTWRYN_PATH
SOURCE_DIR="${DOTWRYN_PATH}/zsh/plugins/scwrypts" \
TARGET_DIR="${SOURCES_DIR}/zsh/scwrypts" \
REMOTE_UPSTREAMS=(
'git@yage.io:zsh/scwrypts'
'git@github.com:wrynegade/scwrypts'
) SETUP__GIT__REMOTES 'zsh-plugins/scwrypts'
return 0
}
SETUP__GIT__REMOTES() {
: \
&& [ "${SOURCE_DIR}" ] \
&& [ "${TARGET_DIR}" ] \
&& [[ ${#REMOTE_UPSTREAMS[@]} -gt 0 ]] \
|| return 1
[ "$1" ] && STATUS "updating remotes for '$1'"
git -C "${SOURCE_DIR}" remote rm upstream 2>/dev/null
git -C "${SOURCE_DIR}" remote add upstream ${REMOTE_UPSTREAMS[1]}
local REMOTE_UPSTREAM
for REMOTE_UPSTREAM in ${REMOTE_UPSTREAMS[@]}
do
git -C "${SOURCE_DIR}" remote set-url --add --push upstream "${REMOTE_UPSTREAM}"
case ${REMOTE_UPSTREAM} in
git@github.com:* )
git -C "${SOURCE_DIR}" remote rm github 2>/dev/null
git -C "${SOURCE_DIR}" remote add github "${REMOTE_UPSTREAM}"
;;
git@yage.io:* )
git -C "${SOURCE_DIR}" remote rm yage 2>/dev/null
git -C "${SOURCE_DIR}" remote add yage "${REMOTE_UPSTREAM}"
;;
git@bitbucket.org:* )
git -C "${SOURCE_DIR}" remote rm bitbucket 2>/dev/null
git -C "${SOURCE_DIR}" remote add bitbucket "${REMOTE_UPSTREAM}"
;;
esac
done
SOURCE_DIR="${SOURCE_DIR}" TARGET_DIR="${TARGET_DIR}" SETUP__GIT_LINK_TO_PROJECTS || {
WARNING "failed to link '${TARGET_DIR}'"
}
return 0
}
SETUP__GIT__LINK_TO_PROJECTS() {
[ "${TARGET_DIR}" ] && [ "${SOURCE_DIR}" ] \
|| return 1
{
mkdir -p "${TARGET_DIR}"
rm "${TARGET_DIR}/code"
ln -s "${SOURCE_DIR}" "${TARGET_DIR}/code"
} &>/dev/null
}

View File

@ -2,11 +2,11 @@
SETUP__OS() {
OS__MAKE_REQUIRED_RESOURCES || return 1
[ $CI ] && { STATUS 'detected CI; skipping os setup'; return 0; }
[ ${CI} ] && { STATUS 'detected CI; skipping os setup'; return 0; }
GETSUDO
local OS_NAME=$(OS__GET_OS)
[ ! $OS_NAME ] && ABORT
[ ! ${OS_NAME} ] && ABORT
OS__INSTALL_SOURCE_DEPENDENCIES || return 2
OS__INSTALL_MANAGED_DEPENDENCIES || return 3
@ -15,25 +15,25 @@ SETUP__OS() {
OS__GET_OS() {
local OS_NAME=$(lsb_release -is 2>/dev/null | tr '[:upper:]' '[:lower:]')
[ ! $OS_NAME ] \
[ ! ${OS_NAME} ] \
&& OS_NAME=$(cat /etc/os-release 2>/dev/null | grep '^ID=' | sed 's/^ID=//')
[ ! $OS_NAME ] \
[ ! ${OS_NAME} ] \
&& WARNING 'failed to detect operating system' \
&& OS_NAME=$(echo -e "arch\ndebian\nother" | FZF 'select an operating system') \
;
[[ $OS_NAME =~ ^ubuntu$ ]] && OS_NAME=debian
[[ ${OS_NAME} =~ ^ubuntu$ ]] && OS_NAME=debian
[[ $OS_NAME =~ ^[Ee]ndeavour[Oo][Ss]$ ]] && OS_NAME=arch
[[ ${OS_NAME} =~ ^[Ee]ndeavour[Oo][Ss]$ ]] && OS_NAME=arch
echo $OS_NAME
echo ${OS_NAME}
}
#####################################################################
OS__INSTALL_SOURCE_DEPENDENCIES() {
case $OS_NAME in
case ${OS_NAME} in
arch )
command -v yay >/dev/null 2>&1 \
|| SCWRYPTS packages/install -- 'https://aur.archlinux.org/yay.git' --local-name 'yay' \
@ -43,7 +43,7 @@ OS__INSTALL_SOURCE_DEPENDENCIES() {
* ) ;;
esac
[ $COMPILE_DMENU ] && [[ $COMPILE_DMENU -eq 1 ]] \
[ ${COMPILE_DMENU} ] && [[ ${COMPILE_DMENU} -eq 1 ]] \
&& SCWRYPTS packages/install -- 'https://github.com/tiyn/dmenu' --local-name 'patched-dmenu'
return 0
@ -55,33 +55,33 @@ OS__INSTALL_MANAGED_DEPENDENCIES() {
local ERRORS=0
STATUS 'checking os dependencies'
case $OS_NAME in
case ${OS_NAME} in
arch )
;;
debian ) ;;
* )
OS_NAME='generic'
WARNING "no automated installer available for '$OS_NAME'"
WARNING "no automated installer available for '${OS_NAME}'"
;;
esac
[ $MIN ] && [[ $MIN -eq 1 ]] && [ -f "$DOTWRYN_PATH/setup/os-dependencies/$OS_NAME.min.txt" ] \
&& DEPENDENCIES="$DOTWRYN_PATH/setup/os-dependencies/$OS_NAME.min.txt" \
|| DEPENDENCIES="$DOTWRYN_PATH/setup/os-dependencies/$OS_NAME.txt" \
[ ${MIN} ] && [[ ${MIN} -eq 1 ]] && [ -f "${DOTWRYN_PATH}/setup/os-dependencies/${OS_NAME}.min.txt" ] \
&& DEPENDENCIES="${DOTWRYN_PATH}/setup/os-dependencies/${OS_NAME}.min.txt" \
|| DEPENDENCIES="${DOTWRYN_PATH}/setup/os-dependencies/${OS_NAME}.txt" \
;
[ ! $CI ] && {
[ ! ${CI} ] && {
STATUS 'updating system, repositories, and mirrors'
UPDATE_REPOSITORIES__$OS_NAME
UPDATE_REPOSITORIES__${OS_NAME}
}
for DEPENDENCY in $(cat "$DEPENDENCIES")
for DEPENDENCY in $(cat "${DEPENDENCIES}")
do
INSTALL_MANAGED__$OS_NAME $DEPENDENCY
INSTALL_MANAGED__${OS_NAME} ${DEPENDENCY}
done
[[ $ERRORS -ne 0 ]] && {
WARNING "detected $ERRORS errors; double check warnings before proceeding!"
[[ ${ERRORS} -ne 0 ]] && {
WARNING "detected ${ERRORS} errors; double check warnings before proceeding!"
yN 'continue with install?' && return 0 || ABORT
}
@ -92,18 +92,18 @@ OS__INSTALL_MANAGED_DEPENDENCIES() {
UPDATE_REPOSITORIES__arch() { yay -Syu; }
INSTALL_MANAGED__arch() {
local TARGET="$1"
[[ $TARGET =~ aws-cli-v2 ]] && {
[[ ${TARGET} =~ aws-cli-v2 ]] && {
STATUS "skipping aws-cli-v2 checks since they are bad right now"
return 0
}
yay -Qq 2>/dev/null | grep -q "^$TARGET$\|^$TARGET-git$" && {
SUCCESS "found '$TARGET'"
yay -Qq 2>/dev/null | grep -q "^${TARGET}$\|^${TARGET}-git$" && {
SUCCESS "found '${TARGET}'"
} || {
STATUS "installing '$TARGET'"
yay -Syu --noconfirm $TARGET \
&& SUCCESS "successfully installed '$TARGET'" \
|| ERROR "failed to install '$TARGET'" \
STATUS "installing '${TARGET}'"
yay -Syu --noconfirm ${TARGET} \
&& SUCCESS "successfully installed '${TARGET}'" \
|| ERROR "failed to install '${TARGET}'" \
;
}
}
@ -113,7 +113,7 @@ INSTALL_MANAGED__debian() {
STATUS "checking / installing '$1'"
sudo apt-get install --yes $1 \
&& SUCCESS "'$1' installed" \
|| ERROR "failed to install $TARGET" \
|| ERROR "failed to install ${TARGET}" \
;
}
@ -128,32 +128,29 @@ INSTALL_MANAGED__generic() {
OS__MAKE_REQUIRED_RESOURCES() {
local ERRORS=0
local DIRECTORIES=(
"$HOME/.config/wryn"
"$HOME/.local/bin"
"$HOME/.vim/bundle"
"$HOME/.vim/colors"
"${XDG_CONFIG_HOME:-${HOME}.config}/wryn"
"${HOME}/.local/bin"
)
local FILES=(
"$HOME/.vimrc"
"$HOME/.zshrc"
"${HOME}/.zshrc"
)
STATUS 'making required system resources'
for D in $DIRECTORIES
for D in ${DIRECTORIES}
do
[ ! -d $D ] && { mkdir -p $D || ERROR "failed to create directory '$D'"; }
[ ! -d ${D} ] && { mkdir -p ${D} || ERROR "failed to create directory '${D}'"; }
done
for F in $FILES
for F in ${FILES}
do
[ ! -f $F ] && { touch $F || ERROR "failed to create file '$F'"; }
[ ! -f ${F} ] && { touch ${F} || ERROR "failed to create file '${F}'"; }
done
[[ $ERRORS -eq 0 ]] \
[[ ${ERRORS} -eq 0 ]] \
&& SUCCESS 'finished creating system resources' \
|| ERROR 'failed to create system resources' \
;
return $ERRORS
return ${ERRORS}
}

View File

@ -21,19 +21,22 @@ done
source ./requirements.zsh || exit 1
################################################################################
LOGFILE="$HOME/dotwryn-install.log"
LOGFILE="${HOME}/dotwryn-install.txt"
STATUS "installation start : $(date)" 2>> "$LOGFILE"
STATUS "installation start : $(date)" 2>> "${LOGFILE}"
{
SETUP__OS || FAIL 1 'failed to set up os-dependencies (see above)'
SETUP__GIT || FAIL 2 'failed to set up git (see above)'
SETUP__CONFIG || FAIL 3 'failed to set up program configuration (see above)'
} 2>&1 | tee --append "$LOGFILE"
} 2>&1 | tee --append "${LOGFILE}"
STATUS "installation complete: $(date)" 2>> "$LOGFILE"
STATUS "installation complete: $(date)" 2>> "${LOGFILE}"
################################################################################
[[ ${ERRORS} -eq 0 ]] || {
yN 'keep logfile?' \
|| { rm "$LOGFILE" || ERROR "unable to remove '$LOGFILE'" }
|| { rm "${LOGFILE}" || ERROR "unable to remove '${LOGFILE}'" }
}
SUCCESS "\n.wryn setup complete; have a nice day :)\n "

View File

@ -1,12 +1,19 @@
if !isdirectory(expand("$HOME/.vim/bundle/Vundle.vim")) | let g:plugins_ok = 0 | finish | endif
if !empty(glob(expand("$HOME/.vim/bundle")))
let $VIM_PLUGIN_DIR=expand("$HOME/.vim/bundle")
elseif !empty(expand("$XDG_CONFIG_HOME"))
let $VIM_PLUGIN_DIR=expand("$XDG_CONFIG_HOME/vim/bundle")
else
let $VIM_PLUGIN_DIR=expand("$HOME/.config/vim/bundle")
endif
if !isdirectory(expand("$VIM_PLUGIN_DIR/Vundle.vim")) | let g:plugins_ok = 0 | finish | endif
" -------------------------------------------------------------------
set nocompatible
filetype off
set rtp+=$VIM_PLUGIN_DIR/Vundle.vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
call vundle#begin("$VIM_PLUGIN_DIR")
Plugin 'VundleVim/Vundle.vim' " 00.plugin-vundle.vim
Plugin 'valloric/youcompleteme' " 01.plugin-youcompleteme.vim
Plugin 'w0rp/ale' " 02.plugin-ale.vim

View File

@ -9,3 +9,5 @@ set showmatch matchtime=0
set backspace=indent,eol,start
set spellfile=$DOTWRYN/vim/en.utf-8.add spelllang=en
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo

View File

@ -1,5 +1,11 @@
if empty($DOTWRYN)
if !empty(glob(expand("$HOME/.wryn")))
let $DOTWRYN=expand("$HOME/.wryn")
elseif !empty(glob(expand("$XDG_DATA_HOME/wryn")))
let $DOTWRYN=expand("$XDG_DATA_HOME/wryn")
else
let $DOTWRYN=expand("$HOME/.local/share/wryn")
endif
endif
let $VIMRC=expand("$DOTWRYN/vim/rc.vim")

@ -1 +1 @@
Subproject commit c7fb028ec0bbc1056c51508602dbd61b0f475ac3
Subproject commit 7fed01afba9392b6392408b9a0cf888522ed7a10

View File

@ -1,5 +1,16 @@
: \
&& source "$HOME/.config/wryn/env.zsh" \
&& [ "$DOTWRYN" ] \
&& [ -d "$DOTWRYN" ] \
[ "$DOTWRYN" ] || {
[ -d "${HOME}/.wryn" ] \
&& export DOTWRYN="${HOME}/.wryn" \
|| export DOTWRYN="${XDG_DATA_HOME:-${HOME}/.local/share}/wryn" \
;
}
[ "${DOTWRYN}" ] && [ -d "${DOTWRYN}" ] || {
echo "ERROR : cannot determine \$DOTWRYN location" >&2
return 1
}
: \
&& source "${DOTWRYN}/config/dotwryn.env.zsh" \
&& source "${XDG_CONFIG_HOME:-${HOME}/.config}/wryn/env.zsh" \
;

View File

@ -0,0 +1,43 @@
#####################################################################
export XDG_CACHE_HOME="${HOME}/.cache"
export XDG_CONFIG_HOME="${HOME}/.config"
export XDG_DATA_HOME="${HOME}/.local/share"
export XDG_STATE_HOME="${HOME}/.local/state"
export XDG_RUNTIME_DIR="/run/user/${UID}"
export XDG_DATA_DIRS=/usr/local/share:/usr/share
export XDG_CONFIG_DIRS=/etc/xdg
#####################################################################
export AWS_CONFIG_FILE="${XDG_DATA_HOME}/aws/config"
export AWS_SHARED_CREDENTIALS_FILE="${XDG_DATA_HOME}/aws/credentials"
export CARGO_HOME="${XDG_DATA_HOME}/cargo"
export GNUPGHOME="${XDG_DATA_HOME}/gnupg"
export GOPATH="${XDG_DATA_HOME}/go"
export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/npmrc"
export PYTHONPYCACHEPREFIX="${XDG_CACHE_HOME}/python"
export PYTHONUSERBASE="${XDG_DATA_HOME}/python"
export PYTHON_HISTORY="${XDG_STATE_HOME}/python/history"
export RUSTUP_HOME="${XDG_DATA_HOME}/rustup"
export TERMINFO="${XDG_DATA_HOME}/terminfo"
export TERMINFO_DIRS="${XDG_DATA_HOME}/terminfo:/usr/share/terminfo"
export XAUTHORITY="${XDG_RUNTIME_DIR}/Xauthority"
export XINITRC="${XDG_CONFIG_HOME}/X11/xinitrc"
export XSERVERRC="${XDG_CONFIG_HOME}/X11/xserverrc"
export _Z_DATA="${XDG_DATA_HOME}/z"
#####################################################################
for __SETUP_DIR in \
"${XDG_STATE_HOME}/zsh" \
"${XDG_STATE_HOME}/python" \
"$(dirname -- "${AWS_CONFIG_FILE}")" \
"$(dirname -- "${NPM_CONFIG_USERCONFIG}")" \
;
do
[ -d "${__SETUP_DIR}" ] || mkdir -p -- "${__SETUP_DIR}"
done
unset __SETUP_DIR

View File

@ -1,6 +1,6 @@
#####################################################################
HISTFILE=~/.local/zsh.history
HISTFILE="${XDG_STATE_HOME}/zsh/history"
HISTSIZE=10000
SAVEHIST=10000
@ -18,11 +18,12 @@ bindkey -M vicmd v edit-command-line
# zsh auto/tab-completion engine
zmodload -i zsh/complist
autoload -Uz compinit
compinit
compinit -d "${XDG_CACHE_HOME}/zsh/zcompdump-${ZSH_VERSION}"
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' max-errors 1
zstyle ':completion:*' menu select
zstyle ':completion:*' cache-path "${XDG_CACHE_HOME}/zsh/zcompcache"
bindkey -M menuselect '^M' .accept-line
#####################################################################

View File

@ -1,9 +1,5 @@
#####################################################################
# I hate the default "$HOME/go" go path; hide it away
[ $GOPATH ] \
|| export GOPATH="$HOME/.local/go"
# not sure if this is needed anymore since I've moved to alacritty,
# but leaving this here since it was obnoxious to find
which kitty &>/dev/null \
@ -11,9 +7,7 @@ which kitty &>/dev/null \
# many tmux workflows like to interact with the X-server; however,
# the tmux sessions frequently start before the X-session
[[ $TERM =~ tmux ]] && [ ! $DISPLAY ] && export DISPLAY=:0
#RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config"
[[ ${TERM} =~ tmux ]] && [ ! ${DISPLAY} ] && export DISPLAY=:0
#####################################################################
return 0

View File

@ -1,7 +1,7 @@
#####################################################################
ZSH_PLUGINS+=($(
find "$(readlink -f -- "$HOME/.local/zsh")" -type f 2>/dev/null
find "$(readlink -f -- "${XDG_DATA_HOME:-${HOME}/.local/share}/zsh")" -type f 2>/dev/null
))
#####################################################################

View File

@ -1,9 +1,9 @@
() { # create path entries
local PATH_ENTRY
for PATH_ENTRY in \
"$HOME/.local/bin" \
"$(go env GOPATH 2>/dev/null)/bin" \
"$HOME/.$(hostnamectl --static)" \
"${HOME}/.local/bin" \
"${HOME}/.local/share/$(hostnamectl --static)" \
"${GOPATH}/bin" \
;
do
echo "$PATH" | sed 's/:/\n/g' | grep -q "^$PATH_ENTRY$" \

View File

@ -0,0 +1,4 @@
find "${HOME}/.1password/agent.sock" &>/dev/null \
&& export SSH_AUTH_SOCK="${HOME}/.1password/agent.sock"
return 0