Compare commits
4 Commits
528c88a5a5
...
3ff41ac4dc
Author | SHA1 | Date |
---|---|---|
|
3ff41ac4dc | |
|
2cdedd76b7 | |
|
63950171eb | |
|
ff29919af8 |
|
@ -219,63 +219,6 @@ if [ $ZSH_ROOT_ALIAS -gt 0 ]; then
|
||||||
fi
|
fi
|
||||||
section_end
|
section_end
|
||||||
|
|
||||||
# sugar to easily connect to remote docker hosts through SSH
|
|
||||||
section "ssh-based remote docker access"
|
|
||||||
ssh_docker() {
|
|
||||||
args=("$@")
|
|
||||||
control_path=$(sha1sum - <<<"${args[-1]}" | awk '{print $1}')
|
|
||||||
base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"$1" | awk '{print $1}')
|
|
||||||
control_path="${base_path}.control"
|
|
||||||
sock_path="${base_path}.sock"
|
|
||||||
if [ -f "${sock_path}" ]; then
|
|
||||||
echo "Socket path ${sock_path} already exists." >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ -f "${control_path}" ]; then
|
|
||||||
echo "Control path ${control_path} already exists." >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
mkdir -p /var/tmp/ssh-docker
|
|
||||||
ssh -o ControlMaster=auto -o ControlPersist=yes -o ControlPath="${control_path}" -nfNT -L "${sock_path}:/var/run/docker.sock" "$@"
|
|
||||||
echo "export DOCKER_TLS_VERIFY="
|
|
||||||
echo "export DOCKER_HOST=unix://${sock_path}"
|
|
||||||
echo "export DOCKER_CERT_PATH="
|
|
||||||
echo "export DOCKER_SSH_CONTROL_PATH=${control_path}"
|
|
||||||
echo "export DOCKER_SSH_SOCKET_PATH=${sock_path}"
|
|
||||||
}
|
|
||||||
ssh_docker_exit() {
|
|
||||||
args=("$@")
|
|
||||||
if [ "${#args}" -gt 0 ]; then
|
|
||||||
base_path=/var/tmp/ssh-docker/$(sha1sum - <<<"${args[-1]}" | awk '{print $1}')
|
|
||||||
control_path="${base_path}.control"
|
|
||||||
sock_path="${base_path}.sock"
|
|
||||||
else
|
|
||||||
control_path="${DOCKER_SSH_CONTROL_PATH}"
|
|
||||||
sock_path="${DOCKER_SSH_SOCKET_PATH}"
|
|
||||||
fi
|
|
||||||
if [ -z "${control_path}" ]; then
|
|
||||||
echo "No active Docker SSH forwarding found in environment." >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
ssh -o ControlPath="${control_path}" -O exit "$@" dummy
|
|
||||||
rm -f "${sock_path}" "${control_path}"
|
|
||||||
}
|
|
||||||
ssh_docker_cleanup() {
|
|
||||||
for socket in /var/tmp/ssh-docker/*.sock; do
|
|
||||||
if [ ! -e "$socket" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
control="$(basename "$socket" .control).sock"
|
|
||||||
DOCKER_SSH_CONTROL_PATH="$control" \
|
|
||||||
DOCKER_SSH_SOCKET_PATH="$socket" \
|
|
||||||
ssh_docker_exit
|
|
||||||
done
|
|
||||||
}
|
|
||||||
export ssh_docker
|
|
||||||
export ssh_docker_exit
|
|
||||||
export ssh_docker_cleanup
|
|
||||||
section_end
|
|
||||||
|
|
||||||
# Reboot required? (hacky code)
|
# Reboot required? (hacky code)
|
||||||
section "reboot required?"
|
section "reboot required?"
|
||||||
if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
if [ $ZSH_PRINT_REBOOT_REQUIRED -gt 0 ]; then
|
||||||
|
|
|
@ -41,8 +41,7 @@ pip3_install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pipx_install() {
|
pipx_install() {
|
||||||
for pkg in "$@"
|
for pkg in "$@"; do
|
||||||
do
|
|
||||||
pipx install --force "$pkg"
|
pipx install --force "$pkg"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -163,6 +162,53 @@ if has_tags pm:pipx; then
|
||||||
thefuck
|
thefuck
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# change git user settings
|
||||||
|
|
||||||
|
set_git_config_if_unset() {
|
||||||
|
local name
|
||||||
|
local value
|
||||||
|
name="$1"
|
||||||
|
value="$2"
|
||||||
|
if ! git config --global --get "$1" >/dev/null; then
|
||||||
|
echo "Configuring global git setting: $1 = $2"
|
||||||
|
git config --global "$1" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
clear_git_config_if_pointing_nowhere() {
|
||||||
|
local name
|
||||||
|
name="$1"
|
||||||
|
if git config --global --get "$1" >/dev/null && ! command -v $(git config --global --get "$1") >/dev/null; then
|
||||||
|
echo "Resetting global git setting since it no longer points anywhere useful: $1"
|
||||||
|
git config --global --unset "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_git_config_if_unset alias.change-commits '!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '"'"'$OLD'"'"' ]]; then export $VAR='"'"'$NEW'"'"'; fi\" $@; }; f'
|
||||||
|
set_git_config_if_unset alias.glog 'log --all --pretty="format:%d %Cgreen%h%Creset %an - %s" --graph'
|
||||||
|
set_git_config_if_unset commit.gpgsign true
|
||||||
|
set_git_config_if_unset core.autocrlf input
|
||||||
|
set_git_config_if_unset core.editor "$EDITOR"
|
||||||
|
set_git_config_if_unset init.defaultBranch main
|
||||||
|
set_git_config_if_unset pull.rebase false
|
||||||
|
set_git_config_if_unset tag.gpgsign true
|
||||||
|
set_git_config_if_unset user.email "icedream@icedream.pw"
|
||||||
|
set_git_config_if_unset user.name "Carl Kittelberger"
|
||||||
|
#set_git_config_if_unset user.signingkey B5108C5A158A6608AD3361DA1573F6D8EFE4D0CF
|
||||||
|
set_git_config_if_unset user.signingkey 04ADEF85EA6AEC6F75941E84468BBEEBB9EC6AEA
|
||||||
|
|
||||||
|
# set up git-cola
|
||||||
|
set_git_config_if_unset cola.spellcheck false
|
||||||
|
set_git_config_if_unset cola.startupmode folder
|
||||||
|
|
||||||
|
# set up kdiff3 as mergetool if it is installed
|
||||||
|
clear_git_config_if_pointing_nowhere merge.tool
|
||||||
|
for bin in kdiff3 meld p4merge vimdiff; do
|
||||||
|
if command -v "$bin" >/dev/null; then
|
||||||
|
set_git_config_if_unset merge.tool "$bin"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# change default terminal to urxvt
|
# change default terminal to urxvt
|
||||||
|
|
||||||
if has_tags desktop; then
|
if has_tags desktop; then
|
||||||
|
|
Loading…
Reference in New Issue