bin: new script versions
This commit is contained in:
parent
84af52658e
commit
750b42f7cf
|
@ -1,5 +1,7 @@
|
||||||
test -n "$PS1" || return 0
|
test -n "$PS1" || return 0
|
||||||
|
|
||||||
|
which pfetch >/dev/null 2>&1 && pfetch
|
||||||
|
|
||||||
test $(id -u) -eq 0 || sudo=sudo
|
test $(id -u) -eq 0 || sudo=sudo
|
||||||
|
|
||||||
alias jc="$sudo journalctl --boot --unit"
|
alias jc="$sudo journalctl --boot --unit"
|
||||||
|
|
|
@ -13,11 +13,18 @@ letsencrypt() {
|
||||||
ip=$(localip)
|
ip=$(localip)
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for user
|
for user
|
||||||
do for domain in $(hestia v-list-web-domains $user | grep $ip | awk '{print $1}')
|
do
|
||||||
do #echo commented out due to command echoing in hestia alias
|
for domain in $(hestia v-list-dns-domains $user | tail +3 | awk '{print $1}')
|
||||||
|
do hestia v-add-remote-dns-domain $user $domain
|
||||||
|
done
|
||||||
|
for domain in $(hestia v-list-mail-domains $user | tail +3 | awk '{print $1}')
|
||||||
|
do hestia v-list-mail-domain-ssl $user $domain | grep -q . || hestia v-add-letsencrypt-domain $user $domain '' yes
|
||||||
|
done
|
||||||
|
for domain in $(hestia v-list-web-domains $user | grep $ip | awk '{print $1}')
|
||||||
|
do #echo commented out due to command echoing in hestia alias
|
||||||
#echo "Checking $user $domain" >&2
|
#echo "Checking $user $domain" >&2
|
||||||
hestia v-list-web-domain $user $domain | grep -q REDIRECT && continue
|
hestia v-list-web-domain $user $domain | grep -q REDIRECT && continue
|
||||||
hestia v-list-mail-domain-ssl $user $domain | grep -q . || hestia v-add-letsencrypt-domain $user $domain '' yes
|
#hestia v-list-mail-domain-ssl $user $domain | grep -q . || hestia v-add-letsencrypt-domain $user $domain '' yes
|
||||||
hestia v-list-web-domain-ssl $user $domain | grep -q . && continue
|
hestia v-list-web-domain-ssl $user $domain | grep -q . && continue
|
||||||
#echo "Generating Certificate" >&2
|
#echo "Generating Certificate" >&2
|
||||||
hestia v-add-letsencrypt-domain $user $domain $(hestia v-list-web-domain $user $domain | grep ALIAS | tr -s ' ' | cut -d' ' -f2- | tr ' ' ',')
|
hestia v-add-letsencrypt-domain $user $domain $(hestia v-list-web-domain $user $domain | grep ALIAS | tr -s ' ' | cut -d' ' -f2- | tr ' ' ',')
|
||||||
|
@ -46,10 +53,13 @@ list() {
|
||||||
|
|
||||||
hestia() {
|
hestia() {
|
||||||
test $# -eq 0 && cd "$HESTIA" && return 0
|
test $# -eq 0 && cd "$HESTIA" && return 0
|
||||||
|
test "$1" = "-x" && shift && set -x
|
||||||
command=$1
|
command=$1
|
||||||
shift
|
shift
|
||||||
echo '>' sudo $(which $command) "$@" >&2
|
echo '>' sudo $(which $command) "$@" >&2
|
||||||
sudo timeout 30s $(which $command) "$@"
|
export SHELLOPTS
|
||||||
|
sudo --preserve-env=SHELLOPTS timeout 30s $(which $command) "$@"
|
||||||
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
accessible() {
|
accessible() {
|
||||||
|
|
|
@ -329,9 +329,9 @@ sshl() {
|
||||||
ssh -G "$1" | grep --silent "^user root$" &&
|
ssh -G "$1" | grep --silent "^user root$" &&
|
||||||
! [[ "$1" =~ "pve.*" ]] &&
|
! [[ "$1" =~ "pve.*" ]] &&
|
||||||
! [[ "$1" =~ "encee.*" ]] &&
|
! [[ "$1" =~ "encee.*" ]] &&
|
||||||
! [[ "$1" =~ ".*ofc.*" ]] &&
|
|
||||||
! [[ "$1" =~ "delta*" ]] &&
|
|
||||||
! [[ "$1" =~ "tmtgw" ]] &&
|
! [[ "$1" =~ "tmtgw" ]] &&
|
||||||
|
! [[ "$1" =~ "delta*" ]] &&
|
||||||
|
! [[ "$1" =~ "nc-*" ]] &&
|
||||||
local pass=pass
|
local pass=pass
|
||||||
test "$all" &&
|
test "$all" &&
|
||||||
find $XDG_CONFIG_HOME/bash/ \( -name aliases.bash -o -name "${1%[0-9a-z]}*.bash" \) -exec cat {} + | $pass ssh "$1" 'cat > .bash_aliases && grep -q .bash_aliases .bashrc || echo "source ~/.bash_aliases" | tee -a .bashrc' &&
|
find $XDG_CONFIG_HOME/bash/ \( -name aliases.bash -o -name "${1%[0-9a-z]}*.bash" \) -exec cat {} + | $pass ssh "$1" 'cat > .bash_aliases && grep -q .bash_aliases .bashrc || echo "source ~/.bash_aliases" | tee -a .bashrc' &&
|
||||||
|
@ -644,12 +644,13 @@ stopswap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
extrac() {
|
extrac() {
|
||||||
|
test "$#" -lt 1 && echo "$0 <archive.vma[.lzo]>..." && return 2
|
||||||
for var; do
|
for var; do
|
||||||
arg=${var%.lzo}
|
arg=${var%.lzo}
|
||||||
out=$(basename ${arg%.vma})
|
out=$(basename ${arg%.vma})
|
||||||
lzop -x $arg.lzo
|
lzop -x $arg.lzo
|
||||||
vma.py $arg $out ||
|
vma.py $arg $out ||
|
||||||
vma.py $(basename $arg) $out &&
|
vma.py $(basename $arg) $out &&
|
||||||
( cd $out && find *.raw -exec qemu-img convert {} -O qcow2 $out-{}.qcow2 \; )
|
( cd $out && find drive-* -exec qemu-img convert {} -O qcow2 $out-{}.qcow2 \; )
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ repos = [
|
||||||
#pull_predefined = false
|
#pull_predefined = false
|
||||||
|
|
||||||
# Arguments to pass Git when pulling Repositories
|
# Arguments to pass Git when pulling Repositories
|
||||||
arguments = "--rebase --autostash --recurse-submodules"
|
pull_arguments = "--rebase --autostash --recurse-submodules"
|
||||||
|
|
||||||
[composer]
|
[composer]
|
||||||
#self_update = false
|
#self_update = false
|
||||||
|
@ -58,7 +58,7 @@ arguments = "--rebase --autostash --recurse-submodules"
|
||||||
|
|
||||||
[linux]
|
[linux]
|
||||||
# Arguments to pass yay when updating packages
|
# Arguments to pass yay when updating packages
|
||||||
yay_arguments = "--nodiffmenu --overwrite '/usr/lib/node_modules/npm/**' --overwrite '/usr/lib/*' --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm --ignore linux --ignore stretchly-xeruf-git"
|
yay_arguments = "--nodiffmenu --overwrite '/usr/lib/node_modules/node-gyp/**' --overwrite '/usr/lib/node_modules/npm/**' --overwrite '/usr/lib/*' --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm --ignore linux --ignore stretchly-xeruf-git"
|
||||||
#trizen_arguments = "--devel"
|
#trizen_arguments = "--devel"
|
||||||
#enable_tlmgr = true
|
#enable_tlmgr = true
|
||||||
#emerge_sync_flags = "-q"
|
#emerge_sync_flags = "-q"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
typeset -A _clean_map
|
typeset -A _clean_map
|
||||||
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
||||||
# TODO .mix - outdated version in socha
|
# TODO .mix - outdated version in socha
|
||||||
_clean_home=(.ant .autopsy .bundle .cargo .cpanm .docker .stack .hex .nix-defexpr .parallel .surf
|
_clean_home=(.ant .autopsy .bundle .cargo .cpanm .docker .stack .hex .nix-defexpr .parallel .surf .pub-cache
|
||||||
#.cache
|
#.cache
|
||||||
.yarn .node_modules .npm .pnpm-store .node-gyp .nv .electron .electron-gyp
|
.yarn .node_modules .npm .pnpm-store .node-gyp .nv .electron .electron-gyp
|
||||||
.gradle .gradle-kotlin-dsl .java .kscript .konan .m2 .openjfx
|
.gradle .gradle-kotlin-dsl .java .kscript .konan .m2 .openjfx
|
||||||
|
|
|
@ -5,8 +5,8 @@ git remote $(case "$(git remote)" in
|
||||||
(*"$remote"*) echo set-url;;
|
(*"$remote"*) echo set-url;;
|
||||||
(*) echo add;;
|
(*) echo add;;
|
||||||
esac) "$remote" "$(git-repo "$@")"
|
esac) "$remote" "$(git-repo "$@")"
|
||||||
git remote -v && git fetch
|
git remote -v && git fetch --all
|
||||||
|
|
||||||
git branch --format='%(refname:short)' | while read branch
|
git branch --format='%(refname:short)' | while read branch
|
||||||
do test $(git branch -a | grep $remote/$branch | wc -l) -gt 0 && git branch -u $remote/$branch $branch
|
do test $(git branch --all | grep "$remote/$branch" | wc -l) -gt 0 && git branch -u "$remote/$branch" "$branch"
|
||||||
done
|
done
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# shows size statistics for subfolders
|
# shows size statistics for subfolders
|
||||||
# max depth is equal to the first argument if it is a number or 1
|
# max depth is equal to the first argument if it is a number or 1
|
||||||
export chars=$(expr $(tput cols) - 60)
|
export chars=$(expr $(tput cols) - 60)
|
||||||
case "$1" in (+*) size=${1#+}; depth=2; shift;; esac
|
case "$1" in (+*) size=${1#+}G; depth=2; shift;; esac
|
||||||
case "$1" in ([0-9]) depth=$1; shift;; esac
|
case "$1" in ([0-9]) depth=$1; shift;; esac
|
||||||
(du --max-depth "${depth:-1}" -xhat ${size:-50}M "$@" | sort -h | grep -v "^0") |
|
(du --max-depth "${depth:-1}" -xhat ${size:-500M} "$@" | sort -h | grep -v "^0") |
|
||||||
while read line; do echo "$(tput smso)$line$(tput rmso) $(pacman -Qqo $(echo $line | awk '{print $2}') 2>/dev/null | paste -s -d',' | sed "s/\(.\{${chars}\}\).*/\1.../")"; done || #| column -t ||
|
while read line; do echo "$(tput smso)$line$(tput rmso) $(pacman -Qqo $(echo $line | awk '{print $2}') 2>/dev/null | paste -s -d',' | sed "s/\(.\{${chars}\}\).*/\1.../")"; done || #| column -t ||
|
||||||
(du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail)
|
(du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail)
|
||||||
|
|
Loading…
Reference in New Issue