remove bash

This commit is contained in:
thek4n 2024-11-02 13:43:31 +03:00
parent 7f66492f2a
commit e978486393
25 changed files with 74 additions and 76 deletions

2
.gitignore vendored
View File

@ -3,8 +3,6 @@ home/user/.config/zsh/plugins/*
home/user/.config/nvim/plugin
home/user/.config/nvim/spell
home/user/.config/bash/bashrc.d/*
!home/user/.config/bash/bashrc.d/.gitkeep
home/user/.config/zsh/zshrc.d/*
!home/user/.config/zsh/zshrc.d/00_zhashd.sh
home/user/.config/zsh/.zcalc_history

View File

@ -20,7 +20,6 @@
## Project description
Config files for:
* bash
* zsh
* alacritty
* tmux
@ -37,17 +36,17 @@ Config files for:
<img src=".assets/prompt.png" alt="Prompt">
</p>
You can add your files to the `~/.config/bash/bashrc.d` directory for bash or `~/.config/zsh/zshrc.d` directory for zsh so that they automatically run in ascending order when you open a terminal.\
You can add your files to the `~/.config/zsh/zshrc.d` directory for zsh so that they automatically run in ascending order when you open a terminal.\
Example:\
`~/.config/bash/bashrc.d/01_hello.sh`
```bash
`~/.config/zsh/zshrc.d/01_hello.sh`
```sh
echo "Hello $USER!"
```
<a id="chapter-1"></a>
## Installation
```bash
```sh
git clone https://github.com/TheK4n/dotfiles
cd dotfiles
./install zsh nvim ...

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
echo
figlet -ct -f banner "welcome mr.kan"
echo

View File

@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/sh
echo wg0 status: $(systemctl is-active wg-quick@wg0.service)
echo "wg0 status: $(systemctl is-active wg-quick@wg0.service)"
if ! systemctl is-active wg-quick@wg0.service &>/dev/null; then
if ! systemctl is-active wg-quick@wg0.service 1>/dev/null; then
echo 'Executing this command may fix wireguard: "sudo apt update && sudo apt install linux-headers-$(uname -r) && sudo reboot"'
fi

View File

@ -29,9 +29,6 @@ zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*:cd:*' ignore-parents parent pwd
autoload bashcompinit
bashcompinit
compdef _directories _d
compdef _files _f
compdef _directories mcd

View File

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh
if [[ "$1" == "docker-cli-plugin-metadata" ]]; then
if [ "$1" = "docker-cli-plugin-metadata" ]; then
cat << HERE
{
"SchemaVersion": "0.1.0",
@ -22,7 +22,7 @@ EOF
shift
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
exit 0
fi

View File

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh
if [[ "$1" == "docker-cli-plugin-metadata" ]]; then
if [ "$1" = "docker-cli-plugin-metadata" ]; then
cat << HERE
{
"SchemaVersion": "0.1.0",
@ -22,23 +22,24 @@ EOF
shift
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
exit 0
fi
set -e
result="CONTAINER NAME;IMAGE;IP\n"
(
printf "CONTAINER NAME;IMAGE;IP\n"
for container in $(docker ps -q | tr '\n' ' ')
do
ip="$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$container" 2>/dev/null)"
container_name="$(docker inspect --format='{{.Name}}' "$container" 2>/dev/null)"
image_name="$(docker inspect --format='{{.Config.Image}}' "$container" 2>/dev/null)"
result+="${container_name#"/"};${image_name};${ip}\n"
printf "%s;%s;%s\n" "${container_name#/}" "${image_name}" "${ip}"
done
) | column -t -s ";"
echo -e "$result" 2>/dev/null | column -t -s ";"
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh
if [[ "$1" == "docker-cli-plugin-metadata" ]]; then
if [ "$1" = "docker-cli-plugin-metadata" ]; then
cat << HERE
{
"SchemaVersion": "0.1.0",
@ -22,7 +22,7 @@ EOF
shift
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
exit 0
fi

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
set -eux

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
set -eu
set -m # enable background jobs
@ -7,7 +7,7 @@ readonly SESSION=example-background-job
readonly MAINW=1
if tmux has-session -t "${SESSION}" &>/dev/null; then
if tmux has-session -t "${SESSION}" 2>/dev/null; then
tmux kill-session -t "${SESSION}"
fi
@ -18,13 +18,13 @@ tmux switch-client -t "${SESSION}"
temp_script="$(mktemp)"
readonly temp_script
cat > "${temp_script}" << EOF
#!/bin/bash
#!/bin/sh
cleanup() {
rm \$0 # remove self after exit
}
trap cleanup EXIT ERR
trap cleanup EXIT
sleep 3
tmux send-keys -t "${SESSION}:${MAINW}.1" 'echo hello' Enter

View File

@ -1,15 +1,21 @@
#!/usr/bin/env bash
#!/bin/sh
set -eux
declare -r SESSION_PREFIX="sandbox"
declare RND="${RANDOM}"
declare SESSION="${SESSION_PREFIX}${RND}"
random() {
seq 0 65535 | shuf | head -n 1
}
readonly SESSION_PREFIX="sandbox"
RND="$(random)"
SESSION="${SESSION_PREFIX}${RND}"
while tmux has-session -t "${SESSION}" 2>/dev/null
do
RND="${RANDOM}"
RND="$(random)"
SESSION="${SESSION_PREFIX}${RND}"
done
@ -17,7 +23,6 @@ readonly RND
readonly SESSION
declare WORKING_PROJECT
WORKING_PROJECT="$(mktemp -td "${SESSION_PREFIX}${RND}.XXXX")"
readonly WORKING_PROJECT

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
set -eu
@ -6,20 +6,18 @@ SSH_SERVERS="$(grep 'Host ' "${HOME}/.ssh/config" | sed 's/^Host //')"
HOSTS="$(grep -v '^#' /etc/hosts)"
HISTORY_HOSTS="$(grep ssh "${HOME}/.zsh_history" | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
ALL_HOSTS="$(echo "$SSH_SERVERS" "$HOSTS" "$HISTORY_HOSTS" | grep -v '\*'| sed 's/ /\n/g' | sed '/^$/d' | sort | uniq | tac)"
ALL_HOSTS="$(echo "$SSH_SERVERS" "$HOSTS" "$HISTORY_HOSTS" | grep -v '\*'| sed 's/ /\n/g ; /^$/d' | sort | uniq | tac)"
SSH_SERVER="$(echo -n "$ALL_HOSTS" | fzf +m --print-query --bind 'tab:replace-query' | tail -n 1)"
SSH_SERVER="$(echo "$ALL_HOSTS" | fzf +m --print-query --bind 'tab:replace-query' | tail -n 1)"
if [[ -z "${SSH_SERVER}" ]]; then
if [ -z "${SSH_SERVER}" ]; then
exit 0
fi
SSH_SERVER_SESSION_NAME="${SSH_SERVER//\./-}"
SSH_SERVER_SESSION_NAME="${SSH_SERVER_SESSION_NAME//:/-}"
SSH_SERVER_SESSION_NAME="${SSH_SERVER_SESSION_NAME%% *}"
declare -r SESSION="ssh_${SSH_SERVER_SESSION_NAME}"
SSH_SERVER_SESSION_NAME="$(echo "${SSH_SERVER%% *}" | sed 's/\./\-/g ; s/\:/\-/g')"
readonly SESSION="ssh_${SSH_SERVER_SESSION_NAME}"
if ! tmux has-session -t "${SESSION}" 2>/dev/null; then

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
echo 'pacman -S man-pages man-db lesspipe'
echo 'echo "ParallelDownloads = 5\nVerbosePkgLists" >> /etc/pacman.conf'

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
sub="$HOME/.local/share/fonts"

6
install-hooks/git/post-install Normal file → Executable file
View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
#!/bin/sh
git config --global user.name "$USER"
git config --global user.email "${USER}@${HOST:-$HOSTNAME}"
git config --global user.email "${USER}@${HOST}"
git config --global user.signingkey "$USER"
git config --global github.user "$USER"
git config --global github.email "${USER}@${HOST:-$HOSTNAME}"
git config --global github.email "${USER}@${HOST}"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
cat "$SUB/.gnupg/gpg.conf" >> "$HOME/.gnupg/gpg.conf"
echo -e "default-cache-ttl 1\nmax-cache-ttl 1" > "$HOME/.gnupg/gpg-agent.conf"; echo RELOADAGENT | gpg-connect-agent

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
echo "sudo pacman -S nitrogen picom compton ttf-font-awesome xdotool xclip maim playerctl rofi"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
echo "sudo pacman -S npm ctags fzf glow; mkdir ~/.npm-global; npm config set prefix '~/.npm-global'"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
mkdir -p "$SANDBOX_PATH/.config/ranger/plugins"
git clone https://github.com/alexanderjeurissen/ranger_devicons "$SANDBOX_PATH/.config/ranger/plugins/ranger_devicons"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
cat "$SUB/.ssh/config" >> "$HOME/.ssh/config"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
#!/bin/sh
if [[ -d "$HOME/.shortcuts" ]]; then
if [ -d "$HOME/.shortcuts" ]; then
cp "$SUB/.shortcuts/*" "$HOME/.shortcuts"
else
cp -r "$SUB/.shortcuts" "$HOME"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
echo "apt install termux-api tsu"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
command -v systemctl >/dev/null && systemctl --user enable --now tmux
git clone https://github.com/tmux-plugins/tpm "$HOME/.config/tmux/plugins/tpm" | true

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# useradd -md /home/sandbox -s $0 sandbox
# usermod -aG docker sandbox
# echo "$0" | sudo tee -a /etc/shells # for pam