From 8d7b4f3a9cc58c4ebbd9cab64c2b1fb4ffe17fbd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 21:56:16 +0200 Subject: [PATCH 002/702] nbdcs --- nbdcs | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 nbdcs diff --git a/nbdcs b/nbdcs new file mode 100755 index 0000000..8e8d088 --- /dev/null +++ b/nbdcs @@ -0,0 +1,84 @@ +#! /usr/bin/env bash +FILE="$(realpath "${BASH_SOURCE[0]}")" +NAME="$(basename "${FILE}")" + +ACTION_OPEN='open' +ACTION_CLOSE='close' + +DATA_DIRECTORY='/data' +CONTAINERS_DIRECTORY="${DATA_DIRECTORY}/containers" + +CONTAINERS_MAP_DIRECTORY='/dev/mapper' +CONTAINERS_MOUNT_DIRECTORY='/media' + +function main { +local action="${1}" +local pass_phrase +local container +local container_name +local container_file +local container_map_file +local container_mount_directory + +case "${action}" in + "${ACTION_OPEN}"|"${ACTION_CLOSE}") + shift + if [ "${1}" ]; then + if [ "${action}" == "${ACTION_OPEN}" ]; then + echo -n 'PassPhrase: ' + read -s pass_phrase + echo + fi + for container in "${@}"; do + echo + case "${container}" in + 'p') container_name='private' ;; + 's') container_name='sensitive' ;; + 'w') container_name='work' ;; + *) container_name="${container}" ;; + esac + container_file="${CONTAINERS_DIRECTORY}/${container_name}" + if [ -f "${container_file}" ]; then + container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}" + container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}" + case "${action}" in + "${ACTION_OPEN}") + echo "${container_file} → ${container_map_file}" + echo "${pass_phrase}" \ + | cryptsetup luksOpen "${container_file}" "${container_name}" + if [ ${?} -eq 0 ]; then + mkdir --parents "${container_mount_directory}" + echo "${container_map_file} → ${container_mount_directory}" + mount "${container_map_file}" "${container_mount_directory}" + fi + ;; + "${ACTION_CLOSE}") + echo "${container_map_file} ← ${container_mount_directory}" + umount "${container_map_file}" + if [ ${?} -eq 0 ]; then + rmdir --ignore-fail-on-non-empty "${container_mount_directory}" + echo "${container_file} ← ${container_map_file}" + cryptsetup luksClose "${container_name}" + fi + ;; + esac + else + echo 'This path does not point to a file!' + fi + done + else + echo 'No container name provided!' + fi + ;; + *) + echo 'Usage:' + echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]" + echo + echo 'p = private' + echo 's = sensitive' + echo 'w = work' + ;; +esac +} + +main "${@}" From e221bf5dfddf03f37d38c7fbb9883e3e6cad7aea Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 21:56:21 +0200 Subject: [PATCH 003/702] remount --- remount | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 remount diff --git a/remount b/remount new file mode 100755 index 0000000..182dc7b --- /dev/null +++ b/remount @@ -0,0 +1,2 @@ +#! /usr/bin/env bash +mount -o remount,rw /usr/lib/live/mount/medium From 3ed56f64536fc927764adbf9cea6bffc667630c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:01:32 +0200 Subject: [PATCH 004/702] bash.bashrc --- bash.bashrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 bash.bashrc diff --git a/bash.bashrc b/bash.bashrc new file mode 100644 index 0000000..e90030d --- /dev/null +++ b/bash.bashrc @@ -0,0 +1,3 @@ +for file in /etc/bash.d/*.sh ; do + source "${file}" +done From 596e9b86c255fbea1267dcf75ba38684f12c60f5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:02:34 +0200 Subject: [PATCH 005/702] bash.d --- bash.d/apt.sh | 23 +++++ bash.d/bash-commands.sh | 5 + bash.d/bash-completion.sh | 5 + bash.d/bash-history.sh | 5 + bash.d/bash-prompt.sh | 15 +++ bash.d/batcat.sh | 1 + bash.d/byobu.sh | 1 + bash.d/chmod.sh | 5 + bash.d/chown.sh | 5 + bash.d/clear.sh | 2 + bash.d/git.sh | 190 ++++++++++++++++++++++++++++++++++++++ bash.d/gnupg.sh | 3 + bash.d/grep.sh | 2 + bash.d/kill.sh | 5 + bash.d/killall.sh | 5 + bash.d/ls.sh | 2 + bash.d/lsblk.sh | 1 + bash.d/micro.sh | 1 + bash.d/mkdir.sh | 5 + bash.d/mount-lxc.sh | 31 +++++++ bash.d/mount.sh | 76 +++++++++++++++ bash.d/newsboat.sh | 1 + bash.d/otpclient-cli.sh | 5 + bash.d/pass.sh | 5 + bash.d/proxy.sh | 8 ++ bash.d/ps.sh | 2 + bash.d/rsync.sh | 8 ++ bash.d/tar.sh | 3 + 28 files changed, 420 insertions(+) create mode 100644 bash.d/apt.sh create mode 100644 bash.d/bash-commands.sh create mode 100644 bash.d/bash-completion.sh create mode 100644 bash.d/bash-history.sh create mode 100644 bash.d/bash-prompt.sh create mode 100644 bash.d/batcat.sh create mode 100644 bash.d/byobu.sh create mode 100644 bash.d/chmod.sh create mode 100644 bash.d/chown.sh create mode 100644 bash.d/clear.sh create mode 100644 bash.d/git.sh create mode 100644 bash.d/gnupg.sh create mode 100644 bash.d/grep.sh create mode 100644 bash.d/kill.sh create mode 100644 bash.d/killall.sh create mode 100644 bash.d/ls.sh create mode 100644 bash.d/lsblk.sh create mode 100644 bash.d/micro.sh create mode 100644 bash.d/mkdir.sh create mode 100644 bash.d/mount-lxc.sh create mode 100644 bash.d/mount.sh create mode 100644 bash.d/newsboat.sh create mode 100644 bash.d/otpclient-cli.sh create mode 100644 bash.d/pass.sh create mode 100644 bash.d/proxy.sh create mode 100644 bash.d/ps.sh create mode 100644 bash.d/rsync.sh create mode 100644 bash.d/tar.sh diff --git a/bash.d/apt.sh b/bash.d/apt.sh new file mode 100644 index 0000000..5de980c --- /dev/null +++ b/bash.d/apt.sh @@ -0,0 +1,23 @@ +# show package information +alias ac='apt-cache show' + +# search package +alias acs='apt-cache search' + +# package versions policy +alias acp='apt-cache policy' + +# update packages catalog +alias agud='apt-get update' + +# upgrade forbidding package installation or removal +alias agug='apt-get upgrade' + +# upgrade allowing package installation or removal +alias agdu='apt-get dist-upgrade' + +# install packages +alias agi='apt-get install' + +# clean packages cache +alias agc='apt-get clean;apt-get autoremove' diff --git a/bash.d/bash-commands.sh b/bash.d/bash-commands.sh new file mode 100644 index 0000000..211a5cf --- /dev/null +++ b/bash.d/bash-commands.sh @@ -0,0 +1,5 @@ +# change current directory to its parent +alias ..='cd ..' + +# exit terminal +alias x='exit' diff --git a/bash.d/bash-completion.sh b/bash.d/bash-completion.sh new file mode 100644 index 0000000..748a2b9 --- /dev/null +++ b/bash.d/bash-completion.sh @@ -0,0 +1,5 @@ +file='/usr/share/bash-completion/bash_completion' + +if [ -f "${file}" ] ; then + source "${file}" +fi diff --git a/bash.d/bash-history.sh b/bash.d/bash-history.sh new file mode 100644 index 0000000..4a47ba3 --- /dev/null +++ b/bash.d/bash-history.sh @@ -0,0 +1,5 @@ +HISTCONTROL='ignorespace' + +HISTSIZE=-1 + +HISTTIMEFORMAT='%Y%m%d %H%M%S ' diff --git a/bash.d/bash-prompt.sh b/bash.d/bash-prompt.sh new file mode 100644 index 0000000..51b193c --- /dev/null +++ b/bash.d/bash-prompt.sh @@ -0,0 +1,15 @@ +PS1="\ +┌ \t\ + – \e[0;31m\${?}\e[0m\ + – \e[0;32m\u\e[0m\ + @ \e[0;33m\h\e[0m\ +" +if [ "$(type -t __git_ps1)" == 'function' ] ; then + PS1="${PS1} –\e[0;35m\$(__git_ps1)\e[0m" +fi +PS1="${PS1} +│\e[0;36m\${PWD}\e[0m +└ " + +PS2="\ +└ " diff --git a/bash.d/batcat.sh b/bash.d/batcat.sh new file mode 100644 index 0000000..abe0b64 --- /dev/null +++ b/bash.d/batcat.sh @@ -0,0 +1 @@ +alias bat='batcat' diff --git a/bash.d/byobu.sh b/bash.d/byobu.sh new file mode 100644 index 0000000..1eb6d63 --- /dev/null +++ b/bash.d/byobu.sh @@ -0,0 +1 @@ +alias bb='byobu' diff --git a/bash.d/chmod.sh b/bash.d/chmod.sh new file mode 100644 index 0000000..357d4dc --- /dev/null +++ b/bash.d/chmod.sh @@ -0,0 +1,5 @@ +# change mode as directory +alias cmd='chmod 755' + +# change mode as file +alias cmf='chmod 644' diff --git a/bash.d/chown.sh b/bash.d/chown.sh new file mode 100644 index 0000000..4beb36d --- /dev/null +++ b/bash.d/chown.sh @@ -0,0 +1,5 @@ +# change owner as root +alias cor='chown 0:0' + +# change owner as user +alias cou='chown 1000:1000' diff --git a/bash.d/clear.sh b/bash.d/clear.sh new file mode 100644 index 0000000..350a925 --- /dev/null +++ b/bash.d/clear.sh @@ -0,0 +1,2 @@ +# clear terminal +alias c='clear' diff --git a/bash.d/git.sh b/bash.d/git.sh new file mode 100644 index 0000000..7417e4c --- /dev/null +++ b/bash.d/git.sh @@ -0,0 +1,190 @@ +# add to index +alias ga='git add' + +# add all to index +alias gaa='git add --all' + +# create a branch +alias gb='git branch' + +# delete a branch +alias gbd='git branch --delete' + +# force a branch deletion +alias gbdf='git branch --delete --force' + +# list branches +alias gbl='git branch --all --list --verbose --verbose' + +# set the link to a remote branch from a local branch +alias gbu='git branch -u' + +# clone a remote repository +alias gc='git clone' + +# clean untracked files +alias gcf='git clean -d --force' + +# index all and commit +alias gacm='git add --all;git commit -m' + +# commit the index +alias gcm='git commit -m' + +# redo the last commit with a different message +alias gcma='git commit --amend -m' + +# make a root commit +alias gcmr='git commit --allow-empty --allow-empty-message -m ""' + +# commit the index and sign +alias gcms='git commit --gpg-sign -m' + +# switch to a branch or checkout file(s) from a commit +alias gco='git checkout' + +# checkout an orphan branch +alias gcoo='git checkout --orphan' + +# checkout development branch +alias gcod='git checkout dev' + +# checkout feature branch +alias gcof='git checkout f' + +# pick a commit +alias gcp='git cherry-pick' + +# abort the commit pick +alias gcpa='git cherry-pick --abort' + +# continue the commit pick +alias gcpc='git cherry-pick --continue' + +# configure the user name +alias gcun='git config user.name' + +# configure the user email +alias gcue='git config user.email' + +# differences from last or between commits +alias gd='git diff' + +# display what is indexed in cache +alias gdc='git diff --cached' + +# indexed character-level differences +alias gdcw='git diff --cached --word-diff-regex=.' + +# differences via external tool +alias gdt='git difftool --dir-diff' + +# character-level differences +alias gdw='git diff --word-diff-regex=.' + +# fetch from the remote repository +alias gf='git fetch --tags --verbose' + +# fetch from remote repository and prune local orphan branches +alias gfp='git fetch --prune --tags --verbose' + +# garbage collect all orphan commits +alias ggc='git reflog expire --expire=now --all;git gc --prune=now' + +# initialize a new repository +alias gi='git init' + +# initialize a new bare repository +alias gib='git init --bare' + +# log commits history +alias gl='git log --all --graph \ +--format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B"' + +# log commits history with patches +alias glp='git log --all --graph \ +--format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" --patch' + +# log medium information +alias glm='git log --all --decorate --graph --pretty=medium' + +# fast-forward to remote branch +alias gmf='git merge --ff-only' + +# do a merge commit +alias gmc='git merge --no-ff -m' + +# abort the current merge commit +alias gma='git merge --abort' + +# squash a branch and index its modifications +alias gms='git merge --squash' + +# merge via external tool +alias gmt='git mergetool' + +# push to the remote repository +alias gp='git push --tags --verbose' + +# delete from the remote repository +alias gpd='git push --delete --verbose' + +# force the push to the remote repository +alias gpf='git push --tags --verbose --force' + +# rebase current branch onto another +alias grb='git rebase' + +# abort current rebase +alias grba='git rebase --abort' + +# continue current rebase +alias grbc='git rebase --continue' + +# force rebase without fast-forward +alias grbf='git rebase --no-ff' + +# rebase interactively +alias grbi='git rebase --interactive' + +# list all remote repositories +alias grm='git remote' + +# add a new remote repository +alias grma='git remote add' + +# list remote repositories +alias grml='git remote --verbose' + +# show a connection to a repository +alias grms='git remote show' + +# set the location of the remote repository +alias grmu='git remote set-url' + +# remove file(s) from index or move current branch pointer +alias grs='git reset' + +# move current branch pointer to the development branch +alias grsd='git reset dev' + +# wipe modifications or reset current branch to another commit +alias grsh='git reset --hard' + +# reset current branch to the development branch +alias grshd='git reset --hard dev' + +# current state of repository +alias gs='git status --untracked-files=all' + +# show a commit +alias gsh='git show' + +# tag a commit +alias gt='git tag' + +# delete a tag +alias gtd='git tag --delete' + +# tag a commit and sign +alias gts='git tag --sign' diff --git a/bash.d/gnupg.sh b/bash.d/gnupg.sh new file mode 100644 index 0000000..715e3ab --- /dev/null +++ b/bash.d/gnupg.sh @@ -0,0 +1,3 @@ +alias gpgoff='gpgconf --kill gpg-agent' + +alias gpgtty='gpg-connect-agent updatestartuptty /bye' diff --git a/bash.d/grep.sh b/bash.d/grep.sh new file mode 100644 index 0000000..6a9c514 --- /dev/null +++ b/bash.d/grep.sh @@ -0,0 +1,2 @@ +# grep from current directory with regex +alias g='grep --directories recurse --line-number --regexp' diff --git a/bash.d/kill.sh b/bash.d/kill.sh new file mode 100644 index 0000000..dbe03d1 --- /dev/null +++ b/bash.d/kill.sh @@ -0,0 +1,5 @@ +# kill a process by id +alias k='kill' + +# force kill a process by id +alias kf='kill -9' diff --git a/bash.d/killall.sh b/bash.d/killall.sh new file mode 100644 index 0000000..76c30a7 --- /dev/null +++ b/bash.d/killall.sh @@ -0,0 +1,5 @@ +# kill all instances of a process by name +alias ka='killall' + +# force kill all instances of a process by name +alias kaf='killall -9' diff --git a/bash.d/ls.sh b/bash.d/ls.sh new file mode 100644 index 0000000..c820fb5 --- /dev/null +++ b/bash.d/ls.sh @@ -0,0 +1,2 @@ +# list current directory entries +alias l='ls --all --color -l -p --time-style="+%Y%m%d-%H%M%S%-:::z"' diff --git a/bash.d/lsblk.sh b/bash.d/lsblk.sh new file mode 100644 index 0000000..fca212a --- /dev/null +++ b/bash.d/lsblk.sh @@ -0,0 +1 @@ +alias lb='lsblk --noempty --output NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS' diff --git a/bash.d/micro.sh b/bash.d/micro.sh new file mode 100644 index 0000000..de78a1d --- /dev/null +++ b/bash.d/micro.sh @@ -0,0 +1 @@ +alias e='micro' diff --git a/bash.d/mkdir.sh b/bash.d/mkdir.sh new file mode 100644 index 0000000..ba8d113 --- /dev/null +++ b/bash.d/mkdir.sh @@ -0,0 +1,5 @@ +# make a directory +alias md='mkdir' + +# make a directory after making its parents +alias mdp='mkdir --parents' diff --git a/bash.d/mount-lxc.sh b/bash.d/mount-lxc.sh new file mode 100644 index 0000000..a0b3ace --- /dev/null +++ b/bash.d/mount-lxc.sh @@ -0,0 +1,31 @@ +function mrc { +local container="${1}" +local f + for f in 'dev' 'dev/pts' 'proc' 'sys' ; do + mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" + done +} + +function crc { +local container="${1}" + shift + chroot "overlay/mount/var/lib/lxc/${container}/squashfs-root" "${@}" +} + +function urc { +local container="${1}" + for f in 'sys' 'proc' 'dev/pts' 'dev' ; do + umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" + done +} + + +function mmc { +local container="${1}" + mount --bind '/deb' "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" +} + +function umc { +local container="${1}" + umount "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" +} diff --git a/bash.d/mount.sh b/bash.d/mount.sh new file mode 100644 index 0000000..4e91b62 --- /dev/null +++ b/bash.d/mount.sh @@ -0,0 +1,76 @@ +alias m='mount' + + +function mo { +local directory="${1}" +local file +if [ "${directory}" ] ; then + directory="$(realpath "${directory}")" + file="${directory}/filesystem.squashfs" + if mkdir 'overlay' ; then + cd 'overlay' + mkdir {lower,upper,work,mount} + if mount "${file}" 'lower' ; then + mount -t 'overlay' 'overlay' 'mount' \ +-o lowerdir='lower',upperdir='upper',workdir='work' + fi + cd .. + fi +else + echo 'KO: directory?' +fi +} + +function uo { +cd 'overlay' +if umount 'mount' ; then + rmdir 'mount' + rm --recursive 'upper' 'work' + if umount 'lower' ; then + rmdir 'lower' + fi +fi +cd .. +rmdir 'overlay' +} + + +function mr { +for f in 'dev' 'dev/pts' 'proc' 'sys' ; do + mount --bind "/${f}" "overlay/mount/${f}" +done +} + +alias cr='chroot overlay/mount' + +function ur { +for f in 'dev/pts' 'dev' 'proc' 'sys' ; do + umount --lazy "overlay/mount/${f}" +done +} + + +function mm { +mount --bind '/deb' 'overlay/mount/deb' +} + +function um { +umount 'overlay/mount/deb' +} + + +function ms { +local directory="${1}" +local level="${2}" +if [ "${directory}" ] ; then + if mkdir "${directory}" ; then + [ "${level}" ] || level='18' + cp overlay/mount/{vmlinuz,initrd.img} "${directory}" + mksquashfs \ +'overlay/mount' "${directory}/filesystem.squashfs" \ +-b '1M' \ +-comp 'zstd' -Xcompression-level "${level}" + chown --recursive 1000:1000 "${directory}" + fi +fi +} diff --git a/bash.d/newsboat.sh b/bash.d/newsboat.sh new file mode 100644 index 0000000..b90f01b --- /dev/null +++ b/bash.d/newsboat.sh @@ -0,0 +1 @@ +alias nb='newsboat' diff --git a/bash.d/otpclient-cli.sh b/bash.d/otpclient-cli.sh new file mode 100644 index 0000000..f2fa2ba --- /dev/null +++ b/bash.d/otpclient-cli.sh @@ -0,0 +1,5 @@ +# display otp code +alias pd='otpclient-cli show -a' + +# list otp accounts +alias pl='otpclient-cli list' diff --git a/bash.d/pass.sh b/bash.d/pass.sh new file mode 100644 index 0000000..f90153e --- /dev/null +++ b/bash.d/pass.sh @@ -0,0 +1,5 @@ +# display pass entry's content +alias p='pass' + +# copy passphrase into clipboard +alias pc='pass --clip' diff --git a/bash.d/proxy.sh b/bash.d/proxy.sh new file mode 100644 index 0000000..a5713ad --- /dev/null +++ b/bash.d/proxy.sh @@ -0,0 +1,8 @@ +function socks { +local value + case "${1}" in + 'on') value='manual' ;; + *) value='none' ;; + esac + gsettings set 'org.gnome.system.proxy' 'mode' "${value}" +} diff --git a/bash.d/ps.sh b/bash.d/ps.sh new file mode 100644 index 0000000..791a664 --- /dev/null +++ b/bash.d/ps.sh @@ -0,0 +1,2 @@ +# look for a string in processes names +alias pg='ps -A | grep' diff --git a/bash.d/rsync.sh b/bash.d/rsync.sh new file mode 100644 index 0000000..ddd35b2 --- /dev/null +++ b/bash.d/rsync.sh @@ -0,0 +1,8 @@ +# synchronize +alias rs='rsync --archive --partial --progress --verbose --no-inc-recursive' + +# synchronize and delete after +alias rsda='rsync --archive --partial --progress --verbose --delete-after' + +# synchronize and delete before +alias rsdb='rsync --archive --partial --progress --verbose --delete-before' diff --git a/bash.d/tar.sh b/bash.d/tar.sh new file mode 100644 index 0000000..2c1f18c --- /dev/null +++ b/bash.d/tar.sh @@ -0,0 +1,3 @@ +alias tc='tar --verbose --create --auto-compress --file' + +alias tx='tar --verbose --extract --file' From a4697a41fa6fc644405395a113b4bbf5d7cfef6f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:09:01 +0200 Subject: [PATCH 006/702] source bash relatively --- bash.bashrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bash.bashrc b/bash.bashrc index e90030d..8fa3fe2 100644 --- a/bash.bashrc +++ b/bash.bashrc @@ -1,3 +1,9 @@ -for file in /etc/bash.d/*.sh ; do +#! /usr/bin/env bash +PATH="$(realpath "${BASH_SOURCE[0]}")" +ROOT="$(dirname "${PATH}")" + +DIRECTORY="${ROOT}/bash.d" + +for file in "${DIRECTORY}"/*.sh ; do source "${file}" done From 247b6a7fed0054f47b1bb7c6afcd788368b99cc7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:10:18 +0200 Subject: [PATCH 007/702] main --- bash.bashrc => bash.d/main.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bash.bashrc => bash.d/main.sh (100%) diff --git a/bash.bashrc b/bash.d/main.sh similarity index 100% rename from bash.bashrc rename to bash.d/main.sh From 98056f2fb62aa0504b540348214ee81220feb15d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:15:40 +0200 Subject: [PATCH 008/702] source directly --- bash.d/main.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bash.d/main.sh b/bash.d/main.sh index 8fa3fe2..732bad3 100644 --- a/bash.d/main.sh +++ b/bash.d/main.sh @@ -2,8 +2,13 @@ PATH="$(realpath "${BASH_SOURCE[0]}")" ROOT="$(dirname "${PATH}")" -DIRECTORY="${ROOT}/bash.d" +function main { +local module + for module in "${ROOT}"/*.sh ; do + if [ "${module}" != "${PATH}" ] ; then + source "${module}" + fi + done +} -for file in "${DIRECTORY}"/*.sh ; do - source "${file}" -done +main From 7bb0eeecf1ad4fff330cbde4c67281f10e92c0db Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:20:42 +0200 Subject: [PATCH 009/702] remount --- bash.d/mount.sh | 3 +++ remount | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) delete mode 100755 remount diff --git a/bash.d/mount.sh b/bash.d/mount.sh index 4e91b62..b33b12c 100644 --- a/bash.d/mount.sh +++ b/bash.d/mount.sh @@ -1,5 +1,8 @@ alias m='mount' +# remount read-only medium in read-write +alias remount='mount -o remount,rw /usr/lib/live/mount/medium' + function mo { local directory="${1}" diff --git a/remount b/remount deleted file mode 100755 index 182dc7b..0000000 --- a/remount +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -mount -o remount,rw /usr/lib/live/mount/medium From 3343762acc890e76ec466d27cd8e68b7cc877c10 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 22:58:36 +0200 Subject: [PATCH 010/702] FILE --- bash.d/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash.d/main.sh b/bash.d/main.sh index 732bad3..71452c3 100644 --- a/bash.d/main.sh +++ b/bash.d/main.sh @@ -1,11 +1,11 @@ #! /usr/bin/env bash -PATH="$(realpath "${BASH_SOURCE[0]}")" -ROOT="$(dirname "${PATH}")" +FILE="$(realpath "${BASH_SOURCE[0]}")" +ROOT="$(dirname "${FILE}")" function main { local module for module in "${ROOT}"/*.sh ; do - if [ "${module}" != "${PATH}" ] ; then + if [ "${module}" != "${FILE}" ] ; then source "${module}" fi done From 06f5191c7c6dd486744103c630294adf457a9459 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 23:25:21 +0200 Subject: [PATCH 011/702] bash --- {bash.d => bash}/apt.sh | 0 {bash.d => bash}/bash-commands.sh | 0 {bash.d => bash}/bash-completion.sh | 0 {bash.d => bash}/bash-history.sh | 0 {bash.d => bash}/bash-prompt.sh | 0 {bash.d => bash}/batcat.sh | 0 {bash.d => bash}/byobu.sh | 0 {bash.d => bash}/chmod.sh | 0 {bash.d => bash}/chown.sh | 0 {bash.d => bash}/clear.sh | 0 {bash.d => bash}/git.sh | 0 {bash.d => bash}/gnupg.sh | 0 {bash.d => bash}/grep.sh | 0 {bash.d => bash}/kill.sh | 0 {bash.d => bash}/killall.sh | 0 {bash.d => bash}/ls.sh | 0 {bash.d => bash}/lsblk.sh | 0 {bash.d => bash}/main.sh | 0 {bash.d => bash}/micro.sh | 0 {bash.d => bash}/mkdir.sh | 0 {bash.d => bash}/mount-lxc.sh | 0 {bash.d => bash}/mount.sh | 0 {bash.d => bash}/newsboat.sh | 0 {bash.d => bash}/otpclient-cli.sh | 0 {bash.d => bash}/pass.sh | 0 {bash.d => bash}/proxy.sh | 0 {bash.d => bash}/ps.sh | 0 {bash.d => bash}/rsync.sh | 0 {bash.d => bash}/tar.sh | 0 29 files changed, 0 insertions(+), 0 deletions(-) rename {bash.d => bash}/apt.sh (100%) rename {bash.d => bash}/bash-commands.sh (100%) rename {bash.d => bash}/bash-completion.sh (100%) rename {bash.d => bash}/bash-history.sh (100%) rename {bash.d => bash}/bash-prompt.sh (100%) rename {bash.d => bash}/batcat.sh (100%) rename {bash.d => bash}/byobu.sh (100%) rename {bash.d => bash}/chmod.sh (100%) rename {bash.d => bash}/chown.sh (100%) rename {bash.d => bash}/clear.sh (100%) rename {bash.d => bash}/git.sh (100%) rename {bash.d => bash}/gnupg.sh (100%) rename {bash.d => bash}/grep.sh (100%) rename {bash.d => bash}/kill.sh (100%) rename {bash.d => bash}/killall.sh (100%) rename {bash.d => bash}/ls.sh (100%) rename {bash.d => bash}/lsblk.sh (100%) rename {bash.d => bash}/main.sh (100%) rename {bash.d => bash}/micro.sh (100%) rename {bash.d => bash}/mkdir.sh (100%) rename {bash.d => bash}/mount-lxc.sh (100%) rename {bash.d => bash}/mount.sh (100%) rename {bash.d => bash}/newsboat.sh (100%) rename {bash.d => bash}/otpclient-cli.sh (100%) rename {bash.d => bash}/pass.sh (100%) rename {bash.d => bash}/proxy.sh (100%) rename {bash.d => bash}/ps.sh (100%) rename {bash.d => bash}/rsync.sh (100%) rename {bash.d => bash}/tar.sh (100%) diff --git a/bash.d/apt.sh b/bash/apt.sh similarity index 100% rename from bash.d/apt.sh rename to bash/apt.sh diff --git a/bash.d/bash-commands.sh b/bash/bash-commands.sh similarity index 100% rename from bash.d/bash-commands.sh rename to bash/bash-commands.sh diff --git a/bash.d/bash-completion.sh b/bash/bash-completion.sh similarity index 100% rename from bash.d/bash-completion.sh rename to bash/bash-completion.sh diff --git a/bash.d/bash-history.sh b/bash/bash-history.sh similarity index 100% rename from bash.d/bash-history.sh rename to bash/bash-history.sh diff --git a/bash.d/bash-prompt.sh b/bash/bash-prompt.sh similarity index 100% rename from bash.d/bash-prompt.sh rename to bash/bash-prompt.sh diff --git a/bash.d/batcat.sh b/bash/batcat.sh similarity index 100% rename from bash.d/batcat.sh rename to bash/batcat.sh diff --git a/bash.d/byobu.sh b/bash/byobu.sh similarity index 100% rename from bash.d/byobu.sh rename to bash/byobu.sh diff --git a/bash.d/chmod.sh b/bash/chmod.sh similarity index 100% rename from bash.d/chmod.sh rename to bash/chmod.sh diff --git a/bash.d/chown.sh b/bash/chown.sh similarity index 100% rename from bash.d/chown.sh rename to bash/chown.sh diff --git a/bash.d/clear.sh b/bash/clear.sh similarity index 100% rename from bash.d/clear.sh rename to bash/clear.sh diff --git a/bash.d/git.sh b/bash/git.sh similarity index 100% rename from bash.d/git.sh rename to bash/git.sh diff --git a/bash.d/gnupg.sh b/bash/gnupg.sh similarity index 100% rename from bash.d/gnupg.sh rename to bash/gnupg.sh diff --git a/bash.d/grep.sh b/bash/grep.sh similarity index 100% rename from bash.d/grep.sh rename to bash/grep.sh diff --git a/bash.d/kill.sh b/bash/kill.sh similarity index 100% rename from bash.d/kill.sh rename to bash/kill.sh diff --git a/bash.d/killall.sh b/bash/killall.sh similarity index 100% rename from bash.d/killall.sh rename to bash/killall.sh diff --git a/bash.d/ls.sh b/bash/ls.sh similarity index 100% rename from bash.d/ls.sh rename to bash/ls.sh diff --git a/bash.d/lsblk.sh b/bash/lsblk.sh similarity index 100% rename from bash.d/lsblk.sh rename to bash/lsblk.sh diff --git a/bash.d/main.sh b/bash/main.sh similarity index 100% rename from bash.d/main.sh rename to bash/main.sh diff --git a/bash.d/micro.sh b/bash/micro.sh similarity index 100% rename from bash.d/micro.sh rename to bash/micro.sh diff --git a/bash.d/mkdir.sh b/bash/mkdir.sh similarity index 100% rename from bash.d/mkdir.sh rename to bash/mkdir.sh diff --git a/bash.d/mount-lxc.sh b/bash/mount-lxc.sh similarity index 100% rename from bash.d/mount-lxc.sh rename to bash/mount-lxc.sh diff --git a/bash.d/mount.sh b/bash/mount.sh similarity index 100% rename from bash.d/mount.sh rename to bash/mount.sh diff --git a/bash.d/newsboat.sh b/bash/newsboat.sh similarity index 100% rename from bash.d/newsboat.sh rename to bash/newsboat.sh diff --git a/bash.d/otpclient-cli.sh b/bash/otpclient-cli.sh similarity index 100% rename from bash.d/otpclient-cli.sh rename to bash/otpclient-cli.sh diff --git a/bash.d/pass.sh b/bash/pass.sh similarity index 100% rename from bash.d/pass.sh rename to bash/pass.sh diff --git a/bash.d/proxy.sh b/bash/proxy.sh similarity index 100% rename from bash.d/proxy.sh rename to bash/proxy.sh diff --git a/bash.d/ps.sh b/bash/ps.sh similarity index 100% rename from bash.d/ps.sh rename to bash/ps.sh diff --git a/bash.d/rsync.sh b/bash/rsync.sh similarity index 100% rename from bash.d/rsync.sh rename to bash/rsync.sh diff --git a/bash.d/tar.sh b/bash/tar.sh similarity index 100% rename from bash.d/tar.sh rename to bash/tar.sh From b52612afeddcc663d09689a91a9daf6be7206ed9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 9 May 2023 23:32:24 +0200 Subject: [PATCH 012/702] gpg/ssh,tty --- bash/gnupg.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash/gnupg.sh b/bash/gnupg.sh index 715e3ab..3d259ef 100644 --- a/bash/gnupg.sh +++ b/bash/gnupg.sh @@ -1,3 +1,6 @@ +export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +gpg-connect-agent updatestartuptty /bye > /dev/null + alias gpgoff='gpgconf --kill gpg-agent' alias gpgtty='gpg-connect-agent updatestartuptty /bye' From 74c01068b4f69149b6a18104e6662cf5f1b8a4e6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 10 May 2023 00:27:50 +0200 Subject: [PATCH 013/702] gnupg/root --- bash/gnupg.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash/gnupg.sh b/bash/gnupg.sh index 3d259ef..ab29be1 100644 --- a/bash/gnupg.sh +++ b/bash/gnupg.sh @@ -1,5 +1,7 @@ -export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" -gpg-connect-agent updatestartuptty /bye > /dev/null +if [ ${EUID} -ne 0 ] ; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + gpg-connect-agent updatestartuptty /bye > /dev/null +fi alias gpgoff='gpgconf --kill gpg-agent' From 7f1ade34d09f544af82c2ff669365ad9a34a9f58 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 10 May 2023 09:45:19 +0200 Subject: [PATCH 014/702] bash/tl --- bash/tar.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/tar.sh b/bash/tar.sh index 2c1f18c..bd36382 100644 --- a/bash/tar.sh +++ b/bash/tar.sh @@ -1,3 +1,5 @@ alias tc='tar --verbose --create --auto-compress --file' +alias tl='tar --verbose --list --file' + alias tx='tar --verbose --extract --file' From dd1ee57228b1bfa5d01982bc2d8149eccd7a5a44 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 12 May 2023 23:38:42 +0200 Subject: [PATCH 015/702] link bashrc --- bash/main.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 71452c3..8996b7e 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,11 +1,17 @@ #! /usr/bin/env bash -FILE="$(realpath "${BASH_SOURCE[0]}")" -ROOT="$(dirname "${FILE}")" +MAIN_FILE="$(realpath "${BASH_SOURCE[0]}")" +MAIN_ROOT="$(dirname "${MAIN_FILE}")" + +function link_bashrc { + local file='/etc/bash.bashrc' + rm --force "${file}" + ln --symbolic "${MAIN_FILE}" "${file}" +} function main { local module - for module in "${ROOT}"/*.sh ; do - if [ "${module}" != "${FILE}" ] ; then + for module in "${MAIN_ROOT}"/*.sh ; do + if [ "${module}" != "${MAIN_FILE}" ] ; then source "${module}" fi done From a4e9584ae193cfdd45ca4e68b8f19a4577fbb78f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 00:49:39 +0200 Subject: [PATCH 016/702] ovh-rescue --- bash/ovh-rescue.sh | 84 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 bash/ovh-rescue.sh diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh new file mode 100644 index 0000000..6f230ca --- /dev/null +++ b/bash/ovh-rescue.sh @@ -0,0 +1,84 @@ +function ovh-rescue-setup { + local release='buster' + local packages=( + 'byobu' 'mosh' + 'file' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'htop' 'iotop' + 'exa' 'ncdu' 'nnn' 'ranger' 'tree' + 'squashfs-tools' + 'uuid-runtime' + ) + local backports=( + 'cryptsetup-bin' + 'git' + 'rsync' + ) + # + echo -n "\ +en_US.UTF-8 UTF-8 +fr_FR.UTF-8 UTF-8 +" > '/etc/locale.gen' + rm --force '/usr/share/locale/locale.alias' + ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' + locale-gen + # + echo -n "\ +Acquire::AllowInsecureRepositories False; +Acquire::AllowWeakRepositories False; +Acquire::AllowDowngradeToInsecureRepositories False; +Acquire::Check-Valid-Until True; +APT::Install-Recommends False; +APT::Install-Suggests False; +APT::Get::Show-Versions True; +Dir::Etc::SourceParts ''; +Dpkg::Progress True; +" > '/etc/apt/apt.conf' + echo -n "\ +deb https://deb.debian.org/debian buster main contrib non-free +deb https://deb.debian.org/debian buster-backports main contrib non-free +deb https://deb.debian.org/debian buster-updates main contrib non-free +deb https://deb.debian.org/debian-security buster/updates main contrib non-free +" > '/etc/apt/sources.list' + # + apt-get update + apt-get update + # + export DEBIAN_FRONTEND='noninteractive' + # + apt-get upgrade --assume-yes + # + apt-get install --assume-yes "${packages[@]}" + apt-get install --assume-yes \ + --target-release "${release}-backports" "${backports[@]}" + # + apt-get clean + # + link_bashrc +} + +function ovh-rescue-upload { +local host="${1}" +if [ "${host}" ] ; then + local user='root' + # + local user_host="${user}@${host}" + # + ssh-keygen -R "${host}" + # + ssh-copy-id \ + -o 'StrictHostKeyChecking=accept-new' \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_ROOT}/" "${user_host}:/etc/bash/" + # call setup + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-setup" + # create session + ssh "${user_host}" -- byobu new-session -d + # attach session + mosh "${user_host}" -- byobu attach-session +else + echo 'Host?' + return 1 +fi +} From 1c05cd488e1e2d657ec1420018cd82ffc31b7aad Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 01:59:08 +0200 Subject: [PATCH 017/702] lbo --- bash/lsblk.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/lsblk.sh b/bash/lsblk.sh index fca212a..42b6442 100644 --- a/bash/lsblk.sh +++ b/bash/lsblk.sh @@ -1 +1,3 @@ alias lb='lsblk --noempty --output NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS' + +alias lbo='lsblk --output NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT' From 7fc49d3dd0a7b0c8cf10c1d88d3c28c7bf1ace5c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:26:42 +0200 Subject: [PATCH 018/702] ovh-rescue-wipe --- bash/ovh-rescue.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 6f230ca..5e943f5 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -82,3 +82,59 @@ else return 1 fi } + +function ovh-rescue-wipe-1-2TB { + local device='/dev/sda' + local unit='mib' + # + echo -n 'WIPE' "${device}" '/?\\ OR CANCEL /!\\' + read + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 + # + parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 + # + parted "${device}" unit "${unit}" mkpart 'esp' 2 259 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" mkpart bios 1 2 + parted "${device}" set 4 bios_grub on + # wipe bios + dd if='/dev/zero' of='/dev/sda4' + # format esp + mkfs.vfat -F 32 -n 'esp' '/dev/sda3' + # format boot + mkfs.ext4 -L 'boot' '/dev/sda2' + # encrypt + cryptsetup \ + --verbose \ + --type luks2 \ + --pbkdf argon2id \ + --cipher aes-xts-plain64 \ + --iter-time 8192 \ + --key-size 512 \ + --hash sha512 \ + --use-random \ + luksFormat \ + '/dev/sda1' + # open + cryptsetup luksOpen '/dev/sda1' 'crypt' + # pv + pvcreate '/dev/mapper/crypt' + # vg + vgcreate 'crypt' '/dev/mapper/crypt' + # lv swap + lvcreate --name 'swap' --size '68719476736b' 'crypt' + # lv data + lvcreate --name 'data' --extents '100%FREE' 'crypt' + # format swap + mkswap --label 'swap' '/dev/mapper/crypt-swap' + # format data + mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' + # vg off + vgchange --activate n 'crypt' + # close + cryptsetup luksClose 'crypt' +} From df61ae9d8076786c2085f6c88d3e7bd708fc549f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:27:29 +0200 Subject: [PATCH 019/702] lshw --- bash/ovh-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 5e943f5..6cb8608 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -2,6 +2,7 @@ function ovh-rescue-setup { local release='buster' local packages=( 'byobu' 'mosh' + 'lshw' 'file' 'grub-efi-amd64-bin' 'grub-pc-bin' 'htop' 'iotop' From e017d1a5b73a9770d6f7bfb11d89d51daf60a0a5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:41:10 +0200 Subject: [PATCH 020/702] parted,mdadm,lvm2,lsof --- bash/ovh-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 6cb8608..62cb0fc 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -2,10 +2,11 @@ function ovh-rescue-setup { local release='buster' local packages=( 'byobu' 'mosh' + 'parted' 'mdadm' 'lvm2' 'lshw' 'file' 'grub-efi-amd64-bin' 'grub-pc-bin' - 'htop' 'iotop' + 'htop' 'iotop' 'lsof' 'exa' 'ncdu' 'nnn' 'ranger' 'tree' 'squashfs-tools' 'uuid-runtime' From 76f16debb159a13e757f3082461ca7397a335f51 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:54:16 +0200 Subject: [PATCH 021/702] install --- bash/ovh-rescue.sh | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 62cb0fc..15142b7 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,21 +1,4 @@ function ovh-rescue-setup { - local release='buster' - local packages=( - 'byobu' 'mosh' - 'parted' 'mdadm' 'lvm2' - 'lshw' - 'file' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'htop' 'iotop' 'lsof' - 'exa' 'ncdu' 'nnn' 'ranger' 'tree' - 'squashfs-tools' - 'uuid-runtime' - ) - local backports=( - 'cryptsetup-bin' - 'git' - 'rsync' - ) # echo -n "\ en_US.UTF-8 UTF-8 @@ -42,9 +25,28 @@ deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free " > '/etc/apt/sources.list' +} + +function ovh-rescue-install { + local release='buster' + local packages=( + 'byobu' 'mosh' + 'parted' 'mdadm' 'lvm2' + 'lshw' + 'file' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'htop' 'iotop' 'lsof' + 'exa' 'ncdu' 'nnn' 'ranger' 'tree' + 'squashfs-tools' + 'uuid-runtime' + ) + local backports=( + 'cryptsetup-bin' + 'git' + 'rsync' + ) # apt-get update - apt-get update # export DEBIAN_FRONTEND='noninteractive' # From 0d11ca4ee423d28cccd07f81a013d04c0dcb7e3a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:56:03 +0200 Subject: [PATCH 022/702] setup link --- bash/ovh-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 15142b7..526d33d 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -25,6 +25,8 @@ deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free " > '/etc/apt/sources.list' + # + link_bashrc } function ovh-rescue-install { @@ -57,8 +59,6 @@ function ovh-rescue-install { --target-release "${release}-backports" "${backports[@]}" # apt-get clean - # - link_bashrc } function ovh-rescue-upload { From b5c4c51cedbbe6a06085af3112cb31cf85d622ba Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 02:59:00 +0200 Subject: [PATCH 023/702] hostname --- bash/ovh-rescue.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 526d33d..8823ba1 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,4 +1,6 @@ function ovh-rescue-setup { + # + echo -n 'ovh' > '/etc/hostname' # echo -n "\ en_US.UTF-8 UTF-8 From 6786a4ea2f2e2001fb35fa6ab1ee2ca34a5a4401 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:05:57 +0200 Subject: [PATCH 024/702] comment,rejigger --- bash/ovh-rescue.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 8823ba1..c374972 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,15 +1,5 @@ function ovh-rescue-setup { - # - echo -n 'ovh' > '/etc/hostname' - # - echo -n "\ -en_US.UTF-8 UTF-8 -fr_FR.UTF-8 UTF-8 -" > '/etc/locale.gen' - rm --force '/usr/share/locale/locale.alias' - ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' - locale-gen - # + # apt / conf echo -n "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; @@ -21,14 +11,27 @@ APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; " > '/etc/apt/apt.conf' + # apt / sources echo -n "\ deb https://deb.debian.org/debian buster main contrib non-free deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free " > '/etc/apt/sources.list' - # + # bash / rc link_bashrc + # host name + echo -n 'ovh' > '/etc/hostname' + # locales + echo -n "\ +en_US.UTF-8 UTF-8 +fr_FR.UTF-8 UTF-8 +" > '/etc/locale.gen' + # fix alias + rm --force '/usr/share/locale/locale.alias' + ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' + # generate locales + locale-gen } function ovh-rescue-install { @@ -49,17 +52,18 @@ function ovh-rescue-install { 'git' 'rsync' ) - # + # update catalog apt-get update # export DEBIAN_FRONTEND='noninteractive' - # + # upgrade packages apt-get upgrade --assume-yes - # + # install packages apt-get install --assume-yes "${packages[@]}" + # install backports apt-get install --assume-yes \ --target-release "${release}-backports" "${backports[@]}" - # + # clean cache apt-get clean } @@ -69,9 +73,9 @@ if [ "${host}" ] ; then local user='root' # local user_host="${user}@${host}" - # + # remove fingerprints ssh-keygen -R "${host}" - # + # copy ssh id ssh-copy-id \ -o 'StrictHostKeyChecking=accept-new' \ "${user_host}" From 7354deeee2f69673e0066e5687c2e2ca4a93a7f6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:06:40 +0200 Subject: [PATCH 025/702] bbl --- bash/byobu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/byobu.sh b/bash/byobu.sh index 1eb6d63..5adf843 100644 --- a/bash/byobu.sh +++ b/bash/byobu.sh @@ -1 +1,3 @@ alias bb='byobu' + +alias bbl='byobu ls' From 1f75f16a73a8264baa28d38f010dc75d35462464 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:08:07 +0200 Subject: [PATCH 026/702] bba,bbn --- bash/byobu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bash/byobu.sh b/bash/byobu.sh index 5adf843..fd5e98d 100644 --- a/bash/byobu.sh +++ b/bash/byobu.sh @@ -1,3 +1,7 @@ alias bb='byobu' +alias bba='byobu attach-session' + alias bbl='byobu ls' + +alias bbn='byobu new-session -d' From 9166e6ff45808e659112104b28aae4a0a07c2c4c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:18:59 +0200 Subject: [PATCH 027/702] passphrase --- bash/ovh-rescue.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index c374972..839aee5 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -97,7 +97,7 @@ function ovh-rescue-wipe-1-2TB { local device='/dev/sda' local unit='mib' # - echo -n 'WIPE' "${device}" '/?\\ OR CANCEL /!\\' + echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' read # parted "${device}" --script mktable gpt @@ -117,20 +117,26 @@ function ovh-rescue-wipe-1-2TB { mkfs.vfat -F 32 -n 'esp' '/dev/sda3' # format boot mkfs.ext4 -L 'boot' '/dev/sda2' + # read passphrase + local passphrase + read passphrase # encrypt - cryptsetup \ + echo "${passphrase}" \ + | cryptsetup \ --verbose \ - --type luks2 \ - --pbkdf argon2id \ - --cipher aes-xts-plain64 \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ --iter-time 8192 \ --key-size 512 \ - --hash sha512 \ + --hash 'sha512' \ --use-random \ luksFormat \ '/dev/sda1' # open - cryptsetup luksOpen '/dev/sda1' 'crypt' + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/sda1' 'crypt' # pv pvcreate '/dev/mapper/crypt' # vg From b7b590a97cc04a5a8d110f26751def843906328e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:21:41 +0200 Subject: [PATCH 028/702] read secret --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 839aee5..d660119 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -119,7 +119,7 @@ function ovh-rescue-wipe-1-2TB { mkfs.ext4 -L 'boot' '/dev/sda2' # read passphrase local passphrase - read passphrase + read -s passphrase # encrypt echo "${passphrase}" \ | cryptsetup \ From 65f9d3b249cb84243a63793bdbe909e6e1959d49 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:23:05 +0200 Subject: [PATCH 029/702] read raw --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index d660119..0209661 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -119,7 +119,7 @@ function ovh-rescue-wipe-1-2TB { mkfs.ext4 -L 'boot' '/dev/sda2' # read passphrase local passphrase - read -s passphrase + read -r -s passphrase # encrypt echo "${passphrase}" \ | cryptsetup \ From 63bb37330a686a902fedb67a7fa053b072fd8fdd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:28:08 +0200 Subject: [PATCH 030/702] wipe-lsblk,hostname --- bash/ovh-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 0209661..96ecea3 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -21,7 +21,7 @@ deb https://deb.debian.org/debian-security buster/updates main contrib non-free # bash / rc link_bashrc # host name - echo -n 'ovh' > '/etc/hostname' + echo 'ovh' > '/etc/hostname' # locales echo -n "\ en_US.UTF-8 UTF-8 @@ -97,6 +97,7 @@ function ovh-rescue-wipe-1-2TB { local device='/dev/sda' local unit='mib' # + lsblk echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' read # From c301758e1ca4878a1d6bc7aadb3a18b0e2263b11 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:36:05 +0200 Subject: [PATCH 031/702] read prompt --- bash/ovh-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 96ecea3..771e940 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -120,6 +120,7 @@ function ovh-rescue-wipe-1-2TB { mkfs.ext4 -L 'boot' '/dev/sda2' # read passphrase local passphrase + echo -n 'PassPhrase: ' read -r -s passphrase # encrypt echo "${passphrase}" \ From e017ce2785444cd9535bc4d1f82c39590129cd78 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:42:00 +0200 Subject: [PATCH 032/702] force format boot --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 771e940..e53ab66 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -117,7 +117,7 @@ function ovh-rescue-wipe-1-2TB { # format esp mkfs.vfat -F 32 -n 'esp' '/dev/sda3' # format boot - mkfs.ext4 -L 'boot' '/dev/sda2' + mkfs.ext4 -F -L 'boot' '/dev/sda2' # read passphrase local passphrase echo -n 'PassPhrase: ' From 9cfd4aa88929a2bc336f9cd5d7935ef1ff31a33a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 03:44:57 +0200 Subject: [PATCH 033/702] hostname --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index e53ab66..d99e2e4 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -21,7 +21,7 @@ deb https://deb.debian.org/debian-security buster/updates main contrib non-free # bash / rc link_bashrc # host name - echo 'ovh' > '/etc/hostname' + hostname 'ovh' # locales echo -n "\ en_US.UTF-8 UTF-8 From 76d233d4f7727dccf8ee0a7024c14e9bb9069428 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 04:08:37 +0200 Subject: [PATCH 034/702] byobu,mosh --- bash/ovh-rescue.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index d99e2e4..9b2efd5 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,4 +1,7 @@ function ovh-rescue-setup { + local packages=( + 'byobu' 'mosh' + ) # apt / conf echo -n "\ Acquire::AllowInsecureRepositories False; @@ -32,13 +35,18 @@ fr_FR.UTF-8 UTF-8 ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' # generate locales locale-gen + # update catalog + apt-get update + # install packages + apt-get install --assume-yes "${packages[@]}" } function ovh-rescue-install { local release='buster' local packages=( - 'byobu' 'mosh' + # installed 'parted' 'mdadm' 'lvm2' + # install 'lshw' 'file' 'grub-efi-amd64-bin' 'grub-pc-bin' @@ -48,9 +56,10 @@ function ovh-rescue-install { 'uuid-runtime' ) local backports=( - 'cryptsetup-bin' + # installed + 'cryptsetup-bin' 'rsync' + # install 'git' - 'rsync' ) # update catalog apt-get update From f4f5eb31c99c2764d94c05d98b0b215a7f2bd145 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 13 May 2023 11:30:41 +0200 Subject: [PATCH 035/702] send keys to install --- bash/ovh-rescue.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 9b2efd5..0e5c909 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -94,6 +94,8 @@ if [ "${host}" ] ; then ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-setup" # create session ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys 'ovh-rescue-install' 'C-m' # attach session mosh "${user_host}" -- byobu attach-session else From b14f4c2f27f6f7cbdccd46a101277f51d9613e4d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 11:46:49 +0200 Subject: [PATCH 036/702] readme --- readme.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 readme.md diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..8a581a0 --- /dev/null +++ b/readme.md @@ -0,0 +1,2 @@ +* [ ] log +* [ ] apt-file search | grep From 515d64bc2ace6029fd368ae3884492fb77dcd270 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 11:48:35 +0200 Subject: [PATCH 037/702] debian/frontend --- bash/debian.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 bash/debian.sh diff --git a/bash/debian.sh b/bash/debian.sh new file mode 100644 index 0000000..acf628d --- /dev/null +++ b/bash/debian.sh @@ -0,0 +1,3 @@ +function debian_disable_frontend { + export DEBIAN_FRONTEND='noninteractive' +} From b9949d107cc830ef41195cce7430a786f8dff4a0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 11:51:45 +0200 Subject: [PATCH 038/702] debian disable frontend --- bash/ovh-rescue.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 0e5c909..faed2e1 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -37,6 +37,8 @@ fr_FR.UTF-8 UTF-8 locale-gen # update catalog apt-get update + # + debian_disable_frontend # install packages apt-get install --assume-yes "${packages[@]}" } @@ -64,7 +66,7 @@ function ovh-rescue-install { # update catalog apt-get update # - export DEBIAN_FRONTEND='noninteractive' + debian_disable_frontend # upgrade packages apt-get upgrade --assume-yes # install packages From 07961df4c9f3dad230a34decaa6b885b64de7bfc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 11:55:08 +0200 Subject: [PATCH 039/702] todo --- bash/ovh-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index faed2e1..68b8d23 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -93,6 +93,7 @@ if [ "${host}" ] ; then # upload root rsync --delete --recursive "${MAIN_ROOT}/" "${user_host}:/etc/bash/" # call setup + # TODO variable ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-setup" # create session ssh "${user_host}" -- byobu new-session -d From 45127eab10a86bde7f7ca08f3215874851213f1d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 12:07:22 +0200 Subject: [PATCH 040/702] readme --- readme.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8a581a0..2888584 100644 --- a/readme.md +++ b/readme.md @@ -1,2 +1,10 @@ +# Public + +## ToDo + +* [ ] no alias * [ ] log -* [ ] apt-file search | grep +* [ ] ovh + * [ ] clean apt cache after each install/upgrade step +* [ ] apt + * [ ] apt-file search | grep From e25bf7bbfb89a27f712cfe7d6e2a063feed3a8aa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 13:33:51 +0200 Subject: [PATCH 041/702] l --- bash/ls.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/ls.sh b/bash/ls.sh index c820fb5..f9a65e5 100644 --- a/bash/ls.sh +++ b/bash/ls.sh @@ -1,2 +1,9 @@ -# list current directory entries -alias l='ls --all --color -l -p --time-style="+%Y%m%d-%H%M%S%-:::z"' +# list current directory's entries +alias l="\ +ls \ +--all \ +--color \ +-l \ +-p \ +--time-style \"+%Y%m%d-%H%M%S%-:::z\" \ +" From 248bbae91bf053ba12cd4f7febfd6cd7a910f47a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 13:45:02 +0200 Subject: [PATCH 042/702] lsblk --- bash/lsblk.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bash/lsblk.sh b/bash/lsblk.sh index 42b6442..7ae874a 100644 --- a/bash/lsblk.sh +++ b/bash/lsblk.sh @@ -1,3 +1,12 @@ -alias lb='lsblk --noempty --output NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS' +# list block devices +alias lb="\ +lsblk \ +--output \"NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS\" \ +--noempty \ +" -alias lbo='lsblk --output NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT' +# list block devices (old) +alias lbo="\ +lsblk \ +--output \"NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT\" \ +" From b07230a6a17d880061e74eca4beea94dc4765cb8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 13:57:53 +0200 Subject: [PATCH 043/702] recursive --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 2888584..1e8a316 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ ## ToDo -* [ ] no alias +* [ ] import modules recursively * [ ] log * [ ] ovh * [ ] clean apt cache after each install/upgrade step From 1f44f63093ebe76a755b783807cdba36c5733a1c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 13:59:46 +0200 Subject: [PATCH 044/702] import modules --- bash/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 8996b7e..c8d6e1e 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -8,7 +8,7 @@ function link_bashrc { ln --symbolic "${MAIN_FILE}" "${file}" } -function main { +function main_import_modules { local module for module in "${MAIN_ROOT}"/*.sh ; do if [ "${module}" != "${MAIN_FILE}" ] ; then @@ -17,4 +17,4 @@ local module done } -main +main_import_modules From 6818171cbc6707e104e8568abf18a9aff46f9cbc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 14:01:41 +0200 Subject: [PATCH 045/702] bash/commands,completion,history,prompt --- bash/{bash-commands.sh => bash/commands.sh} | 0 bash/{bash-completion.sh => bash/completion.sh} | 0 bash/{bash-history.sh => bash/history.sh} | 0 bash/{bash-prompt.sh => bash/prompt.sh} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename bash/{bash-commands.sh => bash/commands.sh} (100%) rename bash/{bash-completion.sh => bash/completion.sh} (100%) rename bash/{bash-history.sh => bash/history.sh} (100%) rename bash/{bash-prompt.sh => bash/prompt.sh} (100%) diff --git a/bash/bash-commands.sh b/bash/bash/commands.sh similarity index 100% rename from bash/bash-commands.sh rename to bash/bash/commands.sh diff --git a/bash/bash-completion.sh b/bash/bash/completion.sh similarity index 100% rename from bash/bash-completion.sh rename to bash/bash/completion.sh diff --git a/bash/bash-history.sh b/bash/bash/history.sh similarity index 100% rename from bash/bash-history.sh rename to bash/bash/history.sh diff --git a/bash/bash-prompt.sh b/bash/bash/prompt.sh similarity index 100% rename from bash/bash-prompt.sh rename to bash/bash/prompt.sh From 5433ef186ae6c6559c44000364279af845f288b1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 14:46:23 +0200 Subject: [PATCH 046/702] modules --- bash/main.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index c8d6e1e..d858f6d 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -8,13 +8,19 @@ function link_bashrc { ln --symbolic "${MAIN_FILE}" "${file}" } +# import modules function main_import_modules { -local module - for module in "${MAIN_ROOT}"/*.sh ; do + local IFS=$'\n' + local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh')) + local module + for module in "${modules[@]}" ; do if [ "${module}" != "${MAIN_FILE}" ] ; then + echo + echo "${module}" source "${module}" fi done } +# import modules main_import_modules From 2520fbee34b80b4576f2f42375cacd75eea9bab9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 15:51:38 +0200 Subject: [PATCH 047/702] log --- bash/log.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bash/log.sh diff --git a/bash/log.sh b/bash/log.sh new file mode 100644 index 0000000..1e699b3 --- /dev/null +++ b/bash/log.sh @@ -0,0 +1,20 @@ +LOG_LEVEL_FATAL=0 +LOG_LEVEL_ERROR=1 +LOG_LEVEL_WARN=2 +LOG_LEVEL_INFO=3 +LOG_LEVEL_DEBUG=4 +LOG_LEVEL_TRACE=5 + +LOG_LEVEL=${LOG_LEVEL_WARNING} + +function log_fatal { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_FATAL} ] && echo "${@}" ; } + +function log_error { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_ERROR} ] && echo "${@}" ; } + +function log_warn { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_WARN} ] && echo "${@}" ; } + +function log_info { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_INFO} ] && echo "${@}" ; } + +function log_debug { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_DEBUG} ] && echo "${@}" ; } + +function log_trace { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_TRACE} ] && echo "${@}" ; } From 4ce6077f236e48c0ca1937b2be9f33e18eb20bc0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:00:34 +0200 Subject: [PATCH 048/702] alias --- bash/{ => alias}/apt.sh | 0 bash/{ => alias}/batcat.sh | 0 bash/{ => alias}/byobu.sh | 0 bash/{ => alias}/chmod.sh | 0 bash/{ => alias}/chown.sh | 0 bash/{ => alias}/clear.sh | 0 bash/{ => alias}/git.sh | 0 bash/{ => alias}/grep.sh | 0 bash/{ => alias}/kill.sh | 0 bash/{ => alias}/killall.sh | 0 bash/{ => alias}/ls.sh | 0 bash/{ => alias}/lsblk.sh | 0 bash/{ => alias}/micro.sh | 0 bash/{ => alias}/mkdir.sh | 0 bash/{ => alias}/newsboat.sh | 0 bash/{ => alias}/otpclient-cli.sh | 0 bash/{ => alias}/pass.sh | 0 bash/{ => alias}/ps.sh | 0 bash/{ => alias}/rsync.sh | 0 bash/{ => alias}/tar.sh | 0 20 files changed, 0 insertions(+), 0 deletions(-) rename bash/{ => alias}/apt.sh (100%) rename bash/{ => alias}/batcat.sh (100%) rename bash/{ => alias}/byobu.sh (100%) rename bash/{ => alias}/chmod.sh (100%) rename bash/{ => alias}/chown.sh (100%) rename bash/{ => alias}/clear.sh (100%) rename bash/{ => alias}/git.sh (100%) rename bash/{ => alias}/grep.sh (100%) rename bash/{ => alias}/kill.sh (100%) rename bash/{ => alias}/killall.sh (100%) rename bash/{ => alias}/ls.sh (100%) rename bash/{ => alias}/lsblk.sh (100%) rename bash/{ => alias}/micro.sh (100%) rename bash/{ => alias}/mkdir.sh (100%) rename bash/{ => alias}/newsboat.sh (100%) rename bash/{ => alias}/otpclient-cli.sh (100%) rename bash/{ => alias}/pass.sh (100%) rename bash/{ => alias}/ps.sh (100%) rename bash/{ => alias}/rsync.sh (100%) rename bash/{ => alias}/tar.sh (100%) diff --git a/bash/apt.sh b/bash/alias/apt.sh similarity index 100% rename from bash/apt.sh rename to bash/alias/apt.sh diff --git a/bash/batcat.sh b/bash/alias/batcat.sh similarity index 100% rename from bash/batcat.sh rename to bash/alias/batcat.sh diff --git a/bash/byobu.sh b/bash/alias/byobu.sh similarity index 100% rename from bash/byobu.sh rename to bash/alias/byobu.sh diff --git a/bash/chmod.sh b/bash/alias/chmod.sh similarity index 100% rename from bash/chmod.sh rename to bash/alias/chmod.sh diff --git a/bash/chown.sh b/bash/alias/chown.sh similarity index 100% rename from bash/chown.sh rename to bash/alias/chown.sh diff --git a/bash/clear.sh b/bash/alias/clear.sh similarity index 100% rename from bash/clear.sh rename to bash/alias/clear.sh diff --git a/bash/git.sh b/bash/alias/git.sh similarity index 100% rename from bash/git.sh rename to bash/alias/git.sh diff --git a/bash/grep.sh b/bash/alias/grep.sh similarity index 100% rename from bash/grep.sh rename to bash/alias/grep.sh diff --git a/bash/kill.sh b/bash/alias/kill.sh similarity index 100% rename from bash/kill.sh rename to bash/alias/kill.sh diff --git a/bash/killall.sh b/bash/alias/killall.sh similarity index 100% rename from bash/killall.sh rename to bash/alias/killall.sh diff --git a/bash/ls.sh b/bash/alias/ls.sh similarity index 100% rename from bash/ls.sh rename to bash/alias/ls.sh diff --git a/bash/lsblk.sh b/bash/alias/lsblk.sh similarity index 100% rename from bash/lsblk.sh rename to bash/alias/lsblk.sh diff --git a/bash/micro.sh b/bash/alias/micro.sh similarity index 100% rename from bash/micro.sh rename to bash/alias/micro.sh diff --git a/bash/mkdir.sh b/bash/alias/mkdir.sh similarity index 100% rename from bash/mkdir.sh rename to bash/alias/mkdir.sh diff --git a/bash/newsboat.sh b/bash/alias/newsboat.sh similarity index 100% rename from bash/newsboat.sh rename to bash/alias/newsboat.sh diff --git a/bash/otpclient-cli.sh b/bash/alias/otpclient-cli.sh similarity index 100% rename from bash/otpclient-cli.sh rename to bash/alias/otpclient-cli.sh diff --git a/bash/pass.sh b/bash/alias/pass.sh similarity index 100% rename from bash/pass.sh rename to bash/alias/pass.sh diff --git a/bash/ps.sh b/bash/alias/ps.sh similarity index 100% rename from bash/ps.sh rename to bash/alias/ps.sh diff --git a/bash/rsync.sh b/bash/alias/rsync.sh similarity index 100% rename from bash/rsync.sh rename to bash/alias/rsync.sh diff --git a/bash/tar.sh b/bash/alias/tar.sh similarity index 100% rename from bash/tar.sh rename to bash/alias/tar.sh From b5761c429bd438d48809adc78f9a85197195136a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:01:12 +0200 Subject: [PATCH 049/702] alias/bash --- bash/{bash/commands.sh => alias/bash.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename bash/{bash/commands.sh => alias/bash.sh} (100%) diff --git a/bash/bash/commands.sh b/bash/alias/bash.sh similarity index 100% rename from bash/bash/commands.sh rename to bash/alias/bash.sh From 22077fad31f1751003a967f6f4f4d8b2184abb97 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:06:24 +0200 Subject: [PATCH 050/702] tar --- bash/alias/tar.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bash/alias/tar.sh b/bash/alias/tar.sh index bd36382..74b5020 100644 --- a/bash/alias/tar.sh +++ b/bash/alias/tar.sh @@ -1,5 +1,21 @@ -alias tc='tar --verbose --create --auto-compress --file' +alias tc="\ +tar \ +--verbose \ +--create \ +--auto-compress \ +--file \ +" -alias tl='tar --verbose --list --file' +alias tl="\ +tar \ +--verbose \ +--list \ +--file \ +" -alias tx='tar --verbose --extract --file' +alias tx="\ +tar \ +--verbose \ +--extract \ +--file \ +" From 4930c7bd044ccf6cfb52c7830cb3006d8faa3650 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:09:23 +0200 Subject: [PATCH 051/702] rsync --- bash/alias/rsync.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/bash/alias/rsync.sh b/bash/alias/rsync.sh index ddd35b2..7c08c91 100644 --- a/bash/alias/rsync.sh +++ b/bash/alias/rsync.sh @@ -1,8 +1,29 @@ # synchronize -alias rs='rsync --archive --partial --progress --verbose --no-inc-recursive' +alias rs="\ +rsync \ +--archive \ +--partial \ +--progress \ +--verbose \ +--no-inc-recursive \ +" # synchronize and delete after -alias rsda='rsync --archive --partial --progress --verbose --delete-after' +alias rsda="\ +rsync \ +--archive \ +--partial \ +--progress \ +--verbose \ +--delete-after \ +" # synchronize and delete before -alias rsdb='rsync --archive --partial --progress --verbose --delete-before' +alias rsdb="\ +rsync \ +--archive \ +--partial \ +--progress \ +--verbose \ +--delete-before \ +" From cfc99b0cd74aa8f8d3ab0b8963b14cc7d7c9f3c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:10:49 +0200 Subject: [PATCH 052/702] ps --- bash/alias/ps.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bash/alias/ps.sh b/bash/alias/ps.sh index 791a664..093944c 100644 --- a/bash/alias/ps.sh +++ b/bash/alias/ps.sh @@ -1,2 +1,5 @@ # look for a string in processes names -alias pg='ps -A | grep' +alias pg="\ +ps -A \ +| grep \ +" From f271a456fd6ba234cd40f3633b87439d17072f44 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:11:50 +0200 Subject: [PATCH 053/702] pass --- bash/alias/pass.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bash/alias/pass.sh b/bash/alias/pass.sh index f90153e..f01c653 100644 --- a/bash/alias/pass.sh +++ b/bash/alias/pass.sh @@ -1,5 +1,10 @@ # display pass entry's content -alias p='pass' +alias p="\ +pass \ +" # copy passphrase into clipboard -alias pc='pass --clip' +alias pc="\ +pass \ +--clip \ +" From 39f7ca123d0167ef8486a0e5aa442ddefc553324 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:17:53 +0200 Subject: [PATCH 054/702] otpclient-cli --- bash/alias/otpclient-cli.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/alias/otpclient-cli.sh b/bash/alias/otpclient-cli.sh index f2fa2ba..163fb1d 100644 --- a/bash/alias/otpclient-cli.sh +++ b/bash/alias/otpclient-cli.sh @@ -1,5 +1,12 @@ # display otp code -alias pd='otpclient-cli show -a' +alias pd="\ +otpclient-cli \ +show \ +--account \ +" # list otp accounts -alias pl='otpclient-cli list' +alias pl="\ +otpclient-cli \ +list \ +" From 5d07b3c14ad2f8260c5e7da296d93d431cab0ccb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:18:31 +0200 Subject: [PATCH 055/702] newsboat --- bash/alias/newsboat.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/alias/newsboat.sh b/bash/alias/newsboat.sh index b90f01b..971ad9d 100644 --- a/bash/alias/newsboat.sh +++ b/bash/alias/newsboat.sh @@ -1 +1,3 @@ -alias nb='newsboat' +alias nb="\ +newsboat \ +" From 038ee0cbf33900388a9992f140d1d875852e7910 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:19:10 +0200 Subject: [PATCH 056/702] mkdir --- bash/alias/mkdir.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bash/alias/mkdir.sh b/bash/alias/mkdir.sh index ba8d113..52745dd 100644 --- a/bash/alias/mkdir.sh +++ b/bash/alias/mkdir.sh @@ -1,5 +1,10 @@ # make a directory -alias md='mkdir' +alias md="\ +mkdir \ +" # make a directory after making its parents -alias mdp='mkdir --parents' +alias mdp="\ +mkdir \ +--parents \ +" From e6089c162451555f52dd26627936ea5402107d41 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:19:33 +0200 Subject: [PATCH 057/702] micro --- bash/alias/micro.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/alias/micro.sh b/bash/alias/micro.sh index de78a1d..97d7174 100644 --- a/bash/alias/micro.sh +++ b/bash/alias/micro.sh @@ -1 +1,3 @@ -alias e='micro' +alias e="\ +micro \ +" From e26343e222677bc668c794462c82d686d0706b05 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:24:24 +0200 Subject: [PATCH 058/702] ovh/micro --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 68b8d23..ecc2115 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -50,7 +50,7 @@ function ovh-rescue-install { 'parted' 'mdadm' 'lvm2' # install 'lshw' - 'file' + 'file' 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' 'htop' 'iotop' 'lsof' 'exa' 'ncdu' 'nnn' 'ranger' 'tree' From 69d9784679113b9178466d45847e321adcaa3da7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:26:24 +0200 Subject: [PATCH 059/702] kill,killall --- bash/alias/kill.sh | 9 +++++++-- bash/alias/killall.sh | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bash/alias/kill.sh b/bash/alias/kill.sh index dbe03d1..970352d 100644 --- a/bash/alias/kill.sh +++ b/bash/alias/kill.sh @@ -1,5 +1,10 @@ # kill a process by id -alias k='kill' +alias k="\ +kill \ +" # force kill a process by id -alias kf='kill -9' +alias kf="\ +kill \ +-9 \ +" diff --git a/bash/alias/killall.sh b/bash/alias/killall.sh index 76c30a7..43c4cbe 100644 --- a/bash/alias/killall.sh +++ b/bash/alias/killall.sh @@ -1,5 +1,10 @@ # kill all instances of a process by name -alias ka='killall' +alias ka="\ +killall \ +" # force kill all instances of a process by name -alias kaf='killall -9' +alias kaf="\ +killall \ +-9 \ +" From b541f2021d730dc329acf92e05f6d18968e5f1be Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:28:45 +0200 Subject: [PATCH 060/702] grep --- bash/alias/grep.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bash/alias/grep.sh b/bash/alias/grep.sh index 6a9c514..73179dd 100644 --- a/bash/alias/grep.sh +++ b/bash/alias/grep.sh @@ -1,2 +1,7 @@ # grep from current directory with regex -alias g='grep --directories recurse --line-number --regexp' +alias g="\ +grep \ +--directories \"recurse\" \ +--line-number \ +--regexp \ +" From 81dc60be1ce82d72b6db9ecad212c4b0052d65be Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:29:21 +0200 Subject: [PATCH 061/702] clear --- bash/alias/clear.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/alias/clear.sh b/bash/alias/clear.sh index 350a925..afa9bb0 100644 --- a/bash/alias/clear.sh +++ b/bash/alias/clear.sh @@ -1,2 +1,4 @@ # clear terminal -alias c='clear' +alias c="\ +clear \ +" From 6f3ed66c062defc05532f32114d5b3736506a67f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:30:24 +0200 Subject: [PATCH 062/702] chown --- bash/alias/chown.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bash/alias/chown.sh b/bash/alias/chown.sh index 4beb36d..9b33024 100644 --- a/bash/alias/chown.sh +++ b/bash/alias/chown.sh @@ -1,5 +1,9 @@ # change owner as root -alias cor='chown 0:0' +alias cor="\ +chown \"0:0\" \ +" # change owner as user -alias cou='chown 1000:1000' +alias cou="\ +chown \"1000:1000\" \ +" From dbd9da9cd813e39b3102b1defeb8ba5d8c978b2b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:31:09 +0200 Subject: [PATCH 063/702] chmod --- bash/alias/chmod.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bash/alias/chmod.sh b/bash/alias/chmod.sh index 357d4dc..ee69091 100644 --- a/bash/alias/chmod.sh +++ b/bash/alias/chmod.sh @@ -1,5 +1,9 @@ # change mode as directory -alias cmd='chmod 755' +alias cmd="\ +chmod \"755\" \ +" # change mode as file -alias cmf='chmod 644' +alias cmf="\ +chmod \"644\" \ +" From 4f362fa0c4a29607661f87e97d701469925a0e89 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:35:32 +0200 Subject: [PATCH 064/702] byobu --- bash/alias/byobu.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bash/alias/byobu.sh b/bash/alias/byobu.sh index fd5e98d..df37d6f 100644 --- a/bash/alias/byobu.sh +++ b/bash/alias/byobu.sh @@ -1,7 +1,19 @@ -alias bb='byobu' +alias bb="\ +byobu \ +" -alias bba='byobu attach-session' +alias bba="\ +byobu \ +attach-session \ +" -alias bbl='byobu ls' +alias bbl="\ +byobu \ +ls \ +" -alias bbn='byobu new-session -d' +alias bbn="\ +byobu \ +new-session \ +-d \ +" From 42cefc7a4983f8b489e88a0fb865ab86fb99949c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:36:36 +0200 Subject: [PATCH 065/702] batcat --- bash/alias/batcat.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/alias/batcat.sh b/bash/alias/batcat.sh index abe0b64..e62f4ac 100644 --- a/bash/alias/batcat.sh +++ b/bash/alias/batcat.sh @@ -1 +1,3 @@ -alias bat='batcat' +alias bat="\ +batcat \ +" From bb55e1f3587a02c9e6f9cb61139b6bd81968edff Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:38:54 +0200 Subject: [PATCH 066/702] bash --- bash/alias/bash.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bash/alias/bash.sh b/bash/alias/bash.sh index 211a5cf..84b628d 100644 --- a/bash/alias/bash.sh +++ b/bash/alias/bash.sh @@ -1,5 +1,14 @@ # change current directory to its parent -alias ..='cd ..' +alias ..="\ +cd .. \ +" + +# import source file +alias src="\ +source \ +" # exit terminal -alias x='exit' +alias x="\ +exit \ +" From 2c8add321a28eb26bfe6ad869a25799a6506afc7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:54:43 +0200 Subject: [PATCH 067/702] apt --- bash/alias/apt.sh | 78 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 15 deletions(-) diff --git a/bash/alias/apt.sh b/bash/alias/apt.sh index 5de980c..c4a0a7a 100644 --- a/bash/alias/apt.sh +++ b/bash/alias/apt.sh @@ -1,23 +1,71 @@ # show package information -alias ac='apt-cache show' - -# search package -alias acs='apt-cache search' +alias ac="\ +apt-cache \ +show \ +" # package versions policy -alias acp='apt-cache policy' +alias acp="\ +apt-cache \ +policy \ +" -# update packages catalog -alias agud='apt-get update' +# search package +alias acs="\ +apt-cache \ +search \ +" -# upgrade forbidding package installation or removal -alias agug='apt-get upgrade' +# +alias agap="\ +apt-get \ +autopurge \ +" -# upgrade allowing package installation or removal -alias agdu='apt-get dist-upgrade' - -# install packages -alias agi='apt-get install' +# +alias agar="\ +apt-get \ +autoremove \ +" # clean packages cache -alias agc='apt-get clean;apt-get autoremove' +alias agc="\ +apt-get \ +clean \ +" + +# upgrade allowing package installation or removal +alias agdu="\ +apt-get \ +dist-upgrade \ +" + +# install packages +alias agi="\ +apt-get \ +install \ +" + +# +alias agp="\ +apt-get \ +purge \ +" + +# +alias agr="\ +apt-get \ +remove \ +" + +# update packages catalog +alias agud="\ +apt-get \ +update \ +" + +# upgrade forbidding package installation or removal +alias agug="\ +apt-get \ +upgrade \ +" From 7557c5b2cc8bff5b7ffc9eb1fab5267b977c6e86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 16:58:37 +0200 Subject: [PATCH 068/702] ggc --- bash/alias/git.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 7417e4c..85c5902 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -89,7 +89,11 @@ alias gf='git fetch --tags --verbose' alias gfp='git fetch --prune --tags --verbose' # garbage collect all orphan commits -alias ggc='git reflog expire --expire=now --all;git gc --prune=now' +alias ggc="\ +git reflog expire --expire=now --all \ +; \ +git gc --prune=now \ +" # initialize a new repository alias gi='git init' From 9bd2c799a057a68e84b47f0275238f0d4e0f166c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 17:08:10 +0200 Subject: [PATCH 069/702] ggc --- bash/alias/git.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 85c5902..769e5e3 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -90,9 +90,16 @@ alias gfp='git fetch --prune --tags --verbose' # garbage collect all orphan commits alias ggc="\ -git reflog expire --expire=now --all \ +git \ +reflog \ +expire \ +--all \ +--expire \"all\" \ ; \ -git gc --prune=now \ +git \ +gc \ +--aggressive \ +--prune \"now\" \ " # initialize a new repository From c89a269e78806eec3d422e97ef2eab240eb6035e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 17:10:44 +0200 Subject: [PATCH 070/702] prune --- bash/alias/git.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 769e5e3..9ce63bc 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -99,7 +99,7 @@ expire \ git \ gc \ --aggressive \ ---prune \"now\" \ +--prune=\"now\" \ " # initialize a new repository From ac2f69eea8961d92990fb076dc3508bb3df29727 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 17:56:00 +0200 Subject: [PATCH 071/702] ga --- bash/alias/git.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 9ce63bc..6d24bb8 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -1,8 +1,15 @@ # add to index -alias ga='git add' +alias ga="\ +git \ +add \ +" # add all to index -alias gaa='git add --all' +alias gaa="\ +git \ +add \ +--all \ +" # create a branch alias gb='git branch' From 26b40b3bd0ff5482383228d6c6d5e19ee719a94c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 17:59:03 +0200 Subject: [PATCH 072/702] gb --- bash/alias/git.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 6d24bb8..b0edb43 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -12,19 +12,42 @@ add \ " # create a branch -alias gb='git branch' +alias gb="\ +git \ +branch \ +" # delete a branch -alias gbd='git branch --delete' +alias gbd="\ +git \ +branch \ +--delete \ +" # force a branch deletion -alias gbdf='git branch --delete --force' +alias gbdf="\ +git \ +branch \ +--delete \ +--force \ +" # list branches -alias gbl='git branch --all --list --verbose --verbose' +alias gbl="\ +git \ +branch \ +--all \ +--list \ +--verbose \ +--verbose \ +" # set the link to a remote branch from a local branch -alias gbu='git branch -u' +alias gbsu="\ +git \ +branch \ +--set-upstream-to \ +" # clone a remote repository alias gc='git clone' From 9017b8d90558d081ef1e64ffb6e75316aadc50c9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:04:13 +0200 Subject: [PATCH 073/702] gc,gcf --- bash/alias/git.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index b0edb43..3a43c68 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -50,10 +50,18 @@ branch \ " # clone a remote repository -alias gc='git clone' +alias gc="\ +git \ +clone \ +" # clean untracked files -alias gcf='git clean -d --force' +alias gcf="\ +git \ +clean \ +-d \ +--force \ +" # index all and commit alias gacm='git add --all;git commit -m' From 6b4410052b8f353c246e07706e3fcdd764c19122 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:07:01 +0200 Subject: [PATCH 074/702] gt --- bash/alias/git.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 3a43c68..5d1c42e 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -230,10 +230,21 @@ alias gs='git status --untracked-files=all' alias gsh='git show' # tag a commit -alias gt='git tag' +alias gt="\ +git \ +tag \ +" # delete a tag -alias gtd='git tag --delete' +alias gtd="\ +git \ +tag \ +--delete \ +" # tag a commit and sign -alias gts='git tag --sign' +alias gts="\ +git \ +tag \ +--sign \ +" From e93728cdc5b0a17a54c3f4d1ab1eb4a2cc0d6b71 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:11:10 +0200 Subject: [PATCH 075/702] grs --- bash/alias/git.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 5d1c42e..f2f2ec2 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -212,16 +212,17 @@ alias grms='git remote show' alias grmu='git remote set-url' # remove file(s) from index or move current branch pointer -alias grs='git reset' - -# move current branch pointer to the development branch -alias grsd='git reset dev' +alias grs="\ +git \ +reset \ +" # wipe modifications or reset current branch to another commit -alias grsh='git reset --hard' - -# reset current branch to the development branch -alias grshd='git reset --hard dev' +alias grsh="\ +git \ +reset \ +--hard \ +" # current state of repository alias gs='git status --untracked-files=all' From ab2d3d914198cbdedfc21cb790b691ec0e9eb570 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:17:18 +0200 Subject: [PATCH 076/702] grm --- bash/alias/git.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index f2f2ec2..d252628 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -196,20 +196,39 @@ alias grbf='git rebase --no-ff' # rebase interactively alias grbi='git rebase --interactive' -# list all remote repositories -alias grm='git remote' +# remove and add to index +alias grm="\ +git \ +rm \ +" # add a new remote repository -alias grma='git remote add' +alias grma="\ +git \ +remote \ +add \ +" # list remote repositories -alias grml='git remote --verbose' +alias grml="\ +git \ +remote \ +--verbose \ +" # show a connection to a repository -alias grms='git remote show' +alias grms="\ +git \ +remote \ +show \ +" # set the location of the remote repository -alias grmu='git remote set-url' +alias grmsu="\ +git \ +remote \ +set-url \ +" # remove file(s) from index or move current branch pointer alias grs="\ From c41c49c30dfeec0f5ca7844b797f70fbc4f50b9d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:50:19 +0200 Subject: [PATCH 077/702] grb --- bash/alias/git.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index d252628..1498ef1 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -182,19 +182,38 @@ alias gpd='git push --delete --verbose' alias gpf='git push --tags --verbose --force' # rebase current branch onto another -alias grb='git rebase' +alias grb="\ +git \ +rebase \ +" # abort current rebase -alias grba='git rebase --abort' +alias grba="\ +git \ +rebase \ +--abort \ +" # continue current rebase -alias grbc='git rebase --continue' +alias grbc="\ +git \ +rebase \ +--continue \ +" # force rebase without fast-forward -alias grbf='git rebase --no-ff' +alias grbf="\ +git \ +rebase \ +--force-rebase \ +" # rebase interactively -alias grbi='git rebase --interactive' +alias grbi="\ +git \ +rebase \ +--interactive \ +" # remove and add to index alias grm="\ From 8a99b9e1b7b69c992a40a2f46f7884c816b71c42 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:53:19 +0200 Subject: [PATCH 078/702] gp --- bash/alias/git.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 1498ef1..9065dcd 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -173,13 +173,29 @@ alias gms='git merge --squash' alias gmt='git mergetool' # push to the remote repository -alias gp='git push --tags --verbose' +alias gp="\ +git \ +push \ +--verbose \ +--tags \ +" # delete from the remote repository -alias gpd='git push --delete --verbose' +alias gpd="\ +git \ +push \ +--verbose \ +--delete \ +" # force the push to the remote repository -alias gpf='git push --tags --verbose --force' +alias gpf="\ +git \ +push \ +--verbose \ +--tags \ +--force \ +" # rebase current branch onto another alias grb="\ From 81616ae7707ef2d4b279ba2b5e4d76640eb16798 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:55:39 +0200 Subject: [PATCH 079/702] gf --- bash/alias/git.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 9065dcd..be3ed61 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -121,10 +121,21 @@ alias gdt='git difftool --dir-diff' alias gdw='git diff --word-diff-regex=.' # fetch from the remote repository -alias gf='git fetch --tags --verbose' +alias gf="\ +git \ +fetch \ +--verbose \ +--tags \ +" # fetch from remote repository and prune local orphan branches -alias gfp='git fetch --prune --tags --verbose' +alias gfp="\ +git \ +fetch \ +--verbose \ +--tags \ +--prune \ +" # garbage collect all orphan commits alias ggc="\ From a8d4d6373e8c062ecd81a26ff3f878694319b723 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 18:57:15 +0200 Subject: [PATCH 080/702] gcp --- bash/alias/git.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index be3ed61..b4ec3a0 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -91,13 +91,24 @@ alias gcod='git checkout dev' alias gcof='git checkout f' # pick a commit -alias gcp='git cherry-pick' +alias gcp="\ +git \ +cherry-pick \ +" # abort the commit pick -alias gcpa='git cherry-pick --abort' +alias gcpa="\ +git \ +cherry-pick \ +--abort \ +" # continue the commit pick -alias gcpc='git cherry-pick --continue' +alias gcpc="\ +git \ +cherry-pick \ +--continue \ +" # configure the user name alias gcun='git config user.name' From 4a500e83aca8c9980ecaa4c2f7d002f572b68238 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 19:49:34 +0200 Subject: [PATCH 081/702] gco --- bash/alias/git.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index b4ec3a0..fd54132 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -79,16 +79,17 @@ alias gcmr='git commit --allow-empty --allow-empty-message -m ""' alias gcms='git commit --gpg-sign -m' # switch to a branch or checkout file(s) from a commit -alias gco='git checkout' +alias gco="\ +git \ +checkout \ +" # checkout an orphan branch -alias gcoo='git checkout --orphan' - -# checkout development branch -alias gcod='git checkout dev' - -# checkout feature branch -alias gcof='git checkout f' +alias gcoo="\ +git \ +checkout \ +--orphan \ +" # pick a commit alias gcp="\ From 64c39902a6a194b42638e44a775e36943636f211 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:15:44 +0200 Subject: [PATCH 082/702] gd --- bash/alias/git.sh | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index fd54132..909c2b4 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -63,9 +63,6 @@ clean \ --force \ " -# index all and commit -alias gacm='git add --all;git commit -m' - # commit the index alias gcm='git commit -m' @@ -118,19 +115,39 @@ alias gcun='git config user.name' alias gcue='git config user.email' # differences from last or between commits -alias gd='git diff' +alias gd="\ +git \ +diff \ +" # display what is indexed in cache -alias gdc='git diff --cached' +alias gdc="\ +git \ +diff \ +--cached \ +" # indexed character-level differences -alias gdcw='git diff --cached --word-diff-regex=.' +alias gdcw="\ +git \ +diff \ +--cached \ +--word-diff-regex=. \ +" # differences via external tool -alias gdt='git difftool --dir-diff' +alias gdt="\ +git \ +difftool \ +--dir-diff \ +" # character-level differences -alias gdw='git diff --word-diff-regex=.' +alias gdw="\ +git \ +diff \ +--word-diff-regex=. \ +" # fetch from the remote repository alias gf="\ From db5874722aa126a8a6b9ff98ca0bea257e5eeb99 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:16:55 +0200 Subject: [PATCH 083/702] gcu --- bash/alias/git.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 909c2b4..07aaee2 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -109,10 +109,18 @@ cherry-pick \ " # configure the user name -alias gcun='git config user.name' +alias gcun="\ +git \ +config \ +user.name \ +" # configure the user email -alias gcue='git config user.email' +alias gcue="\ +git \ +config \ +user.email \ +" # differences from last or between commits alias gd="\ From ad467c223cb4d2802d6bb34b340c55e2ee95c298 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:18:05 +0200 Subject: [PATCH 084/702] gi --- bash/alias/git.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 07aaee2..7db6300 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -189,10 +189,17 @@ gc \ " # initialize a new repository -alias gi='git init' +alias gi="\ +git \ +init \ +" # initialize a new bare repository -alias gib='git init --bare' +alias gib="\ +git \ +init \ +--bare \ +" # log commits history alias gl='git log --all --graph \ From afac1464dc9ca1929a18451f79aaf1107a1414fd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:29:47 +0200 Subject: [PATCH 085/702] gm --- bash/alias/git.sh | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 7db6300..94ffd6c 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -212,20 +212,49 @@ alias glp='git log --all --graph \ # log medium information alias glm='git log --all --decorate --graph --pretty=medium' -# fast-forward to remote branch -alias gmf='git merge --ff-only' +# abort the current merge commit +alias gma="\ +git \ +merge \ +--abort \ +" # do a merge commit -alias gmc='git merge --no-ff -m' +alias gmc="\ +git \ +merge \ +--no-ff \ +-m \ +" -# abort the current merge commit -alias gma='git merge --abort' +# do a signed merge commit +alias gmcs="\ +git \ +merge \ +--no-ff \ +--gpg-sign \ +-m \ +" + +# fast-forward to remote branch +alias gmf="\ +git \ +merge \ +--ff-only \ +" # squash a branch and index its modifications -alias gms='git merge --squash' +alias gms="\ +git \ +merge \ +--squash \ +" # merge via external tool -alias gmt='git mergetool' +alias gmt="\ +git \ +mergetool \ +" # push to the remote repository alias gp="\ From e6d67ac56e45cbd6469277a2878616d1ce637ead Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:47:03 +0200 Subject: [PATCH 086/702] gl --- bash/alias/git.sh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 94ffd6c..30fc8a6 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -202,15 +202,33 @@ init \ " # log commits history -alias gl='git log --all --graph \ ---format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B"' - -# log commits history with patches -alias glp='git log --all --graph \ ---format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" --patch' +alias gl="\ +git \ +log \ +--all \ +--graph \ +--format=\"%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B\" \ +" # log medium information -alias glm='git log --all --decorate --graph --pretty=medium' +alias glm="\ +git \ +log \ +--all \ +--decorate \ +--graph \ +--pretty=medium \ +" + +# log commits history with patches +alias glp="\ +git \ +log \ +--all \ +--graph \ +--format=\"%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B\" \ +--patch \ +" # abort the current merge commit alias gma="\ From 3911f08261d3464a28017e3f510f8cd2700c8677 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:48:39 +0200 Subject: [PATCH 087/702] gap --- bash/alias/git.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 30fc8a6..9917fd7 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -11,6 +11,13 @@ add \ --all \ " +# add parts to index +alias gap="\ +git \ +add \ +--patch \ +" + # create a branch alias gb="\ git \ From ca650057079eee1517ad91469a8cd5920546704f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:56:05 +0200 Subject: [PATCH 088/702] gc --- bash/alias/git.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 9917fd7..f2e2750 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -56,12 +56,6 @@ branch \ --set-upstream-to \ " -# clone a remote repository -alias gc="\ -git \ -clone \ -" - # clean untracked files alias gcf="\ git \ @@ -71,16 +65,36 @@ clean \ " # commit the index -alias gcm='git commit -m' +alias gc="\ +git \ +commit \ +-m \ +" # redo the last commit with a different message -alias gcma='git commit --amend -m' +alias gca="\ +git \ +commit \ +--amend \ +-m \ +" # make a root commit -alias gcmr='git commit --allow-empty --allow-empty-message -m ""' +alias gce="\ +git \ +commit \ +--allow-empty \ +--allow-empty-message \ +-m \"\" \ +" # commit the index and sign -alias gcms='git commit --gpg-sign -m' +alias gcs="\ +git \ +commit \ +--gpg-sign \ +-m \ +" # switch to a branch or checkout file(s) from a commit alias gco="\ From e9694b0c17c7166cdc3a4d934cf14171872a0611 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 22:58:58 +0200 Subject: [PATCH 089/702] gs --- bash/alias/git.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index f2e2750..2508360 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -402,10 +402,17 @@ reset \ " # current state of repository -alias gs='git status --untracked-files=all' +alias gs="\ +git \ +status \ +--untracked-files=all \ +" # show a commit -alias gsh='git show' +alias gsc="\ +git \ +show \ +" # tag a commit alias gt="\ From ffdc0c74e13b6c194053a2cf909e15ebb6fae5b4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 23:12:22 +0200 Subject: [PATCH 090/702] mount --- bash/alias/mount.sh | 10 ++++++++++ bash/mount.sh | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 bash/alias/mount.sh diff --git a/bash/alias/mount.sh b/bash/alias/mount.sh new file mode 100644 index 0000000..ca11b0e --- /dev/null +++ b/bash/alias/mount.sh @@ -0,0 +1,10 @@ +alias m="\ +mount \ +" + +# remount read-only medium in read-write +alias remount="\ +mount \ +-o \"remount,rw\" \ +\"/usr/lib/live/mount/medium\" \ +" diff --git a/bash/mount.sh b/bash/mount.sh index b33b12c..65131f1 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -1,9 +1,3 @@ -alias m='mount' - -# remount read-only medium in read-write -alias remount='mount -o remount,rw /usr/lib/live/mount/medium' - - function mo { local directory="${1}" local file @@ -44,10 +38,19 @@ for f in 'dev' 'dev/pts' 'proc' 'sys' ; do done } -alias cr='chroot overlay/mount' +alias cr="\ +chroot \ +\"overlay/mount\" \ +" + +alias cru="\ +chroot \ +--userspec \"1000:1000\" \ +\"overlay/mount\" \ +" function ur { -for f in 'dev/pts' 'dev' 'proc' 'sys' ; do +for f in 'sys' 'proc' 'dev/pts' 'dev' ; do umount --lazy "overlay/mount/${f}" done } From 4f043326eee68585c6c0a34bd4cc7b2101e3c99b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 23:24:40 +0200 Subject: [PATCH 091/702] log modules --- bash/log.sh | 2 +- bash/main.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bash/log.sh b/bash/log.sh index 1e699b3..f7d325e 100644 --- a/bash/log.sh +++ b/bash/log.sh @@ -5,7 +5,7 @@ LOG_LEVEL_INFO=3 LOG_LEVEL_DEBUG=4 LOG_LEVEL_TRACE=5 -LOG_LEVEL=${LOG_LEVEL_WARNING} +LOG_LEVEL=${LOG_LEVEL_WARN} function log_fatal { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_FATAL} ] && echo "${@}" ; } diff --git a/bash/main.sh b/bash/main.sh index d858f6d..33a3df5 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -12,11 +12,10 @@ function link_bashrc { function main_import_modules { local IFS=$'\n' local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh')) + log_trace "${modules[@]}" local module for module in "${modules[@]}" ; do if [ "${module}" != "${MAIN_FILE}" ] ; then - echo - echo "${module}" source "${module}" fi done From d2eb5dd0114342d91bd9d811c4ba28d74c076cfe Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 May 2023 23:31:26 +0200 Subject: [PATCH 092/702] after --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 33a3df5..90ea527 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -12,13 +12,13 @@ function link_bashrc { function main_import_modules { local IFS=$'\n' local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh')) - log_trace "${modules[@]}" local module for module in "${modules[@]}" ; do if [ "${module}" != "${MAIN_FILE}" ] ; then source "${module}" fi done + log_trace "${modules[@]}" } # import modules From abe546de10e73301c518b49a3d47c6489f0c43e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 09:01:00 +0200 Subject: [PATCH 093/702] gpg --- bash/alias/gpg.sh | 12 ++++++++++++ bash/gnupg.sh | 8 -------- bash/gpg.sh | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 bash/alias/gpg.sh delete mode 100644 bash/gnupg.sh create mode 100644 bash/gpg.sh diff --git a/bash/alias/gpg.sh b/bash/alias/gpg.sh new file mode 100644 index 0000000..80705c5 --- /dev/null +++ b/bash/alias/gpg.sh @@ -0,0 +1,12 @@ +# turn gpg agent off +alias gpgoff="\ +gpgconf \ +--kill \"gpg-agent\" \ +" + +# bind gpg agent to current tty +alias gpgtty="\ +gpg-connect-agent \ +updatestartuptty \ +/bye \ +" diff --git a/bash/gnupg.sh b/bash/gnupg.sh deleted file mode 100644 index ab29be1..0000000 --- a/bash/gnupg.sh +++ /dev/null @@ -1,8 +0,0 @@ -if [ ${EUID} -ne 0 ] ; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - gpg-connect-agent updatestartuptty /bye > /dev/null -fi - -alias gpgoff='gpgconf --kill gpg-agent' - -alias gpgtty='gpg-connect-agent updatestartuptty /bye' diff --git a/bash/gpg.sh b/bash/gpg.sh new file mode 100644 index 0000000..8025b64 --- /dev/null +++ b/bash/gpg.sh @@ -0,0 +1,4 @@ +if [ ${EUID} -ne 0 ] ; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + gpg-connect-agent updatestartuptty /bye > '/dev/null' +fi From 04ccbd37c431d0a9c619a3d57c412e5486c834fc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 09:02:33 +0200 Subject: [PATCH 094/702] gc/message --- bash/alias/git.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 2508360..c0645b1 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -68,7 +68,7 @@ clean \ alias gc="\ git \ commit \ --m \ +--message \ " # redo the last commit with a different message @@ -76,7 +76,7 @@ alias gca="\ git \ commit \ --amend \ --m \ +--message \ " # make a root commit @@ -85,7 +85,7 @@ git \ commit \ --allow-empty \ --allow-empty-message \ --m \"\" \ +--message \"\" \ " # commit the index and sign @@ -93,7 +93,7 @@ alias gcs="\ git \ commit \ --gpg-sign \ --m \ +--message \ " # switch to a branch or checkout file(s) from a commit From 4c7ad425b2796bf1a72962378bcc75161a5519ba Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 09:19:43 +0200 Subject: [PATCH 095/702] main_bash --- bash/main.sh | 19 +++++++++++++------ bash/ovh-rescue.sh | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 90ea527..c89870e 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,25 +1,32 @@ #! /usr/bin/env bash -MAIN_FILE="$(realpath "${BASH_SOURCE[0]}")" -MAIN_ROOT="$(dirname "${MAIN_FILE}")" + +MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" + +MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" function link_bashrc { local file='/etc/bash.bashrc' rm --force "${file}" - ln --symbolic "${MAIN_FILE}" "${file}" + ln --symbolic "${MAIN_BASH_FILE}" "${file}" } # import modules function main_import_modules { +local root="${1}" +if [ -d "${root}" ] ; then local IFS=$'\n' - local modules=($(find "${MAIN_ROOT}" -type 'f' -name '*.sh')) + local modules=($(find "${root}" -type 'f' -name '*.sh')) local module for module in "${modules[@]}" ; do - if [ "${module}" != "${MAIN_FILE}" ] ; then + if [ "${module}" != "${MAIN_BASH_FILE}" ] ; then source "${module}" fi done log_trace "${modules[@]}" +else + log_fatal "No directory: ${root}" +fi } # import modules -main_import_modules +main_import_modules "${MAIN_BASH_ROOT}" diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index ecc2115..295a95f 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -91,7 +91,7 @@ if [ "${host}" ] ; then -o 'StrictHostKeyChecking=accept-new' \ "${user_host}" # upload root - rsync --delete --recursive "${MAIN_ROOT}/" "${user_host}:/etc/bash/" + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-setup" From 3fc442bf709f20fb934f801fe8d0a87768befeea Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 12:07:16 +0200 Subject: [PATCH 096/702] main_link_bashrc --- bash/main.sh | 2 +- bash/ovh-rescue.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index c89870e..9b7afdd 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -4,7 +4,7 @@ MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" -function link_bashrc { +function main_link_bashrc { local file='/etc/bash.bashrc' rm --force "${file}" ln --symbolic "${MAIN_BASH_FILE}" "${file}" diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 295a95f..c52af9f 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -22,7 +22,7 @@ deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free " > '/etc/apt/sources.list' # bash / rc - link_bashrc + main_link_bashrc # host name hostname 'ovh' # locales From b170098755e474412de52c1a2eec1cb6eb7b713b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 12:20:00 +0200 Subject: [PATCH 097/702] ovh-rescue-configure --- bash/ovh-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index c52af9f..cd7f899 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,4 +1,4 @@ -function ovh-rescue-setup { +function ovh-rescue-configure { local packages=( 'byobu' 'mosh' ) @@ -94,7 +94,7 @@ if [ "${host}" ] ; then rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-setup" + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure" # create session ssh "${user_host}" -- byobu new-session -d # send keys From 3ffc60e4f16a5ace6c7cdf447342d9285ebcbb85 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 18:41:02 +0200 Subject: [PATCH 098/702] main/file --- bash/main.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 9b7afdd..ad08f22 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -12,21 +12,22 @@ function main_link_bashrc { # import modules function main_import_modules { -local root="${1}" -if [ -d "${root}" ] ; then +local file="${1}" +if [ -f "${file}" ] ; then + local root="$(dirname "${file}")" local IFS=$'\n' local modules=($(find "${root}" -type 'f' -name '*.sh')) local module for module in "${modules[@]}" ; do - if [ "${module}" != "${MAIN_BASH_FILE}" ] ; then + if [ "${module}" != "${file}" ] ; then source "${module}" fi done log_trace "${modules[@]}" else - log_fatal "No directory: ${root}" + log_fatal "No file: ${file}" fi } # import modules -main_import_modules "${MAIN_BASH_ROOT}" +main_import_modules "${MAIN_BASH_FILE}" From 80f19583ce4f467e87490ef12fc89fea1c8a265c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 18:56:12 +0200 Subject: [PATCH 099/702] path --- bash/main.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index ad08f22..424a2ec 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -14,7 +14,8 @@ function main_link_bashrc { function main_import_modules { local file="${1}" if [ -f "${file}" ] ; then - local root="$(dirname "${file}")" + local path="$(realpath "${file}")" + local root="$(dirname "${path}")" local IFS=$'\n' local modules=($(find "${root}" -type 'f' -name '*.sh')) local module From 9609171ad634c4b1cfdd065e4d3d227e1df9f2f4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 18:59:04 +0200 Subject: [PATCH 100/702] path --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 424a2ec..ce04a8a 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -20,7 +20,7 @@ if [ -f "${file}" ] ; then local modules=($(find "${root}" -type 'f' -name '*.sh')) local module for module in "${modules[@]}" ; do - if [ "${module}" != "${file}" ] ; then + if [ "${module}" != "${path}" ] ; then source "${module}" fi done From 3092524d58a6dbebc81565c283f83a0e9626a1d7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 21:12:20 +0200 Subject: [PATCH 101/702] evince --- bash/alias/evince.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 bash/alias/evince.sh diff --git a/bash/alias/evince.sh b/bash/alias/evince.sh new file mode 100644 index 0000000..0d36d89 --- /dev/null +++ b/bash/alias/evince.sh @@ -0,0 +1,3 @@ +alias ev="\ +evince \ +" From 060287a12725083bdbc9c0a1442236a7a5bb6d5e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 21:13:48 +0200 Subject: [PATCH 102/702] todo/ffmpeg --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 1e8a316..4021d7f 100644 --- a/readme.md +++ b/readme.md @@ -8,3 +8,4 @@ * [ ] clean apt cache after each install/upgrade step * [ ] apt * [ ] apt-file search | grep +* [ ] ffmpeg From 3b71c87e03ab28510e9a2ef5bab60b2f395479d9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 15 May 2023 21:23:36 +0200 Subject: [PATCH 103/702] apt_clean_cache --- bash/apt.sh | 3 +++ bash/ovh-rescue.sh | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 bash/apt.sh diff --git a/bash/apt.sh b/bash/apt.sh new file mode 100644 index 0000000..e83ccc1 --- /dev/null +++ b/bash/apt.sh @@ -0,0 +1,3 @@ +function apt_clean_cache { + apt-get clean +} diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index cd7f899..bfe0bf2 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -41,6 +41,8 @@ fr_FR.UTF-8 UTF-8 debian_disable_frontend # install packages apt-get install --assume-yes "${packages[@]}" + # + apt_clean_cache } function ovh-rescue-install { @@ -69,13 +71,17 @@ function ovh-rescue-install { debian_disable_frontend # upgrade packages apt-get upgrade --assume-yes + # + apt_clean_cache # install packages apt-get install --assume-yes "${packages[@]}" + # + apt_clean_cache # install backports apt-get install --assume-yes \ --target-release "${release}-backports" "${backports[@]}" - # clean cache - apt-get clean + # + apt_clean_cache } function ovh-rescue-upload { From b54d423f87100918225c19b71b2f89be80a617a8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 16 May 2023 18:26:21 +0200 Subject: [PATCH 104/702] mm/make-rslave,rbind um/recursive --- bash/mount.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/mount.sh b/bash/mount.sh index 65131f1..e92ecef 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -57,11 +57,11 @@ done function mm { -mount --bind '/deb' 'overlay/mount/deb' +mount --make-rslave --rbind '/deb' 'overlay/mount/deb' } function um { -umount 'overlay/mount/deb' +umount --recursive 'overlay/mount/deb' } From 3e924813c84ff45da69243186d8aa1810bca8c74 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 17 May 2023 16:24:01 +0200 Subject: [PATCH 105/702] =?UTF-8?q?account=E2=86=92a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/alias/otpclient-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/alias/otpclient-cli.sh b/bash/alias/otpclient-cli.sh index 163fb1d..be14c50 100644 --- a/bash/alias/otpclient-cli.sh +++ b/bash/alias/otpclient-cli.sh @@ -2,7 +2,7 @@ alias pd="\ otpclient-cli \ show \ ---account \ +-a \ " # list otp accounts From d7bee96329c93121be7c1f1c038f0ea83766a378 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 12:34:05 +0200 Subject: [PATCH 106/702] git/clone,commit --- bash/alias/git.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index c0645b1..14e5dfe 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -56,6 +56,12 @@ branch \ --set-upstream-to \ " +# clone a remote repository +alias gc="\ +git \ +clone \ +" + # clean untracked files alias gcf="\ git \ @@ -65,14 +71,14 @@ clean \ " # commit the index -alias gc="\ +alias gcm="\ git \ commit \ --message \ " # redo the last commit with a different message -alias gca="\ +alias gcma="\ git \ commit \ --amend \ @@ -80,7 +86,7 @@ commit \ " # make a root commit -alias gce="\ +alias gcme="\ git \ commit \ --allow-empty \ @@ -89,7 +95,7 @@ commit \ " # commit the index and sign -alias gcs="\ +alias gcms="\ git \ commit \ --gpg-sign \ From 70006908feda611d9fe87f847e023776e7ff011e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 13:20:30 +0200 Subject: [PATCH 107/702] mvi --- bash/alias/mv.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 bash/alias/mv.sh diff --git a/bash/alias/mv.sh b/bash/alias/mv.sh new file mode 100644 index 0000000..dff7f63 --- /dev/null +++ b/bash/alias/mv.sh @@ -0,0 +1,5 @@ +# move interactively +alias mvi="\ +mv \ +--interactive \ +" From 7358508a9385508f91d5f429536bc452f3b147b9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 13:23:12 +0200 Subject: [PATCH 108/702] cpi --- bash/alias/cp.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 bash/alias/cp.sh diff --git a/bash/alias/cp.sh b/bash/alias/cp.sh new file mode 100644 index 0000000..946182f --- /dev/null +++ b/bash/alias/cp.sh @@ -0,0 +1,5 @@ +# copy interactively +alias cpi="\ +cp \ +--interactive \ +" From 57c4d5863111b5cc4475defe0c82a12bf3157372 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 13:24:21 +0200 Subject: [PATCH 109/702] sd --- bash/alias/bash.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bash/alias/bash.sh b/bash/alias/bash.sh index 84b628d..65a7bda 100644 --- a/bash/alias/bash.sh +++ b/bash/alias/bash.sh @@ -1,6 +1,13 @@ # change current directory to its parent alias ..="\ -cd .. \ +cd \ +.. \ +" + +# swap directory (current ↔ previous) +alias sd="\ +cd \ +- \ " # import source file From a35d7da97579e4221336f2da3575496df9d6d5e5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 13:25:21 +0200 Subject: [PATCH 110/702] \ --- bash/alias/chmod.sh | 6 ++++-- bash/alias/chown.sh | 6 ++++-- bash/alias/ps.sh | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bash/alias/chmod.sh b/bash/alias/chmod.sh index ee69091..4df1df3 100644 --- a/bash/alias/chmod.sh +++ b/bash/alias/chmod.sh @@ -1,9 +1,11 @@ # change mode as directory alias cmd="\ -chmod \"755\" \ +chmod \ +\"755\" \ " # change mode as file alias cmf="\ -chmod \"644\" \ +chmod \ +\"644\" \ " diff --git a/bash/alias/chown.sh b/bash/alias/chown.sh index 9b33024..5a51942 100644 --- a/bash/alias/chown.sh +++ b/bash/alias/chown.sh @@ -1,9 +1,11 @@ # change owner as root alias cor="\ -chown \"0:0\" \ +chown \ +\"0:0\" \ " # change owner as user alias cou="\ -chown \"1000:1000\" \ +chown \ +\"1000:1000\" \ " diff --git a/bash/alias/ps.sh b/bash/alias/ps.sh index 093944c..0e643ae 100644 --- a/bash/alias/ps.sh +++ b/bash/alias/ps.sh @@ -1,5 +1,7 @@ # look for a string in processes names alias pg="\ -ps -A \ -| grep \ +ps \ +-A \ +| \ +grep \ " From 8bc91cc00ba09bfd52746fd8291cbbfb780a911e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 13:51:20 +0200 Subject: [PATCH 111/702] git/gmc,grm --- bash/alias/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/alias/git.sh b/bash/alias/git.sh index 14e5dfe..a639a75 100644 --- a/bash/alias/git.sh +++ b/bash/alias/git.sh @@ -269,7 +269,7 @@ alias gmc="\ git \ merge \ --no-ff \ --m \ +--message \ " # do a signed merge commit @@ -360,7 +360,7 @@ rebase \ --interactive \ " -# remove and add to index +# remove and add removal to index alias grm="\ git \ rm \ From d5e81ff9c3cebae8a7eabcca5771487bfa7c6053 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 14:19:29 +0200 Subject: [PATCH 112/702] otp --- bash/alias/otpclient-cli.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bash/alias/otpclient-cli.sh b/bash/alias/otpclient-cli.sh index be14c50..4fbe9cd 100644 --- a/bash/alias/otpclient-cli.sh +++ b/bash/alias/otpclient-cli.sh @@ -1,12 +1,12 @@ +# list otp accounts +alias otpl="\ +otpclient-cli \ +list \ +" + # display otp code -alias pd="\ +alias otps="\ otpclient-cli \ show \ -a \ " - -# list otp accounts -alias pl="\ -otpclient-cli \ -list \ -" From 66b925e0a228f023ee97523d26987c32b18426d2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 14:29:49 +0200 Subject: [PATCH 113/702] pwgen/pwg,pwgs --- bash/alias/pwgen.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bash/alias/pwgen.sh diff --git a/bash/alias/pwgen.sh b/bash/alias/pwgen.sh new file mode 100644 index 0000000..c462028 --- /dev/null +++ b/bash/alias/pwgen.sh @@ -0,0 +1,16 @@ +# generate passwords +alias pwg="\ +pwgen \ +-1 \ +--num-passwords 1048576 \ +--secure \ +" + +# generate passwords with symbols +alias pwgs="\ +pwgen \ +-1 \ +--num-passwords 1048576 \ +--secure \ +--symbols \ +" From 755e93887640035bf34a93ce87ff6ff315ea5a83 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 18 May 2023 14:48:29 +0200 Subject: [PATCH 114/702] =?UTF-8?q?=C2=B5,n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/alias/micro.sh | 2 +- bash/alias/nano.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 bash/alias/nano.sh diff --git a/bash/alias/micro.sh b/bash/alias/micro.sh index 97d7174..05102a2 100644 --- a/bash/alias/micro.sh +++ b/bash/alias/micro.sh @@ -1,3 +1,3 @@ -alias e="\ +alias µ="\ micro \ " diff --git a/bash/alias/nano.sh b/bash/alias/nano.sh new file mode 100644 index 0000000..37bd342 --- /dev/null +++ b/bash/alias/nano.sh @@ -0,0 +1,3 @@ +alias n="\ +nano \ +" From 275b8bdf2c4789fac4074bd9c68442d6fb4afe26 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 19 May 2023 20:14:13 +0200 Subject: [PATCH 115/702] hostname --- bash/ovh-rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index bfe0bf2..bcd66c4 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,4 +1,5 @@ function ovh-rescue-configure { +local host="${1}" local packages=( 'byobu' 'mosh' ) @@ -24,7 +25,7 @@ deb https://deb.debian.org/debian-security buster/updates main contrib non-free # bash / rc main_link_bashrc # host name - hostname 'ovh' + hostname "${host}" # locales echo -n "\ en_US.UTF-8 UTF-8 @@ -100,7 +101,7 @@ if [ "${host}" ] ; then rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure" + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure '${host}'" # create session ssh "${user_host}" -- byobu new-session -d # send keys From 6455d789aadd222e59dc1412807ad30e1daf204a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 20 May 2023 09:18:21 +0200 Subject: [PATCH 116/702] ... --- bash/alias/bash.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash/alias/bash.sh b/bash/alias/bash.sh index 65a7bda..40500cc 100644 --- a/bash/alias/bash.sh +++ b/bash/alias/bash.sh @@ -4,6 +4,12 @@ cd \ .. \ " +# change current directory to its parent's parent +alias ...="\ +cd \ +../.. \ +" + # swap directory (current ↔ previous) alias sd="\ cd \ From 25a8c2f30b4af99db7c087e5e7468a340c04921f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 19 Jun 2023 15:08:06 +0200 Subject: [PATCH 117/702] sort bash modules --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index ce04a8a..6a16fc5 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -17,7 +17,7 @@ if [ -f "${file}" ] ; then local path="$(realpath "${file}")" local root="$(dirname "${path}")" local IFS=$'\n' - local modules=($(find "${root}" -type 'f' -name '*.sh')) + local modules=($(find "${root}" -type 'f' -name '*.sh' | sort)) local module for module in "${modules[@]}" ; do if [ "${module}" != "${path}" ] ; then From 53a2299f3466bd2d8f31cd94eeeb6e96ccf81359 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 19 Jun 2023 15:16:05 +0200 Subject: [PATCH 118/702] bash/main/import/exit --- bash/main.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bash/main.sh b/bash/main.sh index 6a16fc5..59788aa 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -25,8 +25,10 @@ if [ -f "${file}" ] ; then fi done log_trace "${modules[@]}" + return 0 else log_fatal "No file: ${file}" + return 1 fi } From 7ffcea4b843d243db0f9a3f8f09aa3eb8caedc8e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 11 Jul 2023 09:09:33 +0200 Subject: [PATCH 119/702] mv --- nbdcs => cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename nbdcs => cs (100%) diff --git a/nbdcs b/cs similarity index 100% rename from nbdcs rename to cs From 97f74cb623d4ba99d9dff7414561678be440aa02 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 11 Jul 2023 09:12:32 +0200 Subject: [PATCH 120/702] cs.old --- cs.old | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 cs.old diff --git a/cs.old b/cs.old new file mode 100755 index 0000000..8e8d088 --- /dev/null +++ b/cs.old @@ -0,0 +1,84 @@ +#! /usr/bin/env bash +FILE="$(realpath "${BASH_SOURCE[0]}")" +NAME="$(basename "${FILE}")" + +ACTION_OPEN='open' +ACTION_CLOSE='close' + +DATA_DIRECTORY='/data' +CONTAINERS_DIRECTORY="${DATA_DIRECTORY}/containers" + +CONTAINERS_MAP_DIRECTORY='/dev/mapper' +CONTAINERS_MOUNT_DIRECTORY='/media' + +function main { +local action="${1}" +local pass_phrase +local container +local container_name +local container_file +local container_map_file +local container_mount_directory + +case "${action}" in + "${ACTION_OPEN}"|"${ACTION_CLOSE}") + shift + if [ "${1}" ]; then + if [ "${action}" == "${ACTION_OPEN}" ]; then + echo -n 'PassPhrase: ' + read -s pass_phrase + echo + fi + for container in "${@}"; do + echo + case "${container}" in + 'p') container_name='private' ;; + 's') container_name='sensitive' ;; + 'w') container_name='work' ;; + *) container_name="${container}" ;; + esac + container_file="${CONTAINERS_DIRECTORY}/${container_name}" + if [ -f "${container_file}" ]; then + container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}" + container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}" + case "${action}" in + "${ACTION_OPEN}") + echo "${container_file} → ${container_map_file}" + echo "${pass_phrase}" \ + | cryptsetup luksOpen "${container_file}" "${container_name}" + if [ ${?} -eq 0 ]; then + mkdir --parents "${container_mount_directory}" + echo "${container_map_file} → ${container_mount_directory}" + mount "${container_map_file}" "${container_mount_directory}" + fi + ;; + "${ACTION_CLOSE}") + echo "${container_map_file} ← ${container_mount_directory}" + umount "${container_map_file}" + if [ ${?} -eq 0 ]; then + rmdir --ignore-fail-on-non-empty "${container_mount_directory}" + echo "${container_file} ← ${container_map_file}" + cryptsetup luksClose "${container_name}" + fi + ;; + esac + else + echo 'This path does not point to a file!' + fi + done + else + echo 'No container name provided!' + fi + ;; + *) + echo 'Usage:' + echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]" + echo + echo 'p = private' + echo 's = sensitive' + echo 'w = work' + ;; +esac +} + +main "${@}" From fde55c7c048f6ace89492e96c284994f9ccb977f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 19 Jul 2023 22:08:40 +0200 Subject: [PATCH 121/702] gpg agent if configuration --- bash/gpg.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash/gpg.sh b/bash/gpg.sh index 8025b64..abea396 100644 --- a/bash/gpg.sh +++ b/bash/gpg.sh @@ -1,4 +1,6 @@ if [ ${EUID} -ne 0 ] ; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - gpg-connect-agent updatestartuptty /bye > '/dev/null' + if [ -f "${HOME}/.gnupg/gpg-agent.conf" ] ; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + gpg-connect-agent updatestartuptty /bye > '/dev/null' + fi fi From 52a93c61cc22b9f83c809ac7f71231bae33eed2b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 18 Aug 2023 21:14:34 +0200 Subject: [PATCH 122/702] bash/prompt --- bash/bash/prompt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 51b193c..2f08496 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,5 +1,5 @@ PS1="\ -┌ \t\ +└ \t\ – \e[0;31m\${?}\e[0m\ – \e[0;32m\u\e[0m\ @ \e[0;33m\h\e[0m\ @@ -8,8 +8,8 @@ if [ "$(type -t __git_ps1)" == 'function' ] ; then PS1="${PS1} –\e[0;35m\$(__git_ps1)\e[0m" fi PS1="${PS1} -│\e[0;36m\${PWD}\e[0m -└ " +\e[0;36m\${PWD}\e[0m +┌ " PS2="\ -└ " +│ " From 633f42b6c2b689dabb43d951d51d8795337ccd83 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Aug 2023 13:55:12 +0200 Subject: [PATCH 123/702] bash/prompt --- bash/bash/prompt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 2f08496..b68611d 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -8,8 +8,8 @@ if [ "$(type -t __git_ps1)" == 'function' ] ; then PS1="${PS1} –\e[0;35m\$(__git_ps1)\e[0m" fi PS1="${PS1} -\e[0;36m\${PWD}\e[0m -┌ " +┌ \e[0;36m\${PWD}\e[0m +│ " PS2="\ │ " From 0b7e362582c8ca989960b2f0878d46c6489569f9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Aug 2023 18:33:26 +0200 Subject: [PATCH 124/702] bash/ps1 --- bash/bash/prompt.sh | 46 ++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index b68611d..a245867 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,15 +1,35 @@ -PS1="\ -└ \t\ - – \e[0;31m\${?}\e[0m\ - – \e[0;32m\u\e[0m\ - @ \e[0;33m\h\e[0m\ -" -if [ "$(type -t __git_ps1)" == 'function' ] ; then - PS1="${PS1} –\e[0;35m\$(__git_ps1)\e[0m" -fi -PS1="${PS1} -┌ \e[0;36m\${PWD}\e[0m -│ " - PS2="\ │ " + +function ps1 { +local code=${1} +local date="$(date +%H:%M:%S)" +local git +local host="$(hostname)" +local path="${PWD}" +local real="$(realpath "${path}")" +local user="${USER}" +local view="\ +└ ${date}\ + – \e[0;31m${code}\e[0m\ + – \e[0;32m${user}\e[0m\ + @ \e[0;33m${host}\e[0m\ +" + if [ "$(type -t __git_ps1)" == 'function' ] ; then + git="$(__git_ps1)" + if [ "${git}" ] ; then + view="${view} –\e[0;35m${git}\e[0m" + fi + fi + view="${view} +┌ " + if [ "${path}" != "${real}" ] ; then + view="${view}\e[0;36m${real}\e[0m +├ " + fi + view="${view}\e[0;36m${path}\e[0m +${PS2}" + echo -e "${view}" +} + +PS1='$(eval ps1 ${?})' From ffb301e21b95c5677401d9f79ef3e92130df7115 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Aug 2023 18:39:36 +0200 Subject: [PATCH 125/702] bash/ps1/real --- bash/bash/prompt.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index a245867..70e8454 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -21,13 +21,12 @@ local view="\ view="${view} –\e[0;35m${git}\e[0m" fi fi - view="${view} -┌ " if [ "${path}" != "${real}" ] ; then - view="${view}\e[0;36m${real}\e[0m -├ " + view="${view} +\e[0;36m${real}\e[0m" fi - view="${view}\e[0;36m${path}\e[0m + view="${view} +┌ \e[0;36m${path}\e[0m ${PS2}" echo -e "${view}" } From 0db196a41cf600553a6bc128db285cb5991b5f53 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Aug 2023 18:50:17 +0200 Subject: [PATCH 126/702] =?UTF-8?q?=E2=88=92real?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/bash/prompt.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 70e8454..9e02873 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -7,7 +7,6 @@ local date="$(date +%H:%M:%S)" local git local host="$(hostname)" local path="${PWD}" -local real="$(realpath "${path}")" local user="${USER}" local view="\ └ ${date}\ @@ -21,10 +20,6 @@ local view="\ view="${view} –\e[0;35m${git}\e[0m" fi fi - if [ "${path}" != "${real}" ] ; then - view="${view} -\e[0;36m${real}\e[0m" - fi view="${view} ┌ \e[0;36m${path}\e[0m ${PS2}" From 8afbad6e4c4eb2b147fc4371ab1806ed3ef92ab9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Aug 2023 19:41:54 +0200 Subject: [PATCH 127/702] bash/ps2 --- bash/bash/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 9e02873..9242a84 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,5 +1,5 @@ PS2="\ -│ " +├ " function ps1 { local code=${1} From e876f37b7d2269fe63dd457193427ac299894ace Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 21 Aug 2023 11:43:50 +0200 Subject: [PATCH 128/702] bash/prompt/enhance --- bash/bash/prompt.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 9242a84..d9361b0 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -8,22 +8,28 @@ local git local host="$(hostname)" local path="${PWD}" local user="${USER}" -local view="\ -└ ${date}\ - – \e[0;31m${code}\e[0m\ - – \e[0;32m${user}\e[0m\ - @ \e[0;33m${host}\e[0m\ -" +local view="└ " + if [ ${code} -ne 0 ] ; then + view="${view}\e[0;31m" + else + view="${view}\e[0;32m" + fi + view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" if [ "$(type -t __git_ps1)" == 'function' ] ; then git="$(__git_ps1)" if [ "${git}" ] ; then view="${view} –\e[0;35m${git}\e[0m" fi fi - view="${view} -┌ \e[0;36m${path}\e[0m -${PS2}" - echo -e "${view}" + view="${view}\n \e[0;36m${path}\e[0m" + view="${view}\n┌ " + if [ ${EUID} -eq 0 ] ; then + view="${view}\e[0;31m" + else + view="${view}\e[0;32m" + fi + view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m" + echo -e "${view}\n${PS2}" } PS1='$(eval ps1 ${?})' From 0b960f7fba9ce2f5820bc383b4c278979d6b5e93 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 21 Aug 2023 11:46:21 +0200 Subject: [PATCH 129/702] space --- bash/bash/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index d9361b0..da8a978 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -21,7 +21,7 @@ local view="└ " view="${view} –\e[0;35m${git}\e[0m" fi fi - view="${view}\n \e[0;36m${path}\e[0m" + view="${view}\n\e[0;36m${path}\e[0m" view="${view}\n┌ " if [ ${EUID} -eq 0 ] ; then view="${view}\e[0;31m" From 003d02f226ea41eb845d86902cba5c6714e45265 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 21 Aug 2023 14:32:38 +0200 Subject: [PATCH 130/702] gsettings/ws --- bash/gsettings.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 bash/gsettings.sh diff --git a/bash/gsettings.sh b/bash/gsettings.sh new file mode 100644 index 0000000..1fd3b72 --- /dev/null +++ b/bash/gsettings.sh @@ -0,0 +1,12 @@ +function ws { +local boolean="${1}" + if [ "${boolean}" == '1' ] ; then + boolean='true' + else + boolean='false' + fi + gsettings 'set' \ + 'org.gnome.mutter' \ + 'workspaces-only-on-primary' \ + "${boolean}" +} From 0daec8e9d410b5530d212f1149b58bbad6b06fab Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 28 Aug 2023 12:41:27 +0200 Subject: [PATCH 131/702] gpg/gak,gau --- bash/alias/gpg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/alias/gpg.sh b/bash/alias/gpg.sh index 80705c5..549c34e 100644 --- a/bash/alias/gpg.sh +++ b/bash/alias/gpg.sh @@ -1,11 +1,11 @@ # turn gpg agent off -alias gpgoff="\ +alias gak="\ gpgconf \ --kill \"gpg-agent\" \ " # bind gpg agent to current tty -alias gpgtty="\ +alias gau="\ gpg-connect-agent \ updatestartuptty \ /bye \ From 90b5440f138c0d9281e5a47af00e975decc7522d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 17:30:04 +0200 Subject: [PATCH 132/702] hetzner/cp --- bash/hetzner-rescue.sh | 179 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 bash/hetzner-rescue.sh diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh new file mode 100644 index 0000000..bcd66c4 --- /dev/null +++ b/bash/hetzner-rescue.sh @@ -0,0 +1,179 @@ +function ovh-rescue-configure { +local host="${1}" + local packages=( + 'byobu' 'mosh' + ) + # apt / conf + echo -n "\ +Acquire::AllowInsecureRepositories False; +Acquire::AllowWeakRepositories False; +Acquire::AllowDowngradeToInsecureRepositories False; +Acquire::Check-Valid-Until True; +APT::Install-Recommends False; +APT::Install-Suggests False; +APT::Get::Show-Versions True; +Dir::Etc::SourceParts ''; +Dpkg::Progress True; +" > '/etc/apt/apt.conf' + # apt / sources + echo -n "\ +deb https://deb.debian.org/debian buster main contrib non-free +deb https://deb.debian.org/debian buster-backports main contrib non-free +deb https://deb.debian.org/debian buster-updates main contrib non-free +deb https://deb.debian.org/debian-security buster/updates main contrib non-free +" > '/etc/apt/sources.list' + # bash / rc + main_link_bashrc + # host name + hostname "${host}" + # locales + echo -n "\ +en_US.UTF-8 UTF-8 +fr_FR.UTF-8 UTF-8 +" > '/etc/locale.gen' + # fix alias + rm --force '/usr/share/locale/locale.alias' + ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' + # generate locales + locale-gen + # update catalog + apt-get update + # + debian_disable_frontend + # install packages + apt-get install --assume-yes "${packages[@]}" + # + apt_clean_cache +} + +function ovh-rescue-install { + local release='buster' + local packages=( + # installed + 'parted' 'mdadm' 'lvm2' + # install + 'lshw' + 'file' 'micro' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'htop' 'iotop' 'lsof' + 'exa' 'ncdu' 'nnn' 'ranger' 'tree' + 'squashfs-tools' + 'uuid-runtime' + ) + local backports=( + # installed + 'cryptsetup-bin' 'rsync' + # install + 'git' + ) + # update catalog + apt-get update + # + debian_disable_frontend + # upgrade packages + apt-get upgrade --assume-yes + # + apt_clean_cache + # install packages + apt-get install --assume-yes "${packages[@]}" + # + apt_clean_cache + # install backports + apt-get install --assume-yes \ + --target-release "${release}-backports" "${backports[@]}" + # + apt_clean_cache +} + +function ovh-rescue-upload { +local host="${1}" +if [ "${host}" ] ; then + local user='root' + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o 'StrictHostKeyChecking=accept-new' \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure '${host}'" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys 'ovh-rescue-install' 'C-m' + # attach session + mosh "${user_host}" -- byobu attach-session +else + echo 'Host?' + return 1 +fi +} + +function ovh-rescue-wipe-1-2TB { + local device='/dev/sda' + local unit='mib' + # + lsblk + echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' + read + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 + # + parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 + # + parted "${device}" unit "${unit}" mkpart 'esp' 2 259 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" mkpart bios 1 2 + parted "${device}" set 4 bios_grub on + # wipe bios + dd if='/dev/zero' of='/dev/sda4' + # format esp + mkfs.vfat -F 32 -n 'esp' '/dev/sda3' + # format boot + mkfs.ext4 -F -L 'boot' '/dev/sda2' + # read passphrase + local passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/sda1' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/sda1' 'crypt' + # pv + pvcreate '/dev/mapper/crypt' + # vg + vgcreate 'crypt' '/dev/mapper/crypt' + # lv swap + lvcreate --name 'swap' --size '68719476736b' 'crypt' + # lv data + lvcreate --name 'data' --extents '100%FREE' 'crypt' + # format swap + mkswap --label 'swap' '/dev/mapper/crypt-swap' + # format data + mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' + # vg off + vgchange --activate n 'crypt' + # close + cryptsetup luksClose 'crypt' +} From 0e8ea7af97d7caeb8e82d06054aa1d284652da08 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:16:32 +0200 Subject: [PATCH 133/702] hetzner/function --- bash/hetzner-rescue.sh | 74 +++--------------------------------------- 1 file changed, 5 insertions(+), 69 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index bcd66c4..24fc8c4 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -1,4 +1,4 @@ -function ovh-rescue-configure { +function hetzner-rescue-configure { local host="${1}" local packages=( 'byobu' 'mosh' @@ -46,7 +46,7 @@ fr_FR.UTF-8 UTF-8 apt_clean_cache } -function ovh-rescue-install { +function hetzner-rescue-install { local release='buster' local packages=( # installed @@ -85,7 +85,7 @@ function ovh-rescue-install { apt_clean_cache } -function ovh-rescue-upload { +function hetzner-rescue-upload { local host="${1}" if [ "${host}" ] ; then local user='root' @@ -101,11 +101,11 @@ if [ "${host}" ] ; then rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure '${host}'" + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; hetzner-rescue-configure '${host}'" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys 'ovh-rescue-install' 'C-m' + ssh "${user_host}" -- byobu send-keys 'hetzner-rescue-install' 'C-m' # attach session mosh "${user_host}" -- byobu attach-session else @@ -113,67 +113,3 @@ else return 1 fi } - -function ovh-rescue-wipe-1-2TB { - local device='/dev/sda' - local unit='mib' - # - lsblk - echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' - read - # - parted "${device}" --script mktable gpt - # - parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 - # - parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 - # - parted "${device}" unit "${unit}" mkpart 'esp' 2 259 - parted "${device}" set 3 esp on - # - parted "${device}" unit "${unit}" mkpart bios 1 2 - parted "${device}" set 4 bios_grub on - # wipe bios - dd if='/dev/zero' of='/dev/sda4' - # format esp - mkfs.vfat -F 32 -n 'esp' '/dev/sda3' - # format boot - mkfs.ext4 -F -L 'boot' '/dev/sda2' - # read passphrase - local passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/sda1' - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/sda1' 'crypt' - # pv - pvcreate '/dev/mapper/crypt' - # vg - vgcreate 'crypt' '/dev/mapper/crypt' - # lv swap - lvcreate --name 'swap' --size '68719476736b' 'crypt' - # lv data - lvcreate --name 'data' --extents '100%FREE' 'crypt' - # format swap - mkswap --label 'swap' '/dev/mapper/crypt-swap' - # format data - mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' - # vg off - vgchange --activate n 'crypt' - # close - cryptsetup luksClose 'crypt' -} From dee85aab3beb130c249f1378c241f0c3f0e96b79 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:28:25 +0200 Subject: [PATCH 134/702] hetzner/bookworm --- bash/hetzner-rescue.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 24fc8c4..683388a 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -17,10 +17,10 @@ Dpkg::Progress True; " > '/etc/apt/apt.conf' # apt / sources echo -n "\ -deb https://deb.debian.org/debian buster main contrib non-free -deb https://deb.debian.org/debian buster-backports main contrib non-free -deb https://deb.debian.org/debian buster-updates main contrib non-free -deb https://deb.debian.org/debian-security buster/updates main contrib non-free +deb https://deb.debian.org/debian bookworm main non-free-firmware contrib non-free +deb https://deb.debian.org/debian bookworm-backports main non-free-firmware contrib non-free +deb https://deb.debian.org/debian bookworm-updates main non-free-firmware contrib non-free +deb https://deb.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free " > '/etc/apt/sources.list' # bash / rc main_link_bashrc From dcf52827211b20885a9fc4385b24c58e011a2dac Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:35:16 +0200 Subject: [PATCH 135/702] =?UTF-8?q?=E2=88=92fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/hetzner-rescue.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 683388a..e140193 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -31,9 +31,6 @@ deb https://deb.debian.org/debian-security bookworm-security main non-free-firmw en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 " > '/etc/locale.gen' - # fix alias - rm --force '/usr/share/locale/locale.alias' - ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' # generate locales locale-gen # update catalog From 9b873d35f211422b8d910a12623a2c29ff8d99fb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:42:39 +0200 Subject: [PATCH 136/702] hetzner/bookworm --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index e140193..1e16562 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -44,7 +44,7 @@ fr_FR.UTF-8 UTF-8 } function hetzner-rescue-install { - local release='buster' + local release='bookworm' local packages=( # installed 'parted' 'mdadm' 'lvm2' From 6cf84b81b3a48cc8c10303a80d48e4da103238f7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:44:13 +0200 Subject: [PATCH 137/702] file --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 1e16562..a2f6577 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,10 +47,10 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'parted' 'mdadm' 'lvm2' + 'file' 'parted' 'mdadm' 'lvm2' # install 'lshw' - 'file' 'micro' + 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' 'htop' 'iotop' 'lsof' 'exa' 'ncdu' 'nnn' 'ranger' 'tree' From 4415132cfd65d4bd7fbe5f2f00176aaaa3cea071 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:45:30 +0200 Subject: [PATCH 138/702] htop --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index a2f6577..5a2a9ba 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,12 +47,12 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'file' 'parted' 'mdadm' 'lvm2' + 'file' 'htop' 'parted' 'mdadm' 'lvm2' # install 'lshw' 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' - 'htop' 'iotop' 'lsof' + 'iotop' 'lsof' 'exa' 'ncdu' 'nnn' 'ranger' 'tree' 'squashfs-tools' 'uuid-runtime' From 8013de8704c05aacaf6b6d4b7e5d9244015c43d3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:46:35 +0200 Subject: [PATCH 139/702] lsof --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 5a2a9ba..f4b9c30 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,12 +47,12 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'file' 'htop' 'parted' 'mdadm' 'lvm2' + 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' # install 'lshw' 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' - 'iotop' 'lsof' + 'iotop' 'exa' 'ncdu' 'nnn' 'ranger' 'tree' 'squashfs-tools' 'uuid-runtime' From 76e8b3af28bf85773aa00875e9bfabad54031474 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:49:10 +0200 Subject: [PATCH 140/702] tree --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index f4b9c30..d5a177a 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,13 +47,13 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' + 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' # install 'lshw' 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' 'iotop' - 'exa' 'ncdu' 'nnn' 'ranger' 'tree' + 'exa' 'ncdu' 'nnn' 'ranger' 'squashfs-tools' 'uuid-runtime' ) From 5243263397884d7244d617f11de29106b92cf0ed Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:49:48 +0200 Subject: [PATCH 141/702] lf --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d5a177a..9e6dfd6 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -53,7 +53,7 @@ function hetzner-rescue-install { 'micro' 'grub-efi-amd64-bin' 'grub-pc-bin' 'iotop' - 'exa' 'ncdu' 'nnn' 'ranger' + 'exa' 'lf' 'ncdu' 'nnn' 'ranger' 'squashfs-tools' 'uuid-runtime' ) From 3c0a7530490c936f055a320f8b5873f4e50aa99b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:51:36 +0200 Subject: [PATCH 142/702] uuid-runtime --- bash/hetzner-rescue.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 9e6dfd6..58d170e 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,7 +47,7 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' + 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install 'lshw' 'micro' @@ -55,7 +55,6 @@ function hetzner-rescue-install { 'iotop' 'exa' 'lf' 'ncdu' 'nnn' 'ranger' 'squashfs-tools' - 'uuid-runtime' ) local backports=( # installed From ad4b5f7e6c6efc516486b1b72f1a09ee9e785d08 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:53:11 +0200 Subject: [PATCH 143/702] cryptsetup-bin --- bash/hetzner-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 58d170e..24aaa36 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,6 +47,7 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed + 'cryptsetup-bin' 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install 'lshw' @@ -58,7 +59,7 @@ function hetzner-rescue-install { ) local backports=( # installed - 'cryptsetup-bin' 'rsync' + 'rsync' # install 'git' ) From b6b923e1dda4283a5be6a79bc4a041da60de6330 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:54:34 +0200 Subject: [PATCH 144/702] rsync --- bash/hetzner-rescue.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 24aaa36..d7b9c71 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,7 +47,7 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'cryptsetup-bin' + 'cryptsetup-bin' 'rsync' 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install 'lshw' @@ -58,8 +58,6 @@ function hetzner-rescue-install { 'squashfs-tools' ) local backports=( - # installed - 'rsync' # install 'git' ) From 67580388fa40263f34f62683040bd85473acb3a1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 18:58:03 +0200 Subject: [PATCH 145/702] git --- bash/hetzner-rescue.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d7b9c71..fc8e643 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,7 +47,8 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'cryptsetup-bin' 'rsync' + 'cryptsetup-bin' + 'git' 'rsync' 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install 'lshw' @@ -58,8 +59,6 @@ function hetzner-rescue-install { 'squashfs-tools' ) local backports=( - # install - 'git' ) # update catalog apt-get update From 237953e785f56c1c42bd9a43344270b427b08b1d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:05:58 +0200 Subject: [PATCH 146/702] btrfs-progs --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index fc8e643..cc32c42 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,7 +47,7 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'cryptsetup-bin' + 'btrfs-progs' 'cryptsetup-bin' 'git' 'rsync' 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install From 3ff07ed4612787ac448c27230c761b1cb2cf2f60 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:11:39 +0200 Subject: [PATCH 147/702] dosfstools --- bash/hetzner-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index cc32c42..5feda34 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -47,7 +47,8 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'btrfs-progs' 'cryptsetup-bin' + 'cryptsetup-bin' + 'btrfs-progs' 'dosfstools' 'git' 'rsync' 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' # install From e69255533424184088e608e3397141b9f9a1f665 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:13:23 +0200 Subject: [PATCH 148/702] sha3 --- bash/hetzner-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 5feda34..a583197 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -54,6 +54,7 @@ function hetzner-rescue-install { # install 'lshw' 'micro' + 'libdigest-sha3-perl' 'grub-efi-amd64-bin' 'grub-pc-bin' 'iotop' 'exa' 'lf' 'ncdu' 'nnn' 'ranger' From e458a78afe8e58f5b5fcd4d7d3eb246c084bfb7d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:32:50 +0200 Subject: [PATCH 149/702] package --- bash/hetzner-rescue.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index a583197..3543a21 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -1,5 +1,6 @@ function hetzner-rescue-configure { local host="${1}" + local package local packages=( 'byobu' 'mosh' ) @@ -38,12 +39,16 @@ fr_FR.UTF-8 UTF-8 # debian_disable_frontend # install packages - apt-get install --assume-yes "${packages[@]}" - # - apt_clean_cache + for package in "${packages[@]}" ; do + apt-get install \ + --assume-yes \ + "${package}" + apt_clean_cache + done } function hetzner-rescue-install { + local package local release='bookworm' local packages=( # installed @@ -71,14 +76,20 @@ function hetzner-rescue-install { # apt_clean_cache # install packages - apt-get install --assume-yes "${packages[@]}" - # - apt_clean_cache + for package in "${packages[@]}" ; do + apt-get install \ + --assume-yes \ + "${package}" + apt_clean_cache + done # install backports - apt-get install --assume-yes \ - --target-release "${release}-backports" "${backports[@]}" - # - apt_clean_cache + for package in "${backports[@]}" ; do + apt-get install \ + --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done } function hetzner-rescue-upload { From 23c14ff9667916d3a4081cc3ba132c80c1b48b18 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:35:18 +0200 Subject: [PATCH 150/702] apt-file --- bash/hetzner-rescue.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 3543a21..36f24b7 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -2,7 +2,7 @@ function hetzner-rescue-configure { local host="${1}" local package local packages=( - 'byobu' 'mosh' + 'mosh' 'byobu' 'apt-file' ) # apt / conf echo -n "\ @@ -45,6 +45,8 @@ fr_FR.UTF-8 UTF-8 "${package}" apt_clean_cache done + # update catalog + apt-get update } function hetzner-rescue-install { From 7a2d2e3f7e91ace57a8194db945f2c078906449c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:39:41 +0200 Subject: [PATCH 151/702] echo --- bash/hetzner-rescue.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 36f24b7..1139eb4 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -40,6 +40,7 @@ fr_FR.UTF-8 UTF-8 debian_disable_frontend # install packages for package in "${packages[@]}" ; do + echo ; echo "${package}" apt-get install \ --assume-yes \ "${package}" @@ -79,6 +80,7 @@ function hetzner-rescue-install { apt_clean_cache # install packages for package in "${packages[@]}" ; do + echo ; echo "${package}" apt-get install \ --assume-yes \ "${package}" @@ -86,6 +88,7 @@ function hetzner-rescue-install { done # install backports for package in "${backports[@]}" ; do + echo ; echo "${package}" apt-get install \ --assume-yes \ --target-release "${release}-backports" \ From ab50c39bbbcba42c28d0c1fd906c3a1a233e9430 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:45:03 +0200 Subject: [PATCH 152/702] installed --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 1139eb4..a61b1e1 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -55,10 +55,10 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed - 'cryptsetup-bin' + 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' 'btrfs-progs' 'dosfstools' 'git' 'rsync' - 'file' 'htop' 'lsof' 'parted' 'mdadm' 'lvm2' 'tree' 'uuid-runtime' + 'file' 'htop' 'lsof' 'tree' 'uuid-runtime' # install 'lshw' 'micro' From 7fe64724c2c5f39e862db1a547c7dec7509c149b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:46:19 +0200 Subject: [PATCH 153/702] nano,vim --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index a61b1e1..19ffdc4 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -57,7 +57,7 @@ function hetzner-rescue-install { # installed 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' 'btrfs-progs' 'dosfstools' - 'git' 'rsync' + 'git' 'nano' 'rsync' 'vim' 'file' 'htop' 'lsof' 'tree' 'uuid-runtime' # install 'lshw' From f6c861e0d9873792cc88feb8e712e24d9356cba5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:50:29 +0200 Subject: [PATCH 154/702] install --- bash/hetzner-rescue.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 19ffdc4..64845df 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -61,12 +61,10 @@ function hetzner-rescue-install { 'file' 'htop' 'lsof' 'tree' 'uuid-runtime' # install 'lshw' - 'micro' - 'libdigest-sha3-perl' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'iotop' - 'exa' 'lf' 'ncdu' 'nnn' 'ranger' 'squashfs-tools' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'libdigest-sha3-perl' 'micro' + 'exa' 'iotop' 'lf' 'ncdu' 'nnn' 'ranger' ) local backports=( ) From 34640e91832a345f57632d8da9639046515c74ae Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 19:51:47 +0200 Subject: [PATCH 155/702] py3 --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 64845df..8246edf 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -57,7 +57,7 @@ function hetzner-rescue-install { # installed 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' 'btrfs-progs' 'dosfstools' - 'git' 'nano' 'rsync' 'vim' + 'git' 'nano' 'python3' 'rsync' 'vim' 'file' 'htop' 'lsof' 'tree' 'uuid-runtime' # install 'lshw' From 8dbf6952332a9b8db5187f0def23bb75779db59d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 21:03:30 +0200 Subject: [PATCH 156/702] installed --- bash/hetzner-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 8246edf..ffc7d96 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -55,10 +55,11 @@ function hetzner-rescue-install { local release='bookworm' local packages=( # installed + 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' 'btrfs-progs' 'dosfstools' 'git' 'nano' 'python3' 'rsync' 'vim' - 'file' 'htop' 'lsof' 'tree' 'uuid-runtime' + 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' # install 'lshw' 'squashfs-tools' From 2fde68b230804dd2f0a23466a27e5283c58fb08f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 21:06:25 +0200 Subject: [PATCH 157/702] screen,tmux --- bash/hetzner-rescue.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index ffc7d96..62329ac 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -2,7 +2,9 @@ function hetzner-rescue-configure { local host="${1}" local package local packages=( - 'mosh' 'byobu' 'apt-file' + 'mosh' + 'screen' 'tmux' 'byobu' + 'apt-file' ) # apt / conf echo -n "\ From 0606d172938d5303e6e579d202794e13450c3b40 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 21:07:51 +0200 Subject: [PATCH 158/702] ipcalc --- bash/hetzner-rescue.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 62329ac..df0c553 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -67,7 +67,8 @@ function hetzner-rescue-install { 'squashfs-tools' 'grub-efi-amd64-bin' 'grub-pc-bin' 'libdigest-sha3-perl' 'micro' - 'exa' 'iotop' 'lf' 'ncdu' 'nnn' 'ranger' + 'iotop' + 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' ) local backports=( ) From 34ead4eb5dd11b4a26c59de5dd979f7c4861e8fc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 2 Oct 2023 21:19:27 +0200 Subject: [PATCH 159/702] .bashrc --- bash/hetzner-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index df0c553..5b30618 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -27,6 +27,7 @@ deb https://deb.debian.org/debian-security bookworm-security main non-free-firmw " > '/etc/apt/sources.list' # bash / rc main_link_bashrc + mv .bashrc .bashrc.old # host name hostname "${host}" # locales From 63b62a6f09a9150eedbd3a5dbee8987b7b8e4c61 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 04:18:00 +0200 Subject: [PATCH 160/702] wipe --- bash/hetzner-rescue.sh | 64 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 5b30618..7c378df 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -128,3 +128,67 @@ else return 1 fi } + +function hetzner-rescue-wipe-12-10-10 { + local device='/dev/sda' + local unit='mib' + # + lsblk + echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' + read + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 + # + parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 + # + parted "${device}" unit "${unit}" mkpart 'esp' 2 259 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" mkpart bios 1 2 + parted "${device}" set 4 bios_grub on + # wipe bios + dd if='/dev/zero' of='/dev/sda4' + # format esp + mkfs.vfat -F 32 -n 'esp' '/dev/sda3' + # format boot + mkfs.ext4 -F -L 'boot' '/dev/sda2' + # read passphrase + local passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/sda1' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/sda1' 'crypt' + # pv + pvcreate '/dev/mapper/crypt' + # vg + vgcreate 'crypt' '/dev/mapper/crypt' + # lv swap + lvcreate --name 'swap' --size '68719476736b' 'crypt' + # lv data + lvcreate --name 'data' --extents '100%FREE' 'crypt' + # format swap + mkswap --label 'swap' '/dev/mapper/crypt-swap' + # format data + mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' + # vg off + vgchange --activate n 'crypt' + # close + cryptsetup luksClose 'crypt' +} From 4514296ee479c847877a798456289ff8ba14a498 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 04:20:24 +0200 Subject: [PATCH 161/702] device,devices --- bash/hetzner-rescue.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 7c378df..8182eb9 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -130,7 +130,12 @@ fi } function hetzner-rescue-wipe-12-10-10 { - local device='/dev/sda' + local device + local devices=( + '/dev/sdc' + '/dev/sda' + '/dev/sdb' + ) local unit='mib' # lsblk From 7905892e5966b162272d71c406bb1bfe1955a388 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 04:32:23 +0200 Subject: [PATCH 162/702] number,mktable --- bash/hetzner-rescue.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 8182eb9..e28aeaf 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -136,13 +136,19 @@ function hetzner-rescue-wipe-12-10-10 { '/dev/sda' '/dev/sdb' ) + local number=0 local unit='mib' # lsblk echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' read # - parted "${device}" --script mktable gpt + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" + # + parted "${device}" --script mktable gpt + done # parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 # From 22f0f463df6274b31f1faa7b58bf04db1046d247 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:01:14 +0200 Subject: [PATCH 163/702] crypt --- bash/hetzner-rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index e28aeaf..701263b 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -148,10 +148,11 @@ function hetzner-rescue-wipe-12-10-10 { echo ; echo "#${number}: ${device}" # parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" \ + mkpart "crypt-${number}" 22359 9537535 done # - parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 - # parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 # parted "${device}" unit "${unit}" mkpart 'esp' 2 259 From 6bd52d184e6db6fbd9c5d2a1973b711bd177ba93 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:02:34 +0200 Subject: [PATCH 164/702] boot --- bash/hetzner-rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 701263b..4e5c2ae 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -151,10 +151,11 @@ function hetzner-rescue-wipe-12-10-10 { # parted "${device}" unit "${unit}" \ mkpart "crypt-${number}" 22359 9537535 + # + parted "${device}" unit "${unit}" \ + mkpart "boot-${number}" 513 22359 done # - parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 - # parted "${device}" unit "${unit}" mkpart 'esp' 2 259 parted "${device}" set 3 esp on # From e36e590799e57bea2b54b2f6654d60dcc921e0d7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:05:05 +0200 Subject: [PATCH 165/702] esp --- bash/hetzner-rescue.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 4e5c2ae..d6f763f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -154,11 +154,12 @@ function hetzner-rescue-wipe-12-10-10 { # parted "${device}" unit "${unit}" \ mkpart "boot-${number}" 513 22359 + # + parted "${device}" unit "${unit}" \ + mkpart "esp-${number}" 2 513 + parted "${device}" set 3 esp on done # - parted "${device}" unit "${unit}" mkpart 'esp' 2 259 - parted "${device}" set 3 esp on - # parted "${device}" unit "${unit}" mkpart bios 1 2 parted "${device}" set 4 bios_grub on # wipe bios From 0c2df7cb6d0546243bd7bad51f87847903c49bee Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:09:15 +0200 Subject: [PATCH 166/702] bios --- bash/hetzner-rescue.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d6f763f..a5588be 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -158,10 +158,11 @@ function hetzner-rescue-wipe-12-10-10 { parted "${device}" unit "${unit}" \ mkpart "esp-${number}" 2 513 parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" \ + mkpart "bios-${number}" 1 2 + parted "${device}" set 4 bios_grub on done - # - parted "${device}" unit "${unit}" mkpart bios 1 2 - parted "${device}" set 4 bios_grub on # wipe bios dd if='/dev/zero' of='/dev/sda4' # format esp From adcc61b37730bd91fe81bb11373fc41bf64a305f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:11:55 +0200 Subject: [PATCH 167/702] bios --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index a5588be..5833bf0 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -162,9 +162,9 @@ function hetzner-rescue-wipe-12-10-10 { parted "${device}" unit "${unit}" \ mkpart "bios-${number}" 1 2 parted "${device}" set 4 bios_grub on + # wipe bios + dd if='/dev/zero' of="${device}4" done - # wipe bios - dd if='/dev/zero' of='/dev/sda4' # format esp mkfs.vfat -F 32 -n 'esp' '/dev/sda3' # format boot From d9c6a67d4005141504f875bf5cc0c7a6f817f910 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:15:38 +0200 Subject: [PATCH 168/702] esp --- bash/hetzner-rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 5833bf0..2dc00e3 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -164,9 +164,10 @@ function hetzner-rescue-wipe-12-10-10 { parted "${device}" set 4 bios_grub on # wipe bios dd if='/dev/zero' of="${device}4" + # format esp + dd if='/dev/zero' of="${device}3" + mkfs.vfat -F 32 -n "esp-${number}" "${device}3" done - # format esp - mkfs.vfat -F 32 -n 'esp' '/dev/sda3' # format boot mkfs.ext4 -F -L 'boot' '/dev/sda2' # read passphrase From 74a27a077c7251d74bee488e3bb4d8d0c49c83a3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:18:39 +0200 Subject: [PATCH 169/702] number --- bash/hetzner-rescue.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 2dc00e3..7cde848 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -136,13 +136,14 @@ function hetzner-rescue-wipe-12-10-10 { '/dev/sda' '/dev/sdb' ) - local number=0 + local number local unit='mib' # lsblk echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' read # + number=0 for device in "${devices[@]}" ; do ((number++)) echo ; echo "#${number}: ${device}" @@ -162,8 +163,20 @@ function hetzner-rescue-wipe-12-10-10 { parted "${device}" unit "${unit}" \ mkpart "bios-${number}" 1 2 parted "${device}" set 4 bios_grub on + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" # wipe bios dd if='/dev/zero' of="${device}4" + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" # format esp dd if='/dev/zero' of="${device}3" mkfs.vfat -F 32 -n "esp-${number}" "${device}3" From 3ac8efc19d5b749f3414c2eb445afa9f19a74e66 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:29:11 +0200 Subject: [PATCH 170/702] boot --- bash/hetzner-rescue.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 7cde848..d14dac2 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -181,6 +181,15 @@ function hetzner-rescue-wipe-12-10-10 { dd if='/dev/zero' of="${device}3" mkfs.vfat -F 32 -n "esp-${number}" "${device}3" done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" + # wipe boot + dd if='/dev/zero' of="${device}2" bs='1G' status='progress' + done +#### # format boot mkfs.ext4 -F -L 'boot' '/dev/sda2' # read passphrase From 1624f18fc8d53ee59d9d5fbd019f28fa43bf9d4b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:38:26 +0200 Subject: [PATCH 171/702] cut --- bash/hetzner-rescue.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d14dac2..aaa240c 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -189,7 +189,9 @@ function hetzner-rescue-wipe-12-10-10 { # wipe boot dd if='/dev/zero' of="${device}2" bs='1G' status='progress' done -#### +} + +function hetzner-rescue-wipe-12-10-10-extra { # format boot mkfs.ext4 -F -L 'boot' '/dev/sda2' # read passphrase From a5cf152c80c6b3525688a516250cabc620536303 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 05:44:42 +0200 Subject: [PATCH 172/702] extra --- bash/hetzner-rescue.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index aaa240c..619bc91 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -165,6 +165,9 @@ function hetzner-rescue-wipe-12-10-10 { parted "${device}" set 4 bios_grub on done # + parted "${device}" unit "${unit}" \ + mkpart 'extra' 9537535 11444223 + # number=0 for device in "${devices[@]}" ; do ((number++)) From f71653e290743d6dda84536bf545f9dc74bd14c2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:44:16 +0200 Subject: [PATCH 173/702] members --- bash/hetzner-rescue.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 619bc91..ee47d11 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -136,6 +136,7 @@ function hetzner-rescue-wipe-12-10-10 { '/dev/sda' '/dev/sdb' ) + local members local number local unit='mib' # @@ -192,6 +193,32 @@ function hetzner-rescue-wipe-12-10-10 { # wipe boot dd if='/dev/zero' of="${device}2" bs='1G' status='progress' done + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}2") + done + mdadm \ + --create '/dev/md/boot' \ + --name 'boot' \ + --uuid '6234a0eb:29a3a847:1dbd5ec4:bada5579' \ + --metadata 1 \ + --level 0 \ + --raid-devices ${#devices[@]} \ + "${members[@]}" + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}1") + done + mdadm \ + --create '/dev/md/crypt' \ + --name 'crypt' \ + --uuid '006234a0:eb29a3a8:471dbd5e:c4bada55' \ + --metadata 1 \ + --level 0 \ + --raid-devices ${#devices[@]} \ + "${members[@]}" } function hetzner-rescue-wipe-12-10-10-extra { From f4cda4c0960da90e83005789a1f66366fcb463b0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:46:44 +0200 Subject: [PATCH 174/702] boot --- bash/hetzner-rescue.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index ee47d11..1dd40d1 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -219,11 +219,15 @@ function hetzner-rescue-wipe-12-10-10 { --level 0 \ --raid-devices ${#devices[@]} \ "${members[@]}" + # format boot + mkfs.ext4 \ + -F \ + -L 'boot' \ + -U '6234a0eb-29a3-a847-1dbd-5ec4bada5579' \ + '/dev/md/boot' } function hetzner-rescue-wipe-12-10-10-extra { - # format boot - mkfs.ext4 -F -L 'boot' '/dev/sda2' # read passphrase local passphrase echo -n 'PassPhrase: ' From 8fbfabb388ec21b3c8b2ba3e4276224743fd0768 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:50:47 +0200 Subject: [PATCH 175/702] passphrase --- bash/hetzner-rescue.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 1dd40d1..10557aa 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -138,10 +138,14 @@ function hetzner-rescue-wipe-12-10-10 { ) local members local number + local passphrase local unit='mib' + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase # lsblk - echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' + echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' read # number=0 @@ -228,10 +232,6 @@ function hetzner-rescue-wipe-12-10-10 { } function hetzner-rescue-wipe-12-10-10-extra { - # read passphrase - local passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase # encrypt echo "${passphrase}" \ | cryptsetup \ From eeda17878a8ac1468f5835928de99ea07f8367b5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:52:33 +0200 Subject: [PATCH 176/702] cryptsetup --- bash/hetzner-rescue.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 10557aa..f19ab4a 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -229,9 +229,6 @@ function hetzner-rescue-wipe-12-10-10 { -L 'boot' \ -U '6234a0eb-29a3-a847-1dbd-5ec4bada5579' \ '/dev/md/boot' -} - -function hetzner-rescue-wipe-12-10-10-extra { # encrypt echo "${passphrase}" \ | cryptsetup \ @@ -245,7 +242,10 @@ function hetzner-rescue-wipe-12-10-10-extra { --hash 'sha512' \ --use-random \ luksFormat \ - '/dev/sda1' + '/dev/md/crypt' +} + +function hetzner-rescue-wipe-12-10-10-extra { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/sda1' 'crypt' From d58afc82266630fb4533cdce5bf31d37005c6119 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:54:01 +0200 Subject: [PATCH 177/702] open,close --- bash/hetzner-rescue.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index f19ab4a..929c262 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -243,12 +243,15 @@ function hetzner-rescue-wipe-12-10-10 { --use-random \ luksFormat \ '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' +#### + # close + cryptsetup luksClose 'crypt' } function hetzner-rescue-wipe-12-10-10-extra { - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/sda1' 'crypt' # pv pvcreate '/dev/mapper/crypt' # vg @@ -263,6 +266,4 @@ function hetzner-rescue-wipe-12-10-10-extra { mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' # vg off vgchange --activate n 'crypt' - # close - cryptsetup luksClose 'crypt' } From d969810396fa4f5f79b5d9371c974e9f68e5bb95 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:55:08 +0200 Subject: [PATCH 178/702] pv,vg --- bash/hetzner-rescue.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 929c262..c2431ff 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -246,16 +246,18 @@ function hetzner-rescue-wipe-12-10-10 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # pv + pvcreate '/dev/mapper/crypt' + # vg + vgcreate 'crypt' '/dev/mapper/crypt' #### + # vg off + vgchange --activate n 'crypt' # close cryptsetup luksClose 'crypt' } function hetzner-rescue-wipe-12-10-10-extra { - # pv - pvcreate '/dev/mapper/crypt' - # vg - vgcreate 'crypt' '/dev/mapper/crypt' # lv swap lvcreate --name 'swap' --size '68719476736b' 'crypt' # lv data @@ -264,6 +266,4 @@ function hetzner-rescue-wipe-12-10-10-extra { mkswap --label 'swap' '/dev/mapper/crypt-swap' # format data mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' - # vg off - vgchange --activate n 'crypt' } From 969734c4cd2f83c15a77d751fe0919125a7f3546 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:57:39 +0200 Subject: [PATCH 179/702] lv --- bash/hetzner-rescue.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index c2431ff..ad04071 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -250,6 +250,10 @@ function hetzner-rescue-wipe-12-10-10 { pvcreate '/dev/mapper/crypt' # vg vgcreate 'crypt' '/dev/mapper/crypt' + # lv swap + lvcreate --name 'swap' --size '68719476736b' 'crypt' + # lv data + lvcreate --name 'data' --extents '100%FREE' 'crypt' #### # vg off vgchange --activate n 'crypt' @@ -258,10 +262,6 @@ function hetzner-rescue-wipe-12-10-10 { } function hetzner-rescue-wipe-12-10-10-extra { - # lv swap - lvcreate --name 'swap' --size '68719476736b' 'crypt' - # lv data - lvcreate --name 'data' --extents '100%FREE' 'crypt' # format swap mkswap --label 'swap' '/dev/mapper/crypt-swap' # format data From cf4d94535036bf022c6713272613e5805025dff8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:58:47 +0200 Subject: [PATCH 180/702] swap --- bash/hetzner-rescue.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index ad04071..da3514b 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -254,6 +254,11 @@ function hetzner-rescue-wipe-12-10-10 { lvcreate --name 'swap' --size '68719476736b' 'crypt' # lv data lvcreate --name 'data' --extents '100%FREE' 'crypt' + # format swap + mkswap \ + --label 'swap' \ + -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ + '/dev/mapper/crypt-swap' #### # vg off vgchange --activate n 'crypt' @@ -262,8 +267,6 @@ function hetzner-rescue-wipe-12-10-10 { } function hetzner-rescue-wipe-12-10-10-extra { - # format swap - mkswap --label 'swap' '/dev/mapper/crypt-swap' # format data mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' } From 7cbe78dbc62adf9d2ce07697d34a72a2b296cc80 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 09:59:55 +0200 Subject: [PATCH 181/702] data --- bash/hetzner-rescue.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index da3514b..e5b18fa 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -259,14 +259,13 @@ function hetzner-rescue-wipe-12-10-10 { --label 'swap' \ -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ '/dev/mapper/crypt-swap' -#### + # format data + mkfs.ext4 \ + -L 'data' \ + -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ + '/dev/mapper/crypt-data' # vg off vgchange --activate n 'crypt' # close cryptsetup luksClose 'crypt' } - -function hetzner-rescue-wipe-12-10-10-extra { - # format data - mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' -} From 3972d3ce394278cfca3b10b971973db5648d279c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 10:05:29 +0200 Subject: [PATCH 182/702] split --- bash/hetzner-rescue.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index e5b18fa..c710da4 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -129,7 +129,7 @@ else fi } -function hetzner-rescue-wipe-12-10-10 { +function hetzner-rescue-wipe-12-10-10-0 { local device local devices=( '/dev/sdc' @@ -246,6 +246,33 @@ function hetzner-rescue-wipe-12-10-10 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' +#### + # close + cryptsetup luksClose 'crypt' +} + +function hetzner-rescue-wipe-12-10-10-1 { + local passphrase + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' # pv pvcreate '/dev/mapper/crypt' # vg From 71f0ef08567add6312feec1921027b7eff9b2d44 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 10:11:41 +0200 Subject: [PATCH 183/702] crypt --- bash/hetzner-rescue.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index c710da4..8aae4d3 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -178,7 +178,8 @@ function hetzner-rescue-wipe-12-10-10-0 { ((number++)) echo ; echo "#${number}: ${device}" # wipe bios - dd if='/dev/zero' of="${device}4" + dd \ + if='/dev/zero' of="${device}4" done # number=0 @@ -186,7 +187,8 @@ function hetzner-rescue-wipe-12-10-10-0 { ((number++)) echo ; echo "#${number}: ${device}" # format esp - dd if='/dev/zero' of="${device}3" + dd \ + if='/dev/zero' of="${device}3" mkfs.vfat -F 32 -n "esp-${number}" "${device}3" done # @@ -195,7 +197,8 @@ function hetzner-rescue-wipe-12-10-10-0 { ((number++)) echo ; echo "#${number}: ${device}" # wipe boot - dd if='/dev/zero' of="${device}2" bs='1G' status='progress' + dd status='progress' \ + if='/dev/zero' of="${device}2" bs='1G' done # members=() @@ -246,7 +249,9 @@ function hetzner-rescue-wipe-12-10-10-0 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' -#### + # wipe crypt + dd status='progress' \ + if='/dev/zero' of='/dev/mapper/crypt' bs='16G' # close cryptsetup luksClose 'crypt' } From afc8c6c83365beea4d530eca1a0162170fc97e23 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 11:07:38 +0200 Subject: [PATCH 184/702] hostname --- bash/hetzner-rescue.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 8aae4d3..261c7e5 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -1,5 +1,5 @@ function hetzner-rescue-configure { -local host="${1}" +local hostname="${1}" local package local packages=( 'mosh' @@ -29,7 +29,7 @@ deb https://deb.debian.org/debian-security bookworm-security main non-free-firmw main_link_bashrc mv .bashrc .bashrc.old # host name - hostname "${host}" + hostname "${hostname}" # locales echo -n "\ en_US.UTF-8 UTF-8 @@ -102,7 +102,8 @@ function hetzner-rescue-install { function hetzner-rescue-upload { local host="${1}" -if [ "${host}" ] ; then +local hostname="${2}" +if [ "${hostname}" ] ; then local user='root' # local user_host="${user}@${host}" @@ -116,7 +117,7 @@ if [ "${host}" ] ; then rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; hetzner-rescue-configure '${host}'" + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; hetzner-rescue-configure '${hostname}'" # create session ssh "${user_host}" -- byobu new-session -d # send keys From 6f752c3afc8901d20bd62d2be2a5c5cc8c354b7d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 11:39:34 +0200 Subject: [PATCH 185/702] esp/bs --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 261c7e5..2182e15 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -189,7 +189,7 @@ function hetzner-rescue-wipe-12-10-10-0 { echo ; echo "#${number}: ${device}" # format esp dd \ - if='/dev/zero' of="${device}3" + if='/dev/zero' of="${device}3" bs='1M' mkfs.vfat -F 32 -n "esp-${number}" "${device}3" done # From 10aa0b80b5c23f994e250bc8e54ab7e32edbd573 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 11:43:10 +0200 Subject: [PATCH 186/702] 4,3,2 --- bash/hetzner-rescue.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 2182e15..dcaf24f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -177,7 +177,7 @@ function hetzner-rescue-wipe-12-10-10-0 { number=0 for device in "${devices[@]}" ; do ((number++)) - echo ; echo "#${number}: ${device}" + echo ; echo "#${number}: ${device}4" # wipe bios dd \ if='/dev/zero' of="${device}4" @@ -186,7 +186,7 @@ function hetzner-rescue-wipe-12-10-10-0 { number=0 for device in "${devices[@]}" ; do ((number++)) - echo ; echo "#${number}: ${device}" + echo ; echo "#${number}: ${device}3" # format esp dd \ if='/dev/zero' of="${device}3" bs='1M' @@ -196,7 +196,7 @@ function hetzner-rescue-wipe-12-10-10-0 { number=0 for device in "${devices[@]}" ; do ((number++)) - echo ; echo "#${number}: ${device}" + echo ; echo "#${number}: ${device}2" # wipe boot dd status='progress' \ if='/dev/zero' of="${device}2" bs='1G' From f796532025782f4f1bffa848f8f23fcf50237da9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Oct 2023 11:46:51 +0200 Subject: [PATCH 187/702] head --- bash/hetzner-rescue.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index dcaf24f..d7b6bd0 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -215,6 +215,15 @@ function hetzner-rescue-wipe-12-10-10-0 { --raid-devices ${#devices[@]} \ "${members[@]}" # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}1" + # wipe crypt head + dd status='progress' \ + if='/dev/zero' of="${device}1" bs='1G' count=1 + done + # members=() for device in "${devices[@]}" ; do members+=("${device}1") From abc7186d573d660795a81c62878aa03241de076f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 4 Oct 2023 08:24:22 +0200 Subject: [PATCH 188/702] close --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d7b6bd0..4254130 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -262,12 +262,12 @@ function hetzner-rescue-wipe-12-10-10-0 { # wipe crypt dd status='progress' \ if='/dev/zero' of='/dev/mapper/crypt' bs='16G' - # close - cryptsetup luksClose 'crypt' } function hetzner-rescue-wipe-12-10-10-1 { local passphrase + # close + cryptsetup luksClose 'crypt' # read passphrase echo -n 'PassPhrase: ' read -r -s passphrase From a98be0588f690a2eaec0bcb0235b1440f1591095 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 4 Oct 2023 08:36:02 +0200 Subject: [PATCH 189/702] swap/128 --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 4254130..58808aa 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -293,7 +293,7 @@ function hetzner-rescue-wipe-12-10-10-1 { # vg vgcreate 'crypt' '/dev/mapper/crypt' # lv swap - lvcreate --name 'swap' --size '68719476736b' 'crypt' + lvcreate --name 'swap' --size '137438953472b' 'crypt' # lv data lvcreate --name 'data' --extents '100%FREE' 'crypt' # format swap From a31d85f16a0f91026fe9fb1b551eaefec3133f72 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Dec 2023 12:31:13 +0100 Subject: [PATCH 190/702] emacs --- bash/alias/emacs.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 bash/alias/emacs.sh diff --git a/bash/alias/emacs.sh b/bash/alias/emacs.sh new file mode 100644 index 0000000..7984a4a --- /dev/null +++ b/bash/alias/emacs.sh @@ -0,0 +1,4 @@ +# short +alias em="\ +emacs \ +" From 9e9434e8e0ec0c2b4e8827aaa3f06457a5b1e655 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 08:36:46 +0100 Subject: [PATCH 191/702] 8-8-0,8-8-1 --- bash/hetzner-rescue.sh | 182 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 58808aa..7e79b7f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -130,6 +130,188 @@ else fi } +function hetzner-rescue-wipe-8-8-0 { + local device + local devices=( + '/dev/sdc' + '/dev/sda' + '/dev/sdb' + ) + local members + local number + local passphrase + local unit='mib' + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # + lsblk + echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' + read + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" \ + mkpart "crypt-${number}" 22359 9537535 + # + parted "${device}" unit "${unit}" \ + mkpart "boot-${number}" 513 22359 + # + parted "${device}" unit "${unit}" \ + mkpart "esp-${number}" 2 513 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" \ + mkpart "bios-${number}" 1 2 + parted "${device}" set 4 bios_grub on + done + # + parted "${device}" unit "${unit}" \ + mkpart 'extra' 9537535 11444223 + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}4" + # wipe bios + dd \ + if='/dev/zero' of="${device}4" + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}3" + # format esp + dd \ + if='/dev/zero' of="${device}3" bs='1M' + mkfs.vfat -F 32 -n "esp-${number}" "${device}3" + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}2" + # wipe boot + dd status='progress' \ + if='/dev/zero' of="${device}2" bs='1G' + done + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}2") + done + mdadm \ + --create '/dev/md/boot' \ + --name 'boot' \ + --uuid '6234a0eb:29a3a847:1dbd5ec4:bada5579' \ + --metadata 1 \ + --level 0 \ + --raid-devices ${#devices[@]} \ + "${members[@]}" + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}1" + # wipe crypt head + dd status='progress' \ + if='/dev/zero' of="${device}1" bs='1G' count=1 + done + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}1") + done + mdadm \ + --create '/dev/md/crypt' \ + --name 'crypt' \ + --uuid '006234a0:eb29a3a8:471dbd5e:c4bada55' \ + --metadata 1 \ + --level 0 \ + --raid-devices ${#devices[@]} \ + "${members[@]}" + # format boot + mkfs.ext4 \ + -F \ + -L 'boot' \ + -U '6234a0eb-29a3-a847-1dbd-5ec4bada5579' \ + '/dev/md/boot' + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # wipe crypt + dd status='progress' \ + if='/dev/zero' of='/dev/mapper/crypt' bs='16G' +} + +function hetzner-rescue-wipe-8-8-1 { + local passphrase + # close + cryptsetup luksClose 'crypt' + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # pv + pvcreate '/dev/mapper/crypt' + # vg + vgcreate 'crypt' '/dev/mapper/crypt' + # lv swap + lvcreate --name 'swap' --size '137438953472b' 'crypt' + # lv data + lvcreate --name 'data' --extents '100%FREE' 'crypt' + # format swap + mkswap \ + --label 'swap' \ + -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ + '/dev/mapper/crypt-swap' + # format data + mkfs.ext4 \ + -L 'data' \ + -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ + '/dev/mapper/crypt-data' + # vg off + vgchange --activate n 'crypt' + # close + cryptsetup luksClose 'crypt' +} + function hetzner-rescue-wipe-12-10-10-0 { local device local devices=( From c00ceaacaf2bde8a045461a27446bd57278adc66 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 09:23:03 +0100 Subject: [PATCH 192/702] parted --- bash/hetzner-rescue.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 7e79b7f..22ac7c2 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -133,7 +133,6 @@ fi function hetzner-rescue-wipe-8-8-0 { local device local devices=( - '/dev/sdc' '/dev/sda' '/dev/sdb' ) @@ -157,13 +156,13 @@ function hetzner-rescue-wipe-8-8-0 { parted "${device}" --script mktable gpt # parted "${device}" unit "${unit}" \ - mkpart "crypt-${number}" 22359 9537535 + mkpart "crypt-${number}" 33282 7630885 # parted "${device}" unit "${unit}" \ - mkpart "boot-${number}" 513 22359 + mkpart "boot-${number}" 514 33282 # parted "${device}" unit "${unit}" \ - mkpart "esp-${number}" 2 513 + mkpart "esp-${number}" 2 514 parted "${device}" set 3 esp on # parted "${device}" unit "${unit}" \ @@ -171,9 +170,6 @@ function hetzner-rescue-wipe-8-8-0 { parted "${device}" set 4 bios_grub on done # - parted "${device}" unit "${unit}" \ - mkpart 'extra' 9537535 11444223 - # number=0 for device in "${devices[@]}" ; do ((number++)) From 874dd04672c4b96b73e6705a680b3a45666efa9d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 10:01:15 +0100 Subject: [PATCH 193/702] mkfs --- bash/hetzner-rescue.sh | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 22ac7c2..bd15e93 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -186,7 +186,11 @@ function hetzner-rescue-wipe-8-8-0 { # format esp dd \ if='/dev/zero' of="${device}3" bs='1M' - mkfs.vfat -F 32 -n "esp-${number}" "${device}3" + mkfs.vfat \ + -F 32 \ + -S 4096 \ + -n "esp-${number}" \ + "${device}3" done # number=0 @@ -195,20 +199,17 @@ function hetzner-rescue-wipe-8-8-0 { echo ; echo "#${number}: ${device}2" # wipe boot dd status='progress' \ - if='/dev/zero' of="${device}2" bs='1G' + if='/dev/zero' of="${device}2" bs='1G' count=1 done # members=() for device in "${devices[@]}" ; do members+=("${device}2") done - mdadm \ - --create '/dev/md/boot' \ - --name 'boot' \ - --uuid '6234a0eb:29a3a847:1dbd5ec4:bada5579' \ - --metadata 1 \ - --level 0 \ - --raid-devices ${#devices[@]} \ + mkfs.btrfs --force \ + --label 'boot' \ + --checksum 'sha256' \ + --data 'raid0' \ "${members[@]}" # number=0 @@ -232,12 +233,6 @@ function hetzner-rescue-wipe-8-8-0 { --level 0 \ --raid-devices ${#devices[@]} \ "${members[@]}" - # format boot - mkfs.ext4 \ - -F \ - -L 'boot' \ - -U '6234a0eb-29a3-a847-1dbd-5ec4bada5579' \ - '/dev/md/boot' # encrypt echo "${passphrase}" \ | cryptsetup \ From b053c65680d0fd89618cd40def476ab2da619837 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 11:26:30 +0100 Subject: [PATCH 194/702] esp/uuid --- bash/hetzner-rescue.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index bd15e93..57ebb04 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -189,6 +189,7 @@ function hetzner-rescue-wipe-8-8-0 { mkfs.vfat \ -F 32 \ -S 4096 \ + -i "b007000${number}" \ -n "esp-${number}" \ "${device}3" done From 58829f7045be5446a9f98edad3ca19440c515771 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 11:58:29 +0100 Subject: [PATCH 195/702] uuid --- bash/hetzner-rescue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 57ebb04..47d3a73 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -189,7 +189,7 @@ function hetzner-rescue-wipe-8-8-0 { mkfs.vfat \ -F 32 \ -S 4096 \ - -i "b007000${number}" \ + -i "000000b${number}" \ -n "esp-${number}" \ "${device}3" done @@ -209,6 +209,7 @@ function hetzner-rescue-wipe-8-8-0 { done mkfs.btrfs --force \ --label 'boot' \ + --uuid '00000000-0000-0000-0000-0000000000b0' \ --checksum 'sha256' \ --data 'raid0' \ "${members[@]}" @@ -229,7 +230,7 @@ function hetzner-rescue-wipe-8-8-0 { mdadm \ --create '/dev/md/crypt' \ --name 'crypt' \ - --uuid '006234a0:eb29a3a8:471dbd5e:c4bada55' \ + --uuid '00000000:00000000:00000000:000000cc' \ --metadata 1 \ --level 0 \ --raid-devices ${#devices[@]} \ From cbabed20177434796e85c0dea49cae28fc422496 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 11:58:57 +0100 Subject: [PATCH 196/702] dd/bs --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 47d3a73..16b5410 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -254,7 +254,7 @@ function hetzner-rescue-wipe-8-8-0 { | cryptsetup luksOpen '/dev/md/crypt' 'crypt' # wipe crypt dd status='progress' \ - if='/dev/zero' of='/dev/mapper/crypt' bs='16G' + if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } function hetzner-rescue-wipe-8-8-1 { From 02f2f5323c6a1822cde4ec2c36501073b8b0081a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:00:25 +0100 Subject: [PATCH 197/702] standalone wipe --- bash/hetzner-rescue.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 16b5410..163589f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -252,12 +252,15 @@ function hetzner-rescue-wipe-8-8-0 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' +} + +function hetzner-rescue-wipe-8-8-1 { # wipe crypt dd status='progress' \ if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } -function hetzner-rescue-wipe-8-8-1 { +function hetzner-rescue-wipe-8-8-2 { local passphrase # close cryptsetup luksClose 'crypt' From f571ad33079fcd676e4b61f1c88d23124336d7b3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:04:51 +0100 Subject: [PATCH 198/702] =?UTF-8?q?=E2=88=92=20lvm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/hetzner-rescue.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 163589f..682c300 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -284,14 +284,6 @@ function hetzner-rescue-wipe-8-8-2 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # pv - pvcreate '/dev/mapper/crypt' - # vg - vgcreate 'crypt' '/dev/mapper/crypt' - # lv swap - lvcreate --name 'swap' --size '137438953472b' 'crypt' - # lv data - lvcreate --name 'data' --extents '100%FREE' 'crypt' # format swap mkswap \ --label 'swap' \ @@ -302,8 +294,6 @@ function hetzner-rescue-wipe-8-8-2 { -L 'data' \ -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ '/dev/mapper/crypt-data' - # vg off - vgchange --activate n 'crypt' # close cryptsetup luksClose 'crypt' } From 5ab4a0054a02f79fc85907d0ed2b889902f33b3c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:06:27 +0100 Subject: [PATCH 199/702] swap --- bash/hetzner-rescue.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 682c300..2c9ad54 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -284,16 +284,16 @@ function hetzner-rescue-wipe-8-8-2 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # format swap - mkswap \ - --label 'swap' \ - -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ - '/dev/mapper/crypt-swap' # format data mkfs.ext4 \ -L 'data' \ -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ '/dev/mapper/crypt-data' + # format swap + mkswap \ + --label 'swap' \ + -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ + '/dev/mapper/crypt-swap' # close cryptsetup luksClose 'crypt' } From 2b1610bbe69b9b58938a1233e97374da3d17d98a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:40:43 +0100 Subject: [PATCH 200/702] crypt/btrfs --- bash/hetzner-rescue.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 2c9ad54..903b0d9 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -189,7 +189,7 @@ function hetzner-rescue-wipe-8-8-0 { mkfs.vfat \ -F 32 \ -S 4096 \ - -i "000000b${number}" \ + -i "0000000${number}" \ -n "esp-${number}" \ "${device}3" done @@ -209,7 +209,7 @@ function hetzner-rescue-wipe-8-8-0 { done mkfs.btrfs --force \ --label 'boot' \ - --uuid '00000000-0000-0000-0000-0000000000b0' \ + --uuid '00000000-0000-0000-0000-00000000000b' \ --checksum 'sha256' \ --data 'raid0' \ "${members[@]}" @@ -230,7 +230,7 @@ function hetzner-rescue-wipe-8-8-0 { mdadm \ --create '/dev/md/crypt' \ --name 'crypt' \ - --uuid '00000000:00000000:00000000:000000cc' \ + --uuid '00000000:00000000:00000000:00000000' \ --metadata 1 \ --level 0 \ --raid-devices ${#devices[@]} \ @@ -285,10 +285,11 @@ function hetzner-rescue-wipe-8-8-2 { echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' # format data - mkfs.ext4 \ - -L 'data' \ - -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ - '/dev/mapper/crypt-data' + mkfs.btrfs --force \ + --label 'crypt' \ + --uuid '00000000-0000-0000-0000-00000000000c' \ + --checksum 'sha256' \ + '/dev/mapper/crypt' # format swap mkswap \ --label 'swap' \ From ac69623ed3a916b14b70bf31d8048ac7d7d55404 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:44:00 +0100 Subject: [PATCH 201/702] crypt/mount --- bash/hetzner-rescue.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 903b0d9..52e9e1f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -284,12 +284,17 @@ function hetzner-rescue-wipe-8-8-2 { # open echo "${passphrase}" \ | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # format data + # format crypt mkfs.btrfs --force \ --label 'crypt' \ --uuid '00000000-0000-0000-0000-00000000000c' \ --checksum 'sha256' \ '/dev/mapper/crypt' + # mount crypt + mkdir --parents '/media/crypt' + mount \ + --options 'autodefrag,compress=zstd' \ + '/dev/mapper/crypt' '/media/crypt' # format swap mkswap \ --label 'swap' \ From f8f5bb623dcc818f8b29b93b0c43d32d4a192672 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:49:44 +0100 Subject: [PATCH 202/702] crypt/mkswapfile --- bash/hetzner-rescue.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 52e9e1f..e08cba2 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -295,11 +295,11 @@ function hetzner-rescue-wipe-8-8-2 { mount \ --options 'autodefrag,compress=zstd' \ '/dev/mapper/crypt' '/media/crypt' - # format swap - mkswap \ - --label 'swap' \ - -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ - '/dev/mapper/crypt-swap' + # make swap file + btrfs filesystem mkswapfile \ + --size '64g' \ + --uuid '00000000-0000-0000-0000-000000000005' \ + '/media/crypt/swap' # close cryptsetup luksClose 'crypt' } From d8f56b869c520f6c289de722ca2d877cd0295ab8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 12:56:24 +0100 Subject: [PATCH 203/702] boot/mount --- bash/hetzner-rescue.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index e08cba2..ee50748 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -213,6 +213,11 @@ function hetzner-rescue-wipe-8-8-0 { --checksum 'sha256' \ --data 'raid0' \ "${members[@]}" + # mount boot + mkdir --parents '/media/boot' + mount \ + --options 'autodefrag,compress=zstd' \ + "${members}" '/media/boot' # number=0 for device in "${devices[@]}" ; do From c31db13ebf337c4153206762d843dc3d47867484 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 13:00:10 +0100 Subject: [PATCH 204/702] close --- bash/hetzner-rescue.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index ee50748..3c5b287 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -305,8 +305,13 @@ function hetzner-rescue-wipe-8-8-2 { --size '64g' \ --uuid '00000000-0000-0000-0000-000000000005' \ '/media/crypt/swap' - # close - cryptsetup luksClose 'crypt' +} + +function hetzner-rescue-wipe-8-8-3-close { + umount '/media/boot' + # + umount '/media/crypt' \ + && cryptsetup luksClose 'crypt' } function hetzner-rescue-wipe-12-10-10-0 { From 5a76c09cb127aec1d15dcbed5b411ff99ce99772 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 28 Dec 2023 17:18:17 +0100 Subject: [PATCH 205/702] functions --- bash/hetzner-rescue.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 3c5b287..2f24ca5 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -130,7 +130,7 @@ else fi } -function hetzner-rescue-wipe-8-8-0 { +function hetzner-rescue-wipe-8-8-0-init { local device local devices=( '/dev/sda' @@ -259,13 +259,13 @@ function hetzner-rescue-wipe-8-8-0 { | cryptsetup luksOpen '/dev/md/crypt' 'crypt' } -function hetzner-rescue-wipe-8-8-1 { +function hetzner-rescue-wipe-8-8-1-zero { # wipe crypt dd status='progress' \ if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } -function hetzner-rescue-wipe-8-8-2 { +function hetzner-rescue-wipe-8-8-2-make { local passphrase # close cryptsetup luksClose 'crypt' From ca3dc0c2a8b7d2b977fd6ed7546ea45f9a3b2341 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Dec 2023 08:10:41 +0100 Subject: [PATCH 206/702] duperemove --- bash/hetzner-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 2f24ca5..502610e 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -65,7 +65,7 @@ function hetzner-rescue-install { 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' # install 'lshw' - 'squashfs-tools' + 'duperemove' 'squashfs-tools' 'grub-efi-amd64-bin' 'grub-pc-bin' 'libdigest-sha3-perl' 'micro' 'iotop' From 382d0489d9017899bb506a957ca0888e04af3bda Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Dec 2023 09:39:42 +0100 Subject: [PATCH 207/702] esp/mount --- bash/hetzner-rescue.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 502610e..55d04c9 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -192,6 +192,9 @@ function hetzner-rescue-wipe-8-8-0-init { -i "0000000${number}" \ -n "esp-${number}" \ "${device}3" + # mount esp + mkdir --parents "/media/esp-${number}" + mount "${device}3" "/media/esp-${number}" done # number=0 From f8060698450915329ee1c77bdf44d6f4dd6bc63a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Dec 2023 09:48:24 +0100 Subject: [PATCH 208/702] / --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 55d04c9..c1e6af8 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -193,8 +193,8 @@ function hetzner-rescue-wipe-8-8-0-init { -n "esp-${number}" \ "${device}3" # mount esp - mkdir --parents "/media/esp-${number}" - mount "${device}3" "/media/esp-${number}" + mkdir --parents "/media/esp/${number}" + mount "${device}3" "/media/esp/${number}" done # number=0 From e6d6487010c3f835ae4ea3f0b9371a652855d579 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Dec 2023 14:11:56 +0100 Subject: [PATCH 209/702] btrfs/compress-force --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index c1e6af8..58b695e 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -219,7 +219,7 @@ function hetzner-rescue-wipe-8-8-0-init { # mount boot mkdir --parents '/media/boot' mount \ - --options 'autodefrag,compress=zstd' \ + --options 'autodefrag,compress-force=zstd' \ "${members}" '/media/boot' # number=0 @@ -301,7 +301,7 @@ function hetzner-rescue-wipe-8-8-2-make { # mount crypt mkdir --parents '/media/crypt' mount \ - --options 'autodefrag,compress=zstd' \ + --options 'autodefrag,compress-force=zstd' \ '/dev/mapper/crypt' '/media/crypt' # make swap file btrfs filesystem mkswapfile \ From 18fa2453eacea3b7964d1385abdd1b8b2840addf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Dec 2023 16:12:58 +0100 Subject: [PATCH 210/702] =?UTF-8?q?=E2=88=92=2012-10-10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/hetzner-rescue.sh | 182 ----------------------------------------- 1 file changed, 182 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 58b695e..c6c4fe5 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -316,185 +316,3 @@ function hetzner-rescue-wipe-8-8-3-close { umount '/media/crypt' \ && cryptsetup luksClose 'crypt' } - -function hetzner-rescue-wipe-12-10-10-0 { - local device - local devices=( - '/dev/sdc' - '/dev/sda' - '/dev/sdb' - ) - local members - local number - local passphrase - local unit='mib' - # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase - # - lsblk - echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' - read - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}" - # - parted "${device}" --script mktable gpt - # - parted "${device}" unit "${unit}" \ - mkpart "crypt-${number}" 22359 9537535 - # - parted "${device}" unit "${unit}" \ - mkpart "boot-${number}" 513 22359 - # - parted "${device}" unit "${unit}" \ - mkpart "esp-${number}" 2 513 - parted "${device}" set 3 esp on - # - parted "${device}" unit "${unit}" \ - mkpart "bios-${number}" 1 2 - parted "${device}" set 4 bios_grub on - done - # - parted "${device}" unit "${unit}" \ - mkpart 'extra' 9537535 11444223 - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}4" - # wipe bios - dd \ - if='/dev/zero' of="${device}4" - done - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}3" - # format esp - dd \ - if='/dev/zero' of="${device}3" bs='1M' - mkfs.vfat -F 32 -n "esp-${number}" "${device}3" - done - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}2" - # wipe boot - dd status='progress' \ - if='/dev/zero' of="${device}2" bs='1G' - done - # - members=() - for device in "${devices[@]}" ; do - members+=("${device}2") - done - mdadm \ - --create '/dev/md/boot' \ - --name 'boot' \ - --uuid '6234a0eb:29a3a847:1dbd5ec4:bada5579' \ - --metadata 1 \ - --level 0 \ - --raid-devices ${#devices[@]} \ - "${members[@]}" - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}1" - # wipe crypt head - dd status='progress' \ - if='/dev/zero' of="${device}1" bs='1G' count=1 - done - # - members=() - for device in "${devices[@]}" ; do - members+=("${device}1") - done - mdadm \ - --create '/dev/md/crypt' \ - --name 'crypt' \ - --uuid '006234a0:eb29a3a8:471dbd5e:c4bada55' \ - --metadata 1 \ - --level 0 \ - --raid-devices ${#devices[@]} \ - "${members[@]}" - # format boot - mkfs.ext4 \ - -F \ - -L 'boot' \ - -U '6234a0eb-29a3-a847-1dbd-5ec4bada5579' \ - '/dev/md/boot' - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # wipe crypt - dd status='progress' \ - if='/dev/zero' of='/dev/mapper/crypt' bs='16G' -} - -function hetzner-rescue-wipe-12-10-10-1 { - local passphrase - # close - cryptsetup luksClose 'crypt' - # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # pv - pvcreate '/dev/mapper/crypt' - # vg - vgcreate 'crypt' '/dev/mapper/crypt' - # lv swap - lvcreate --name 'swap' --size '137438953472b' 'crypt' - # lv data - lvcreate --name 'data' --extents '100%FREE' 'crypt' - # format swap - mkswap \ - --label 'swap' \ - -U '06234a0e-b29a-3a84-71db-d5ec4bada557' \ - '/dev/mapper/crypt-swap' - # format data - mkfs.ext4 \ - -L 'data' \ - -U '006234a0-eb29-a3a8-471d-bd5ec4bada55' \ - '/dev/mapper/crypt-data' - # vg off - vgchange --activate n 'crypt' - # close - cryptsetup luksClose 'crypt' -} From fb02c729768cb1e3044090923e10082997783a1d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 1 Jan 2024 11:37:44 +0100 Subject: [PATCH 211/702] md/boot --- bash/hetzner-rescue.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index c6c4fe5..d437a8b 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -210,17 +210,25 @@ function hetzner-rescue-wipe-8-8-0-init { for device in "${devices[@]}" ; do members+=("${device}2") done + mdadm \ + --create '/dev/md/boot' \ + --name 'boot' \ + --uuid '00000000:00000000:00000000:00000002' \ + --metadata 1 \ + --level 0 \ + --raid-devices ${#devices[@]} \ + "${members[@]}" + # mkfs.btrfs --force \ + --checksum 'sha256' \ --label 'boot' \ --uuid '00000000-0000-0000-0000-00000000000b' \ - --checksum 'sha256' \ - --data 'raid0' \ - "${members[@]}" + '/dev/md/boot' # mount boot mkdir --parents '/media/boot' mount \ --options 'autodefrag,compress-force=zstd' \ - "${members}" '/media/boot' + '/dev/md/boot' '/media/boot' # number=0 for device in "${devices[@]}" ; do @@ -238,7 +246,7 @@ function hetzner-rescue-wipe-8-8-0-init { mdadm \ --create '/dev/md/crypt' \ --name 'crypt' \ - --uuid '00000000:00000000:00000000:00000000' \ + --uuid '00000000:00000000:00000000:00000001' \ --metadata 1 \ --level 0 \ --raid-devices ${#devices[@]} \ @@ -294,9 +302,9 @@ function hetzner-rescue-wipe-8-8-2-make { | cryptsetup luksOpen '/dev/md/crypt' 'crypt' # format crypt mkfs.btrfs --force \ + --checksum 'sha256' \ --label 'crypt' \ --uuid '00000000-0000-0000-0000-00000000000c' \ - --checksum 'sha256' \ '/dev/mapper/crypt' # mount crypt mkdir --parents '/media/crypt' From b272ea2181bc6efa550f33aba5a89f07a8e8c250 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 1 Jan 2024 11:51:31 +0100 Subject: [PATCH 212/702] md/sort --- bash/hetzner-rescue.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index d437a8b..1263588 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -212,11 +212,11 @@ function hetzner-rescue-wipe-8-8-0-init { done mdadm \ --create '/dev/md/boot' \ - --name 'boot' \ - --uuid '00000000:00000000:00000000:00000002' \ - --metadata 1 \ --level 0 \ + --metadata 1 \ + --name 'boot' \ --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000002' \ "${members[@]}" # mkfs.btrfs --force \ @@ -245,11 +245,11 @@ function hetzner-rescue-wipe-8-8-0-init { done mdadm \ --create '/dev/md/crypt' \ - --name 'crypt' \ - --uuid '00000000:00000000:00000000:00000001' \ - --metadata 1 \ --level 0 \ + --metadata 1 \ + --name 'crypt' \ --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000001' \ "${members[@]}" # encrypt echo "${passphrase}" \ From 2b654b58f3cc8b47617647fb543b587bee5c78d3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 5 Jan 2024 09:38:25 +0100 Subject: [PATCH 213/702] dhu/crypt --- cs | 3 +-- cs.old | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cs b/cs index 8e8d088..85a53f9 100755 --- a/cs +++ b/cs @@ -5,8 +5,7 @@ NAME="$(basename "${FILE}")" ACTION_OPEN='open' ACTION_CLOSE='close' -DATA_DIRECTORY='/data' -CONTAINERS_DIRECTORY="${DATA_DIRECTORY}/containers" +CONTAINERS_DIRECTORY="/data/home/user/crypt" CONTAINERS_MAP_DIRECTORY='/dev/mapper' CONTAINERS_MOUNT_DIRECTORY='/media' diff --git a/cs.old b/cs.old index 8e8d088..85a53f9 100755 --- a/cs.old +++ b/cs.old @@ -5,8 +5,7 @@ NAME="$(basename "${FILE}")" ACTION_OPEN='open' ACTION_CLOSE='close' -DATA_DIRECTORY='/data' -CONTAINERS_DIRECTORY="${DATA_DIRECTORY}/containers" +CONTAINERS_DIRECTORY="/data/home/user/crypt" CONTAINERS_MAP_DIRECTORY='/dev/mapper' CONTAINERS_MOUNT_DIRECTORY='/media' From 500977a716841d25fabee93be1e5fd031af12c0a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 5 Jan 2024 09:49:18 +0100 Subject: [PATCH 214/702] alias/btrfs --- bash/alias/btrfs.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bash/alias/btrfs.sh diff --git a/bash/alias/btrfs.sh b/bash/alias/btrfs.sh new file mode 100644 index 0000000..cb3878d --- /dev/null +++ b/bash/alias/btrfs.sh @@ -0,0 +1,42 @@ +alias bfdf="\ +btrfs \ +filesystem \ +df \ +" + +alias bfdu="\ +btrfs \ +filesystem \ +du \ +--summarize \ +" + +alias bfu="\ +btrfs \ +filesystem \ +usage \ +" + +alias bpg="\ +btrfs \ +property \ +get \ +" + +alias bsc="\ +btrfs \ +subvolume \ +create \ +" + +alias bss="\ +btrfs \ +subvolume \ +snapshot \ +" + +alias bssr="\ +btrfs \ +subvolume \ +snapshot -r \ +" From 67e7b951bdad46554bf7a1ee5652abd396f21567 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 5 Jan 2024 16:19:16 +0100 Subject: [PATCH 215/702] default squashfs block size --- bash/mount.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bash/mount.sh b/bash/mount.sh index e92ecef..250e2b7 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -74,7 +74,6 @@ if [ "${directory}" ] ; then cp overlay/mount/{vmlinuz,initrd.img} "${directory}" mksquashfs \ 'overlay/mount' "${directory}/filesystem.squashfs" \ --b '1M' \ -comp 'zstd' -Xcompression-level "${level}" chown --recursive 1000:1000 "${directory}" fi From 807d4b480da324ea34daf5fdd84363b00e0c923b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 5 Jan 2024 16:22:23 +0100 Subject: [PATCH 216/702] ms/noappend --- bash/mount.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bash/mount.sh b/bash/mount.sh index 250e2b7..c3ee8a3 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -74,6 +74,7 @@ if [ "${directory}" ] ; then cp overlay/mount/{vmlinuz,initrd.img} "${directory}" mksquashfs \ 'overlay/mount' "${directory}/filesystem.squashfs" \ +-noappend \ -comp 'zstd' -Xcompression-level "${level}" chown --recursive 1000:1000 "${directory}" fi From fad8ddc7e2196eea8c96b00870aeb73965547897 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 20 Jan 2024 23:40:49 +0100 Subject: [PATCH 217/702] btrfs/bsd --- bash/alias/btrfs.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash/alias/btrfs.sh b/bash/alias/btrfs.sh index cb3878d..6b4392c 100644 --- a/bash/alias/btrfs.sh +++ b/bash/alias/btrfs.sh @@ -29,6 +29,12 @@ subvolume \ create \ " +alias bsd="\ +btrfs \ +subvolume \ +delete \ +" + alias bss="\ btrfs \ subvolume \ From 7cb8f7421434c71cac8ac9692479f88d61c163db Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 21 Jan 2024 11:47:18 +0100 Subject: [PATCH 218/702] lsblk/label --- bash/alias/lsblk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/alias/lsblk.sh b/bash/alias/lsblk.sh index 7ae874a..4d63193 100644 --- a/bash/alias/lsblk.sh +++ b/bash/alias/lsblk.sh @@ -1,12 +1,12 @@ # list block devices alias lb="\ lsblk \ ---output \"NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS\" \ +--output \"NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS\" \ --noempty \ " # list block devices (old) alias lbo="\ lsblk \ ---output \"NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT\" \ +--output \"NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINT\" \ " From 5b750c894bb849cc230c91b55052a966b269d7e5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 11 Feb 2024 21:52:22 +0100 Subject: [PATCH 219/702] hetzner mdadm md: --- bash/hetzner-rescue.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/hetzner-rescue.sh b/bash/hetzner-rescue.sh index 1263588..852346f 100644 --- a/bash/hetzner-rescue.sh +++ b/bash/hetzner-rescue.sh @@ -214,7 +214,7 @@ function hetzner-rescue-wipe-8-8-0-init { --create '/dev/md/boot' \ --level 0 \ --metadata 1 \ - --name 'boot' \ + --name 'md:boot' \ --raid-devices ${#devices[@]} \ --uuid '00000000:00000000:00000000:00000002' \ "${members[@]}" @@ -247,7 +247,7 @@ function hetzner-rescue-wipe-8-8-0-init { --create '/dev/md/crypt' \ --level 0 \ --metadata 1 \ - --name 'crypt' \ + --name 'md:crypt' \ --raid-devices ${#devices[@]} \ --uuid '00000000:00000000:00000000:00000001' \ "${members[@]}" From 8e7f6b291df45d9538603961a999b91ffb67531f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 28 Feb 2024 10:58:41 +0100 Subject: [PATCH 220/702] bash/alias --- bash/alias/bash.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bash/alias/bash.sh b/bash/alias/bash.sh index 40500cc..f363670 100644 --- a/bash/alias/bash.sh +++ b/bash/alias/bash.sh @@ -10,6 +10,11 @@ cd \ ../.. \ " +# shorten alias +alias a="\ +alias \ +" + # swap directory (current ↔ previous) alias sd="\ cd \ From 2765d8738619557948dd14e8e99c3b89c68720ab Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Mar 2024 12:15:57 +0100 Subject: [PATCH 221/702] ls/di --- bash/alias/ls.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bash/alias/ls.sh b/bash/alias/ls.sh index f9a65e5..952bc85 100644 --- a/bash/alias/ls.sh +++ b/bash/alias/ls.sh @@ -1,3 +1,7 @@ +export LS_COLORS="\ +di=0;94\ +" + # list current directory's entries alias l="\ ls \ From 75ff6492914c5bfd10b7438b2835d11635733388 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Mar 2024 12:24:07 +0100 Subject: [PATCH 222/702] tree/t,ta --- bash/alias/tree.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 bash/alias/tree.sh diff --git a/bash/alias/tree.sh b/bash/alias/tree.sh new file mode 100644 index 0000000..2252fc1 --- /dev/null +++ b/bash/alias/tree.sh @@ -0,0 +1,8 @@ +alias t="\ +tree \ +" + +alias ta="\ +tree \ +-a \ +" From 074d9d5a7303d5cb1b21ea4713f5f1e35926d682 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 31 Mar 2024 23:35:16 +0200 Subject: [PATCH 223/702] no gpg agent --- bash/gpg.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bash/gpg.sh b/bash/gpg.sh index abea396..358b4ca 100644 --- a/bash/gpg.sh +++ b/bash/gpg.sh @@ -1,6 +1,5 @@ if [ ${EUID} -ne 0 ] ; then if [ -f "${HOME}/.gnupg/gpg-agent.conf" ] ; then export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - gpg-connect-agent updatestartuptty /bye > '/dev/null' fi fi From d2ba729c13813d4fd3180df0e90c4054f40038ac Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 1 Apr 2024 13:52:51 +0200 Subject: [PATCH 224/702] btrfs/bsl --- bash/btrfs.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bash/btrfs.sh diff --git a/bash/btrfs.sh b/bash/btrfs.sh new file mode 100644 index 0000000..2513eda --- /dev/null +++ b/bash/btrfs.sh @@ -0,0 +1,7 @@ +function bsl { + if [ "${1}" ] ; then + btrfs subvolume list "${1}" \ + | cut -d ' ' -f 9 \ + | sort + fi +} From cc8ca58cffb6d2426a1370ba15e15814967a8e75 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 11:57:19 +0100 Subject: [PATCH 225/702] rescue/bash --- bash/ovh-rescue.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index bcd66c4..4487403 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,4 +1,6 @@ -function ovh-rescue-configure { +#! /usr/bin/env bash + +ovh_rescue_configure() { local host="${1}" local packages=( 'byobu' 'mosh' @@ -119,8 +121,8 @@ function ovh-rescue-wipe-1-2TB { local unit='mib' # lsblk - echo -n 'WIPE' "${device}" '/?\ OR CANCEL /!\' - read + echo -n 'WIPE' "${device}" "/?\\ OR CANCEL /!\\" + read -r # parted "${device}" --script mktable gpt # From 6f17ecfec36c12afc9c76527cc6fa39fc291f53a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:17:52 +0100 Subject: [PATCH 226/702] quoootes --- bash/ovh-rescue.sh | 103 +++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 4487403..e63c7b2 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,12 +1,12 @@ -#! /usr/bin/env bash +#! /usr/bin/env sh ovh_rescue_configure() { local host="${1}" local packages=( - 'byobu' 'mosh' + "byobu" "mosh" ) # apt / conf - echo -n "\ + printf "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; Acquire::AllowDowngradeToInsecureRepositories False; @@ -16,26 +16,26 @@ APT::Install-Suggests False; APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; -" > '/etc/apt/apt.conf' +" > "/etc/apt/apt.conf" # apt / sources - echo -n "\ + printf "\ deb https://deb.debian.org/debian buster main contrib non-free deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free -" > '/etc/apt/sources.list' +" > "/etc/apt/sources.list" # bash / rc main_link_bashrc # host name hostname "${host}" # locales - echo -n "\ + printf "\ en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 " > '/etc/locale.gen' # fix alias - rm --force '/usr/share/locale/locale.alias' - ln --symbolic '/etc/locale.alias' '/usr/share/locale/locale.alias' + rm --force "/usr/share/locale/locale.alias" + ln --symbolic "/etc/locale.alias" "/usr/share/locale/locale.alias" # generate locales locale-gen # update catalog @@ -48,25 +48,25 @@ fr_FR.UTF-8 UTF-8 apt_clean_cache } -function ovh-rescue-install { - local release='buster' +ovh_rescue_install() { + local release="buster" local packages=( # installed - 'parted' 'mdadm' 'lvm2' + "parted" "mdadm" "lvm2" # install - 'lshw' - 'file' 'micro' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'htop' 'iotop' 'lsof' - 'exa' 'ncdu' 'nnn' 'ranger' 'tree' - 'squashfs-tools' - 'uuid-runtime' + "lshw" + "file" "micro" + "grub-efi-amd64-bin" "grub-pc-bin" + "htop" "iotop" "lsof" + "exa" "ncdu" "nnn" "ranger" "tree" + "squashfs-tools" + "uuid-runtime" ) local backports=( # installed - 'cryptsetup-bin' 'rsync' + "cryptsetup-bin" "rsync" # install - 'git' + "git" ) # update catalog apt-get update @@ -87,27 +87,28 @@ function ovh-rescue-install { apt_clean_cache } -function ovh-rescue-upload { +ovh_rescue_upload() { local host="${1}" if [ "${host}" ] ; then - local user='root' + local user="root" # local user_host="${user}@${host}" # remove fingerprints ssh-keygen -R "${host}" # copy ssh id ssh-copy-id \ - -o 'StrictHostKeyChecking=accept-new' \ + -o "StrictHostKeyChecking=accept-new" \ "${user_host}" # upload root rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; ovh-rescue-configure '${host}'" + ssh "${user_host}" -- \ + "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys 'ovh-rescue-install' 'C-m' + ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else @@ -116,66 +117,66 @@ else fi } -function ovh-rescue-wipe-1-2TB { - local device='/dev/sda' - local unit='mib' +ovh_rescue_wipe_1_2TB() { + local device="/dev/sda" + local unit="mib" # lsblk - echo -n 'WIPE' "${device}" "/?\\ OR CANCEL /!\\" + printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" read -r # parted "${device}" --script mktable gpt # - parted "${device}" unit "${unit}" mkpart 'crypt' 65795 1907729 + parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729 # - parted "${device}" unit "${unit}" mkpart 'boot' 259 65795 + parted "${device}" unit "${unit}" mkpart "boot" 259 65795 # - parted "${device}" unit "${unit}" mkpart 'esp' 2 259 + parted "${device}" unit "${unit}" mkpart "esp" 2 259 parted "${device}" set 3 esp on # parted "${device}" unit "${unit}" mkpart bios 1 2 parted "${device}" set 4 bios_grub on # wipe bios - dd if='/dev/zero' of='/dev/sda4' + dd if="/dev/zero" of="/dev/sda4" # format esp - mkfs.vfat -F 32 -n 'esp' '/dev/sda3' + mkfs.vfat -F 32 -n "esp" "/dev/sda3" # format boot - mkfs.ext4 -F -L 'boot' '/dev/sda2' + mkfs.ext4 -F -L "boot" "/dev/sda2" # read passphrase local passphrase - echo -n 'PassPhrase: ' + printf "PassPhrase: " read -r -s passphrase # encrypt echo "${passphrase}" \ | cryptsetup \ --verbose \ --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ --iter-time 8192 \ --key-size 512 \ - --hash 'sha512' \ + --hash "sha512" \ --use-random \ luksFormat \ - '/dev/sda1' + "/dev/sda1" # open echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/sda1' 'crypt' + | cryptsetup luksOpen "/dev/sda1" "crypt" # pv - pvcreate '/dev/mapper/crypt' + pvcreate "/dev/mapper/crypt" # vg - vgcreate 'crypt' '/dev/mapper/crypt' + vgcreate "crypt" "/dev/mapper/crypt" # lv swap - lvcreate --name 'swap' --size '68719476736b' 'crypt' + lvcreate --name "swap" --size "68719476736b" "crypt" # lv data - lvcreate --name 'data' --extents '100%FREE' 'crypt' + lvcreate --name "data" --extents "100%FREE" "crypt" # format swap - mkswap --label 'swap' '/dev/mapper/crypt-swap' + mkswap --label "swap" "/dev/mapper/crypt-swap" # format data - mkfs.ext4 -L 'data' '/dev/mapper/crypt-data' + mkfs.ext4 -L "data" "/dev/mapper/crypt-data" # vg off - vgchange --activate n 'crypt' + vgchange --activate "n" "crypt" # close - cryptsetup luksClose 'crypt' + cryptsetup luksClose "crypt" } From 0ffbf27412914ba9904225063c76a735aa7f10d0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:29:48 +0100 Subject: [PATCH 227/702] arrays --- bash/ovh-rescue.sh | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index e63c7b2..b8af8c3 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,10 +1,7 @@ #! /usr/bin/env sh ovh_rescue_configure() { -local host="${1}" - local packages=( - "byobu" "mosh" - ) + local host="${1}" # apt / conf printf "\ Acquire::AllowInsecureRepositories False; @@ -43,31 +40,15 @@ fr_FR.UTF-8 UTF-8 # debian_disable_frontend # install packages - apt-get install --assume-yes "${packages[@]}" + apt-get install --assume-yes \ + "byobu" \ + "mosh" # apt_clean_cache } ovh_rescue_install() { local release="buster" - local packages=( - # installed - "parted" "mdadm" "lvm2" - # install - "lshw" - "file" "micro" - "grub-efi-amd64-bin" "grub-pc-bin" - "htop" "iotop" "lsof" - "exa" "ncdu" "nnn" "ranger" "tree" - "squashfs-tools" - "uuid-runtime" - ) - local backports=( - # installed - "cryptsetup-bin" "rsync" - # install - "git" - ) # update catalog apt-get update # @@ -77,12 +58,24 @@ ovh_rescue_install() { # apt_clean_cache # install packages - apt-get install --assume-yes "${packages[@]}" + apt-get install --assume-yes \ + "parted" "mdadm" "lvm2" \ +\ + "lshw" \ + "file" "micro" \ + "grub-efi-amd64-bin" "grub-pc-bin" \ + "htop" "iotop" "lsof" \ + "exa" "ncdu" "nnn" "ranger" "tree" \ + "squashfs-tools" \ + "uuid-runtime" # apt_clean_cache # install backports apt-get install --assume-yes \ - --target-release "${release}-backports" "${backports[@]}" + --target-release "${release}-backports" \ + "cryptsetup-bin" "rsync" \ +\ + "git" # apt_clean_cache } From 801f3b859c5ea10cd71f3c2416adec1c7c22dd49 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:32:13 +0100 Subject: [PATCH 228/702] indent --- bash/ovh-rescue.sh | 276 ++++++++++++++++++++++----------------------- 1 file changed, 138 insertions(+), 138 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index b8af8c3..aa2f061 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,9 +1,9 @@ #! /usr/bin/env sh ovh_rescue_configure() { - local host="${1}" - # apt / conf - printf "\ + local host="${1}" + # apt / conf + printf "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; Acquire::AllowDowngradeToInsecureRepositories False; @@ -14,162 +14,162 @@ APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; " > "/etc/apt/apt.conf" - # apt / sources - printf "\ + # apt / sources + printf "\ deb https://deb.debian.org/debian buster main contrib non-free deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free " > "/etc/apt/sources.list" - # bash / rc - main_link_bashrc - # host name - hostname "${host}" - # locales - printf "\ + # bash / rc + main_link_bashrc + # host name + hostname "${host}" + # locales + printf "\ en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 " > '/etc/locale.gen' - # fix alias - rm --force "/usr/share/locale/locale.alias" - ln --symbolic "/etc/locale.alias" "/usr/share/locale/locale.alias" - # generate locales - locale-gen - # update catalog - apt-get update - # - debian_disable_frontend - # install packages - apt-get install --assume-yes \ - "byobu" \ - "mosh" - # - apt_clean_cache + # fix alias + rm --force "/usr/share/locale/locale.alias" + ln --symbolic "/etc/locale.alias" "/usr/share/locale/locale.alias" + # generate locales + locale-gen + # update catalog + apt-get update + # + debian_disable_frontend + # install packages + apt-get install --assume-yes \ + "byobu" \ + "mosh" + # + apt_clean_cache } ovh_rescue_install() { - local release="buster" - # update catalog - apt-get update - # - debian_disable_frontend - # upgrade packages - apt-get upgrade --assume-yes - # - apt_clean_cache - # install packages - apt-get install --assume-yes \ - "parted" "mdadm" "lvm2" \ + local release="buster" + # update catalog + apt-get update + # + debian_disable_frontend + # upgrade packages + apt-get upgrade --assume-yes + # + apt_clean_cache + # install packages + apt-get install --assume-yes \ + "parted" "mdadm" "lvm2" \ \ - "lshw" \ - "file" "micro" \ - "grub-efi-amd64-bin" "grub-pc-bin" \ - "htop" "iotop" "lsof" \ - "exa" "ncdu" "nnn" "ranger" "tree" \ - "squashfs-tools" \ - "uuid-runtime" - # - apt_clean_cache - # install backports - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "cryptsetup-bin" "rsync" \ + "lshw" \ + "file" "micro" \ + "grub-efi-amd64-bin" "grub-pc-bin" \ + "htop" "iotop" "lsof" \ + "exa" "ncdu" "nnn" "ranger" "tree" \ + "squashfs-tools" \ + "uuid-runtime" + # + apt_clean_cache + # install backports + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "cryptsetup-bin" "rsync" \ \ - "git" - # - apt_clean_cache + "git" + # + apt_clean_cache } ovh_rescue_upload() { local host="${1}" if [ "${host}" ] ; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- \ - "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session + local user="root" + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o "StrictHostKeyChecking=accept-new" \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- \ + "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" + # attach session + mosh "${user_host}" -- byobu attach-session else - echo 'Host?' - return 1 + echo 'Host?' + return 1 fi } ovh_rescue_wipe_1_2TB() { - local device="/dev/sda" - local unit="mib" - # - lsblk - printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" - read -r - # - parted "${device}" --script mktable gpt - # - parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729 - # - parted "${device}" unit "${unit}" mkpart "boot" 259 65795 - # - parted "${device}" unit "${unit}" mkpart "esp" 2 259 - parted "${device}" set 3 esp on - # - parted "${device}" unit "${unit}" mkpart bios 1 2 - parted "${device}" set 4 bios_grub on - # wipe bios - dd if="/dev/zero" of="/dev/sda4" - # format esp - mkfs.vfat -F 32 -n "esp" "/dev/sda3" - # format boot - mkfs.ext4 -F -L "boot" "/dev/sda2" - # read passphrase - local passphrase - printf "PassPhrase: " - read -r -s passphrase - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 8192 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "/dev/sda1" - # open - echo "${passphrase}" \ - | cryptsetup luksOpen "/dev/sda1" "crypt" - # pv - pvcreate "/dev/mapper/crypt" - # vg - vgcreate "crypt" "/dev/mapper/crypt" - # lv swap - lvcreate --name "swap" --size "68719476736b" "crypt" - # lv data - lvcreate --name "data" --extents "100%FREE" "crypt" - # format swap - mkswap --label "swap" "/dev/mapper/crypt-swap" - # format data - mkfs.ext4 -L "data" "/dev/mapper/crypt-data" - # vg off - vgchange --activate "n" "crypt" - # close - cryptsetup luksClose "crypt" + local device="/dev/sda" + local unit="mib" + # + lsblk + printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" + read -r + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729 + # + parted "${device}" unit "${unit}" mkpart "boot" 259 65795 + # + parted "${device}" unit "${unit}" mkpart "esp" 2 259 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" mkpart bios 1 2 + parted "${device}" set 4 bios_grub on + # wipe bios + dd if="/dev/zero" of="/dev/sda4" + # format esp + mkfs.vfat -F 32 -n "esp" "/dev/sda3" + # format boot + mkfs.ext4 -F -L "boot" "/dev/sda2" + # read passphrase + local passphrase + printf "PassPhrase: " + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ + --iter-time 8192 \ + --key-size 512 \ + --hash "sha512" \ + --use-random \ + luksFormat \ + "/dev/sda1" + # open + echo "${passphrase}" \ + | cryptsetup luksOpen "/dev/sda1" "crypt" + # pv + pvcreate "/dev/mapper/crypt" + # vg + vgcreate "crypt" "/dev/mapper/crypt" + # lv swap + lvcreate --name "swap" --size "68719476736b" "crypt" + # lv data + lvcreate --name "data" --extents "100%FREE" "crypt" + # format swap + mkswap --label "swap" "/dev/mapper/crypt-swap" + # format data + mkfs.ext4 -L "data" "/dev/mapper/crypt-data" + # vg off + vgchange --activate "n" "crypt" + # close + cryptsetup luksClose "crypt" } From 3b05dfecc4e8d20f70a9cbeed858127c0ea3ff48 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:37:07 +0100 Subject: [PATCH 229/702] indents --- bash/ovh-rescue.sh | 121 +++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index aa2f061..fe61576 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -13,14 +13,14 @@ APT::Install-Suggests False; APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; -" > "/etc/apt/apt.conf" +" >"/etc/apt/apt.conf" # apt / sources printf "\ deb https://deb.debian.org/debian buster main contrib non-free deb https://deb.debian.org/debian buster-backports main contrib non-free deb https://deb.debian.org/debian buster-updates main contrib non-free deb https://deb.debian.org/debian-security buster/updates main contrib non-free -" > "/etc/apt/sources.list" +" >"/etc/apt/sources.list" # bash / rc main_link_bashrc # host name @@ -29,7 +29,7 @@ deb https://deb.debian.org/debian-security buster/updates main contrib non-free printf "\ en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 -" > '/etc/locale.gen' +" >"/etc/locale.gen" # fix alias rm --force "/usr/share/locale/locale.alias" ln --symbolic "/etc/locale.alias" "/usr/share/locale/locale.alias" @@ -41,8 +41,9 @@ fr_FR.UTF-8 UTF-8 debian_disable_frontend # install packages apt-get install --assume-yes \ - "byobu" \ - "mosh" + "mosh" \ + "tmux" \ + "byobu" # apt_clean_cache } @@ -59,55 +60,55 @@ ovh_rescue_install() { apt_clean_cache # install packages apt-get install --assume-yes \ - "parted" "mdadm" "lvm2" \ -\ - "lshw" \ - "file" "micro" \ - "grub-efi-amd64-bin" "grub-pc-bin" \ - "htop" "iotop" "lsof" \ - "exa" "ncdu" "nnn" "ranger" "tree" \ - "squashfs-tools" \ - "uuid-runtime" + "parted" "mdadm" "lvm2" \ + \ + "lshw" \ + "file" "micro" \ + "grub-efi-amd64-bin" "grub-pc-bin" \ + "htop" "iotop" "lsof" \ + "exa" "ncdu" "nnn" "ranger" "tree" \ + "squashfs-tools" \ + "uuid-runtime" # apt_clean_cache # install backports apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "cryptsetup-bin" "rsync" \ -\ - "git" + --target-release "${release}-backports" \ + "cryptsetup-bin" "rsync" \ + \ + "git" # apt_clean_cache } ovh_rescue_upload() { -local host="${1}" -if [ "${host}" ] ; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- \ - "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session -else - echo 'Host?' - return 1 -fi + local host="${1}" + if [ "${host}" ]; then + local user="root" + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o "StrictHostKeyChecking=accept-new" \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- \ + "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" + # attach session + mosh "${user_host}" -- byobu attach-session + else + echo 'Host?' + return 1 + fi } ovh_rescue_wipe_1_2TB() { @@ -140,22 +141,22 @@ ovh_rescue_wipe_1_2TB() { printf "PassPhrase: " read -r -s passphrase # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 8192 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "/dev/sda1" + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ + --iter-time 8192 \ + --key-size 512 \ + --hash "sha512" \ + --use-random \ + luksFormat \ + "/dev/sda1" # open - echo "${passphrase}" \ - | cryptsetup luksOpen "/dev/sda1" "crypt" + echo "${passphrase}" | + cryptsetup luksOpen "/dev/sda1" "crypt" # pv pvcreate "/dev/mapper/crypt" # vg From efada1fce56a6b8486d93f50510da8e819e61ebd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:38:32 +0100 Subject: [PATCH 230/702] quotes --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index fe61576..c876d5a 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -106,7 +106,7 @@ ovh_rescue_upload() { # attach session mosh "${user_host}" -- byobu attach-session else - echo 'Host?' + echo "Host?" return 1 fi } From 718d1d1e78d69c41e79250f4c43992c98694e4f6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:46:43 +0100 Subject: [PATCH 231/702] tmux,cleans --- bash/ovh-rescue.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index c876d5a..db81ac8 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -41,10 +41,11 @@ fr_FR.UTF-8 UTF-8 debian_disable_frontend # install packages apt-get install --assume-yes \ - "mosh" \ "tmux" \ - "byobu" - # + \ + "byobu" \ + "mosh" + # clean cache apt_clean_cache } @@ -69,7 +70,7 @@ ovh_rescue_install() { "exa" "ncdu" "nnn" "ranger" "tree" \ "squashfs-tools" \ "uuid-runtime" - # + # clean cache apt_clean_cache # install backports apt-get install --assume-yes \ @@ -77,7 +78,7 @@ ovh_rescue_install() { "cryptsetup-bin" "rsync" \ \ "git" - # + # clean cache apt_clean_cache } From 9b830a7d36a7935b7cda904b2848ae142af184b5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 12:55:45 +0100 Subject: [PATCH 232/702] packages --- bash/ovh-rescue.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index db81ac8..da6ab26 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -61,12 +61,11 @@ ovh_rescue_install() { apt_clean_cache # install packages apt-get install --assume-yes \ - "parted" "mdadm" "lvm2" \ + "file" "htop" "iotop" "lsof" \ \ + "parted" "mdadm" "lvm2" \ "lshw" \ - "file" "micro" \ - "grub-efi-amd64-bin" "grub-pc-bin" \ - "htop" "iotop" "lsof" \ + "micro" \ "exa" "ncdu" "nnn" "ranger" "tree" \ "squashfs-tools" \ "uuid-runtime" @@ -75,8 +74,10 @@ ovh_rescue_install() { # install backports apt-get install --assume-yes \ --target-release "${release}-backports" \ - "cryptsetup-bin" "rsync" \ + "rsync" \ \ + "cryptsetup-bin" \ + "grub-efi-amd64-bin" "grub-pc-bin" \ "git" # clean cache apt_clean_cache From dce03fc9b9c83c5a237d93291503fc213c483455 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:05:39 +0100 Subject: [PATCH 233/702] bookworm --- bash/ovh-rescue.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index da6ab26..16f1abf 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -2,6 +2,7 @@ ovh_rescue_configure() { local host="${1}" + local release="bookworm" # apt / conf printf "\ Acquire::AllowInsecureRepositories False; @@ -41,16 +42,20 @@ fr_FR.UTF-8 UTF-8 debian_disable_frontend # install packages apt-get install --assume-yes \ - "tmux" \ - \ "byobu" \ "mosh" # clean cache apt_clean_cache + # install backports + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "tmux" + # clean cache + apt_clean_cache } ovh_rescue_install() { - local release="buster" + local release="bookworm" # update catalog apt-get update # @@ -100,7 +105,7 @@ ovh_rescue_upload() { # call setup # TODO variable ssh "${user_host}" -- \ - "source \"/etc/bash/main.sh\" ; ovh-rescue-configure \"${host}\"" + "source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${host}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys From cb02b1514603ec000175a3573bd181a233231707 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:11:27 +0100 Subject: [PATCH 234/702] release --- bash/ovh-rescue.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 16f1abf..f04d157 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -12,15 +12,15 @@ Acquire::Check-Valid-Until True; APT::Install-Recommends False; APT::Install-Suggests False; APT::Get::Show-Versions True; -Dir::Etc::SourceParts ''; +Dir::Etc::SourceParts \"\"; Dpkg::Progress True; -" >"/etc/apt/apt.conf" +" >"/etc/apt/apt.conf.d/apt.conf" # apt / sources printf "\ -deb https://deb.debian.org/debian buster main contrib non-free -deb https://deb.debian.org/debian buster-backports main contrib non-free -deb https://deb.debian.org/debian buster-updates main contrib non-free -deb https://deb.debian.org/debian-security buster/updates main contrib non-free +deb https://deb.debian.org/debian ${release} main non-free-firmware contrib non-free +deb https://deb.debian.org/debian ${release}-backports main non-free-firmware contrib non-free +deb https://deb.debian.org/debian ${release}-updates main non-free-firmware contrib non-free +deb https://deb.debian.org/debian-security ${release}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" # bash / rc main_link_bashrc @@ -31,9 +31,6 @@ deb https://deb.debian.org/debian-security buster/updates main contrib non-free en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 " >"/etc/locale.gen" - # fix alias - rm --force "/usr/share/locale/locale.alias" - ln --symbolic "/etc/locale.alias" "/usr/share/locale/locale.alias" # generate locales locale-gen # update catalog From 91b0862539261f500a9e04a3964c621d304cbb25 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:13:25 +0100 Subject: [PATCH 235/702] tmux --- bash/ovh-rescue.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index f04d157..e5aa429 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -37,18 +37,18 @@ fr_FR.UTF-8 UTF-8 apt-get update # debian_disable_frontend - # install packages - apt-get install --assume-yes \ - "byobu" \ - "mosh" - # clean cache - apt_clean_cache # install backports apt-get install --assume-yes \ --target-release "${release}-backports" \ "tmux" # clean cache apt_clean_cache + # install packages + apt-get install --assume-yes \ + "byobu" \ + "mosh" + # clean cache + apt_clean_cache } ovh_rescue_install() { From 48e29b9e600a78c52adfca85159bebef3cf5e2ce Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:26:01 +0100 Subject: [PATCH 236/702] packages --- bash/ovh-rescue.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index e5aa429..e8008d2 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -63,24 +63,22 @@ ovh_rescue_install() { apt_clean_cache # install packages apt-get install --assume-yes \ - "file" "htop" "iotop" "lsof" \ + "file" "htop" "iotop" "lsof" "rsync" \ \ - "parted" "mdadm" "lvm2" \ + "parted" "mdadm" "cryptsetup-bin" "lvm2" \ "lshw" \ "micro" \ "exa" "ncdu" "nnn" "ranger" "tree" \ "squashfs-tools" \ - "uuid-runtime" + "git" # clean cache apt_clean_cache # install backports apt-get install --assume-yes \ --target-release "${release}-backports" \ - "rsync" \ + "grub-pc-bin" \ \ - "cryptsetup-bin" \ - "grub-efi-amd64-bin" "grub-pc-bin" \ - "git" + "grub-efi-amd64-bin" # clean cache apt_clean_cache } From b693e17e297dacd710a8f247c396ac7fc6028c46 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:27:51 +0100 Subject: [PATCH 237/702] printf --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index e8008d2..b6f81f5 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -16,7 +16,7 @@ Dir::Etc::SourceParts \"\"; Dpkg::Progress True; " >"/etc/apt/apt.conf.d/apt.conf" # apt / sources - printf "\ + printf "%s" "\ deb https://deb.debian.org/debian ${release} main non-free-firmware contrib non-free deb https://deb.debian.org/debian ${release}-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian ${release}-updates main non-free-firmware contrib non-free From d468491ae03fa6b064c5ffc0464d65e8cc9e3a50 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:32:08 +0100 Subject: [PATCH 238/702] _ --- bash/ovh-rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index b6f81f5..0acce32 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -104,7 +104,7 @@ ovh_rescue_upload() { # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys "ovh-rescue-install" "C-m" + ssh "${user_host}" -- byobu send-keys "ovh_rescue_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else From d2ce7a1b74eeec4001e285fbffa586d47684830e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 13:58:49 +0100 Subject: [PATCH 239/702] configure --- bash/ovh-rescue.sh | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 0acce32..a725271 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -1,8 +1,9 @@ #! /usr/bin/env sh ovh_rescue_configure() { - local host="${1}" + local hostname="${1}" local release="bookworm" + local package # apt / conf printf "\ Acquire::AllowInsecureRepositories False; @@ -24,8 +25,9 @@ deb https://deb.debian.org/debian-security ${release}-security main non-free-fir " >"/etc/apt/sources.list" # bash / rc main_link_bashrc + mv .bashrc .bashrc.old # host name - hostname "${host}" + hostname "${hostname}" # locales printf "\ en_US.UTF-8 UTF-8 @@ -35,20 +37,27 @@ fr_FR.UTF-8 UTF-8 locale-gen # update catalog apt-get update - # + # disable frontend debian_disable_frontend # install backports - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "tmux" - # clean cache - apt_clean_cache + set "tmux" + for package in "${@}"; do + echo ; echo "${package}" + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done # install packages - apt-get install --assume-yes \ - "byobu" \ - "mosh" - # clean cache - apt_clean_cache + set "apt-file" "mosh" "byobu" + for package in "${@}"; do + echo ; echo "${package}" + apt-get install --assume-yes \ + "${package}" + apt_clean_cache + done + # update catalog + apt-get update } ovh_rescue_install() { From 8ab6d5758df050dbb157811246e6a0ee44e536c2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 14:03:33 +0100 Subject: [PATCH 240/702] install --- bash/ovh-rescue.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index a725271..8c3d07b 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -61,17 +61,18 @@ fr_FR.UTF-8 UTF-8 } ovh_rescue_install() { + local package local release="bookworm" # update catalog apt-get update - # + # disable frontend debian_disable_frontend # upgrade packages apt-get upgrade --assume-yes - # + # clean cache apt_clean_cache # install packages - apt-get install --assume-yes \ + set \ "file" "htop" "iotop" "lsof" "rsync" \ \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \ @@ -80,16 +81,24 @@ ovh_rescue_install() { "exa" "ncdu" "nnn" "ranger" "tree" \ "squashfs-tools" \ "git" - # clean cache - apt_clean_cache + for package in "${@}"; do + echo ; echo "${package}" + apt-get install --assume-yes \ + "${package}" + apt_clean_cache + done # install backports - apt-get install --assume-yes \ - --target-release "${release}-backports" \ + set \ "grub-pc-bin" \ \ "grub-efi-amd64-bin" - # clean cache - apt_clean_cache + for package in "${@}"; do + echo ; echo "${package}" + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done } ovh_rescue_upload() { From 0face50a529ab67dcb4d002546b89df6851a6c8b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 14:04:48 +0100 Subject: [PATCH 241/702] echoes --- bash/ovh-rescue.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 8c3d07b..16ddad7 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -42,7 +42,8 @@ fr_FR.UTF-8 UTF-8 # install backports set "tmux" for package in "${@}"; do - echo ; echo "${package}" + echo + echo "${package}" apt-get install --assume-yes \ --target-release "${release}-backports" \ "${package}" @@ -51,7 +52,8 @@ fr_FR.UTF-8 UTF-8 # install packages set "apt-file" "mosh" "byobu" for package in "${@}"; do - echo ; echo "${package}" + echo + echo "${package}" apt-get install --assume-yes \ "${package}" apt_clean_cache @@ -82,7 +84,8 @@ ovh_rescue_install() { "squashfs-tools" \ "git" for package in "${@}"; do - echo ; echo "${package}" + echo + echo "${package}" apt-get install --assume-yes \ "${package}" apt_clean_cache @@ -93,7 +96,8 @@ ovh_rescue_install() { \ "grub-efi-amd64-bin" for package in "${@}"; do - echo ; echo "${package}" + echo + echo "${package}" apt-get install --assume-yes \ --target-release "${release}-backports" \ "${package}" From c7659c47fae7ee7e36493acc585939d781a1aea1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 14:32:37 +0100 Subject: [PATCH 242/702] packages --- bash/ovh-rescue.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 16ddad7..d79616f 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -75,14 +75,13 @@ ovh_rescue_install() { apt_clean_cache # install packages set \ - "file" "htop" "iotop" "lsof" "rsync" \ - \ + "man-db" \ + "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \ - "lshw" \ - "micro" \ - "exa" "ncdu" "nnn" "ranger" "tree" \ - "squashfs-tools" \ - "git" + "btrfs-progs" "dosfstools" "duperemove" "squashfs-tools" \ + "git" "micro" "nano" "python3" "rsync" "vim" \ + "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ + "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" for package in "${@}"; do echo echo "${package}" From bee3710cde42b432500fe3d42f7a2dd1e2a321c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 14:40:55 +0100 Subject: [PATCH 243/702] upload --- bash/ovh-rescue.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index d79616f..46f81cf 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -18,10 +18,14 @@ Dpkg::Progress True; " >"/etc/apt/apt.conf.d/apt.conf" # apt / sources printf "%s" "\ -deb https://deb.debian.org/debian ${release} main non-free-firmware contrib non-free -deb https://deb.debian.org/debian ${release}-backports main non-free-firmware contrib non-free -deb https://deb.debian.org/debian ${release}-updates main non-free-firmware contrib non-free -deb https://deb.debian.org/debian-security ${release}-security main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${release} main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${release}-backports main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${release}-updates main non-free-firmware contrib non-free +deb https://deb.debian.org/debian-security \ +${release}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" # bash / rc main_link_bashrc @@ -106,7 +110,8 @@ ovh_rescue_install() { ovh_rescue_upload() { local host="${1}" - if [ "${host}" ]; then + local hostname="${2}" + if [ "${hostname}" ]; then local user="root" # local user_host="${user}@${host}" @@ -117,11 +122,12 @@ ovh_rescue_upload() { -o "StrictHostKeyChecking=accept-new" \ "${user_host}" # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + rsync --delete --recursive \ + "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- \ - "source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${host}\"" + ssh "${user_host}" -- "\ +source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys From 28e3acd8a7f308f9501734e6854384c22c065032 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 15:40:04 +0100 Subject: [PATCH 244/702] device --- bash/ovh-rescue.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 46f81cf..cabce07 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -140,9 +140,13 @@ source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\"" fi } -ovh_rescue_wipe_1_2TB() { - local device="/dev/sda" +ovh_rescue_wipe_vle2_0_init() { + local device="/dev/sdb" + local passphrase local unit="mib" + # read passphrase + printf "PassPhrase: " + read -r -s passphrase # lsblk printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" @@ -152,23 +156,19 @@ ovh_rescue_wipe_1_2TB() { # parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729 # - parted "${device}" unit "${unit}" mkpart "boot" 259 65795 + parted "${device}" unit "${unit}" mkpart "boot" 514 65795 # - parted "${device}" unit "${unit}" mkpart "esp" 2 259 + parted "${device}" unit "${unit}" mkpart "esp" 2 514 parted "${device}" set 3 esp on # parted "${device}" unit "${unit}" mkpart bios 1 2 parted "${device}" set 4 bios_grub on # wipe bios - dd if="/dev/zero" of="/dev/sda4" + dd if="/dev/zero" of="${device}4" # format esp - mkfs.vfat -F 32 -n "esp" "/dev/sda3" + mkfs.vfat -F 32 -n "esp" "${device}3" # format boot - mkfs.ext4 -F -L "boot" "/dev/sda2" - # read passphrase - local passphrase - printf "PassPhrase: " - read -r -s passphrase + mkfs.ext4 -F -L "boot" "${device}2" # encrypt echo "${passphrase}" | cryptsetup \ @@ -182,10 +182,10 @@ ovh_rescue_wipe_1_2TB() { --hash "sha512" \ --use-random \ luksFormat \ - "/dev/sda1" + "${device}1" # open echo "${passphrase}" | - cryptsetup luksOpen "/dev/sda1" "crypt" + cryptsetup luksOpen "${device}1" "crypt" # pv pvcreate "/dev/mapper/crypt" # vg From 566189cc80846fbbb496c1887bbb6886412add68 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:37:27 +0100 Subject: [PATCH 245/702] functions --- bash/ovh-rescue.sh | 112 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 85 insertions(+), 27 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index cabce07..0b12f67 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -147,29 +147,51 @@ ovh_rescue_wipe_vle2_0_init() { # read passphrase printf "PassPhrase: " read -r -s passphrase - # + # warn lsblk printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" read -r # parted "${device}" --script mktable gpt # - parted "${device}" unit "${unit}" mkpart "crypt" 65795 1907729 + parted "${device}" unit "${unit}" mkpart "crypt" 4610 40960 # - parted "${device}" unit "${unit}" mkpart "boot" 514 65795 + parted "${device}" unit "${unit}" mkpart "boot" 514 4610 # parted "${device}" unit "${unit}" mkpart "esp" 2 514 parted "${device}" set 3 esp on # parted "${device}" unit "${unit}" mkpart bios 1 2 parted "${device}" set 4 bios_grub on - # wipe bios + # bios / wipe dd if="/dev/zero" of="${device}4" - # format esp - mkfs.vfat -F 32 -n "esp" "${device}3" - # format boot - mkfs.ext4 -F -L "boot" "${device}2" - # encrypt + # esp / wipe + dd if="/dev/zero" of="${device}3" bs="1M" + # esp / format + mkfs.vfat \ + -F 32 \ + -S 4096 \ + -i "00000001" \ + -n "esp" \ + "${device}3" + # esp / mount + mkdir --parents "/media/esp" + mount "${device}3" "/media/esp" + # boot / wipe + dd status="progress" if="/dev/zero" of="${device}2" bs="1G" count=1 + # boot / format + mkfs.btrfs --force \ + --checksum "sha256" \ + --label "boot" \ + --uuid "00000000-0000-0000-0000-00000000000b" \ + "${device}2" + # boot / mount + mkdir --parents "/media/boot" + mount --options "autodefrag,compress-force=zstd" \ + "${device}2" "/media/boot" + # crypt / wipe + dd status="progress" if="/dev/zero" of="${device}1" bs="1G" count=1 + # crypt / encrypt echo "${passphrase}" | cryptsetup \ --verbose \ @@ -177,29 +199,65 @@ ovh_rescue_wipe_vle2_0_init() { --type "luks2" \ --pbkdf "argon2id" \ --cipher "aes-xts-plain64" \ - --iter-time 8192 \ + --iter-time 4096 \ --key-size 512 \ --hash "sha512" \ --use-random \ luksFormat \ "${device}1" - # open + # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" - # pv - pvcreate "/dev/mapper/crypt" - # vg - vgcreate "crypt" "/dev/mapper/crypt" - # lv swap - lvcreate --name "swap" --size "68719476736b" "crypt" - # lv data - lvcreate --name "data" --extents "100%FREE" "crypt" - # format swap - mkswap --label "swap" "/dev/mapper/crypt-swap" - # format data - mkfs.ext4 -L "data" "/dev/mapper/crypt-data" - # vg off - vgchange --activate "n" "crypt" - # close - cryptsetup luksClose "crypt" +} + +ovh_rescue_wipe_vle2_1_zero() { + # crypt / zero + dd status="progress" if="/dev/zero" of="/dev/mapper/crypt" bs="1G" +} + +ovh_rescue_wipe_vle2_2_make() { + local passphrase + # crypt / close + cryptsetup luksClose "crypt" + # read passphrase + printf "PassPhrase: " + read -r -s passphrase + # crypt / encrypt + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ + --iter-time 4096 \ + --key-size 512 \ + --hash "sha512" \ + --use-random \ + luksFormat \ + "${device}1" + # crypt / open + echo "${passphrase}" | + cryptsetup luksOpen "${device}1" "crypt" + # crypt / format + mkfs.btrfs --force \ + --checksum "sha256" \ + --label "crypt" \ + --uuid "00000000-0000-0000-0000-00000000000c" \ + "${device}1" + # crypt / mount + mkdir --parents "/media/crypt" + mount --options "autodefrag,compress-force=zstd" \ + "${device}1" "/media/crypt" + # crypt / swap + btrfs filesystem mkswapfile \ + --size "4g" \ + --uuid "00000000-0000-0000-0000-000000000005" \ + "/media/crypt/swap" +} + +ovh_rescue_wipe_vle2_3_close() { + umount "/media/boot" + umount "/media/crypt" && + cryptsetup luksClose "crypt" } From 63af101db9541ee39394176227f6ad8c7dce9757 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:38:48 +0100 Subject: [PATCH 246/702] indent --- bash/ovh-rescue.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bash/ovh-rescue.sh b/bash/ovh-rescue.sh index 0b12f67..f639df5 100644 --- a/bash/ovh-rescue.sh +++ b/bash/ovh-rescue.sh @@ -181,10 +181,10 @@ ovh_rescue_wipe_vle2_0_init() { dd status="progress" if="/dev/zero" of="${device}2" bs="1G" count=1 # boot / format mkfs.btrfs --force \ - --checksum "sha256" \ - --label "boot" \ - --uuid "00000000-0000-0000-0000-00000000000b" \ - "${device}2" + --checksum "sha256" \ + --label "boot" \ + --uuid "00000000-0000-0000-0000-00000000000b" \ + "${device}2" # boot / mount mkdir --parents "/media/boot" mount --options "autodefrag,compress-force=zstd" \ @@ -241,19 +241,19 @@ ovh_rescue_wipe_vle2_2_make() { cryptsetup luksOpen "${device}1" "crypt" # crypt / format mkfs.btrfs --force \ - --checksum "sha256" \ - --label "crypt" \ - --uuid "00000000-0000-0000-0000-00000000000c" \ - "${device}1" + --checksum "sha256" \ + --label "crypt" \ + --uuid "00000000-0000-0000-0000-00000000000c" \ + "${device}1" # crypt / mount mkdir --parents "/media/crypt" mount --options "autodefrag,compress-force=zstd" \ "${device}1" "/media/crypt" # crypt / swap btrfs filesystem mkswapfile \ - --size "4g" \ - --uuid "00000000-0000-0000-0000-000000000005" \ - "/media/crypt/swap" + --size "4g" \ + --uuid "00000000-0000-0000-0000-000000000005" \ + "/media/crypt/swap" } ovh_rescue_wipe_vle2_3_close() { From 8983b9cd9f41b4bf29682ee4e4b7fe512c25c4b7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:42:18 +0100 Subject: [PATCH 247/702] rename --- bash/{hetzner-rescue.sh => rescue-hetzner.sh} | 0 bash/{ovh-rescue.sh => rescue-ovh.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename bash/{hetzner-rescue.sh => rescue-hetzner.sh} (100%) rename bash/{ovh-rescue.sh => rescue-ovh.sh} (100%) diff --git a/bash/hetzner-rescue.sh b/bash/rescue-hetzner.sh similarity index 100% rename from bash/hetzner-rescue.sh rename to bash/rescue-hetzner.sh diff --git a/bash/ovh-rescue.sh b/bash/rescue-ovh.sh similarity index 100% rename from bash/ovh-rescue.sh rename to bash/rescue-ovh.sh From 768703707005d424e6e85f7ee1d53d7a71ffa7eb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:43:16 +0100 Subject: [PATCH 248/702] rescue --- bash/rescue.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bash/rescue.sh diff --git a/bash/rescue.sh b/bash/rescue.sh new file mode 100644 index 0000000..e69de29 From 33e823024cc1318f47928fd6b57310a7119c8ec3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:48:26 +0100 Subject: [PATCH 249/702] ovh --- bash/rescue-ovh.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index f639df5..a98e8f7 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,6 +1,6 @@ #! /usr/bin/env sh -ovh_rescue_configure() { +rescue_ovh_configure() { local hostname="${1}" local release="bookworm" local package @@ -66,7 +66,7 @@ fr_FR.UTF-8 UTF-8 apt-get update } -ovh_rescue_install() { +rescue_ovh_install() { local package local release="bookworm" # update catalog @@ -108,7 +108,7 @@ ovh_rescue_install() { done } -ovh_rescue_upload() { +rescue_ovh_upload() { local host="${1}" local hostname="${2}" if [ "${hostname}" ]; then @@ -127,11 +127,11 @@ ovh_rescue_upload() { # call setup # TODO variable ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\"" +source \"/etc/bash/main.sh\" ; rescue_ovh_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys "ovh_rescue_install" "C-m" + ssh "${user_host}" -- byobu send-keys "rescue_ovh_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else @@ -140,7 +140,7 @@ source \"/etc/bash/main.sh\" ; ovh_rescue_configure \"${hostname}\"" fi } -ovh_rescue_wipe_vle2_0_init() { +rescue_ovh_wipe_vle2_0_init() { local device="/dev/sdb" local passphrase local unit="mib" @@ -210,12 +210,12 @@ ovh_rescue_wipe_vle2_0_init() { cryptsetup luksOpen "${device}1" "crypt" } -ovh_rescue_wipe_vle2_1_zero() { +rescue_ovh_wipe_vle2_1_zero() { # crypt / zero dd status="progress" if="/dev/zero" of="/dev/mapper/crypt" bs="1G" } -ovh_rescue_wipe_vle2_2_make() { +rescue_ovh_wipe_vle2_2_make() { local passphrase # crypt / close cryptsetup luksClose "crypt" @@ -256,7 +256,7 @@ ovh_rescue_wipe_vle2_2_make() { "/media/crypt/swap" } -ovh_rescue_wipe_vle2_3_close() { +rescue_ovh_wipe_vle2_3_close() { umount "/media/boot" umount "/media/crypt" && cryptsetup luksClose "crypt" From 5f13535022dc2bf12d41cb4fbf9415ffabcc4191 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:56:00 +0100 Subject: [PATCH 250/702] hetzner --- bash/rescue-hetzner.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 852346f..c0d1de3 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,4 +1,4 @@ -function hetzner-rescue-configure { +function rescue_hetzner_configure { local hostname="${1}" local package local packages=( @@ -53,7 +53,7 @@ fr_FR.UTF-8 UTF-8 apt-get update } -function hetzner-rescue-install { +function rescue_hetzner_install { local package local release='bookworm' local packages=( @@ -100,7 +100,7 @@ function hetzner-rescue-install { done } -function hetzner-rescue-upload { +function rescue_hetzner_upload { local host="${1}" local hostname="${2}" if [ "${hostname}" ] ; then @@ -117,11 +117,11 @@ if [ "${hostname}" ] ; then rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; hetzner-rescue-configure '${hostname}'" + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys 'hetzner-rescue-install' 'C-m' + ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' # attach session mosh "${user_host}" -- byobu attach-session else @@ -130,7 +130,7 @@ else fi } -function hetzner-rescue-wipe-8-8-0-init { +function rescue_hetzner_wipe_8_8_0_init { local device local devices=( '/dev/sda' @@ -270,13 +270,13 @@ function hetzner-rescue-wipe-8-8-0-init { | cryptsetup luksOpen '/dev/md/crypt' 'crypt' } -function hetzner-rescue-wipe-8-8-1-zero { +function rescue_hetzner_wipe_8_8_1_zero { # wipe crypt dd status='progress' \ if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } -function hetzner-rescue-wipe-8-8-2-make { +function rescue_hetzner_wipe_8_8_2_make { local passphrase # close cryptsetup luksClose 'crypt' @@ -318,7 +318,7 @@ function hetzner-rescue-wipe-8-8-2-make { '/media/crypt/swap' } -function hetzner-rescue-wipe-8-8-3-close { +function rescue_hetzner_wipe_8_8_3_close { umount '/media/boot' # umount '/media/crypt' \ From 783d5e334e55d2a7a0202fa2504534cb1829606c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 16:57:37 +0100 Subject: [PATCH 251/702] functions --- bash/rescue-hetzner.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index c0d1de3..dcbab30 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,4 +1,4 @@ -function rescue_hetzner_configure { +rescue_hetzner_configure() { local hostname="${1}" local package local packages=( @@ -53,7 +53,7 @@ fr_FR.UTF-8 UTF-8 apt-get update } -function rescue_hetzner_install { +rescue_hetzner_install() { local package local release='bookworm' local packages=( @@ -100,7 +100,7 @@ function rescue_hetzner_install { done } -function rescue_hetzner_upload { +rescue_hetzner_upload() { local host="${1}" local hostname="${2}" if [ "${hostname}" ] ; then @@ -130,7 +130,7 @@ else fi } -function rescue_hetzner_wipe_8_8_0_init { +rescue_hetzner_wipe_8_8_0_init() { local device local devices=( '/dev/sda' @@ -270,13 +270,13 @@ function rescue_hetzner_wipe_8_8_0_init { | cryptsetup luksOpen '/dev/md/crypt' 'crypt' } -function rescue_hetzner_wipe_8_8_1_zero { +rescue_hetzner_wipe_8_8_1_zero() { # wipe crypt dd status='progress' \ if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } -function rescue_hetzner_wipe_8_8_2_make { +rescue_hetzner_wipe_8_8_2_make() { local passphrase # close cryptsetup luksClose 'crypt' @@ -318,7 +318,7 @@ function rescue_hetzner_wipe_8_8_2_make { '/media/crypt/swap' } -function rescue_hetzner_wipe_8_8_3_close { +rescue_hetzner_wipe_8_8_3_close() { umount '/media/boot' # umount '/media/crypt' \ From bf1e7539faf1b198a9338b88e72e4949bc5d23e6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:01:19 +0100 Subject: [PATCH 252/702] tabs --- bash/rescue-hetzner.sh | 564 ++++++++++++++++++++--------------------- 1 file changed, 282 insertions(+), 282 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index dcbab30..49ad0a5 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,13 +1,13 @@ rescue_hetzner_configure() { local hostname="${1}" - local package - local packages=( - 'mosh' - 'screen' 'tmux' 'byobu' - 'apt-file' - ) - # apt / conf - echo -n "\ + local package + local packages=( + 'mosh' + 'screen' 'tmux' 'byobu' + 'apt-file' + ) + # apt / conf + echo -n "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; Acquire::AllowDowngradeToInsecureRepositories False; @@ -18,309 +18,309 @@ APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; " > '/etc/apt/apt.conf' - # apt / sources - echo -n "\ + # apt / sources + echo -n "\ deb https://deb.debian.org/debian bookworm main non-free-firmware contrib non-free deb https://deb.debian.org/debian bookworm-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian bookworm-updates main non-free-firmware contrib non-free deb https://deb.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free " > '/etc/apt/sources.list' - # bash / rc - main_link_bashrc - mv .bashrc .bashrc.old - # host name - hostname "${hostname}" - # locales - echo -n "\ + # bash / rc + main_link_bashrc + mv .bashrc .bashrc.old + # host name + hostname "${hostname}" + # locales + echo -n "\ en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 " > '/etc/locale.gen' - # generate locales - locale-gen - # update catalog - apt-get update - # - debian_disable_frontend - # install packages - for package in "${packages[@]}" ; do - echo ; echo "${package}" - apt-get install \ - --assume-yes \ - "${package}" - apt_clean_cache - done - # update catalog - apt-get update + # generate locales + locale-gen + # update catalog + apt-get update + # + debian_disable_frontend + # install packages + for package in "${packages[@]}" ; do + echo ; echo "${package}" + apt-get install \ + --assume-yes \ + "${package}" + apt_clean_cache + done + # update catalog + apt-get update } rescue_hetzner_install() { - local package - local release='bookworm' - local packages=( - # installed - 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' - 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' - 'btrfs-progs' 'dosfstools' - 'git' 'nano' 'python3' 'rsync' 'vim' - 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' - # install - 'lshw' - 'duperemove' 'squashfs-tools' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'libdigest-sha3-perl' 'micro' - 'iotop' - 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' - ) - local backports=( - ) - # update catalog - apt-get update - # - debian_disable_frontend - # upgrade packages - apt-get upgrade --assume-yes - # - apt_clean_cache - # install packages - for package in "${packages[@]}" ; do - echo ; echo "${package}" - apt-get install \ - --assume-yes \ - "${package}" - apt_clean_cache - done - # install backports - for package in "${backports[@]}" ; do - echo ; echo "${package}" - apt-get install \ - --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean_cache - done + local package + local release='bookworm' + local packages=( + # installed + 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' + 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' + 'btrfs-progs' 'dosfstools' + 'git' 'nano' 'python3' 'rsync' 'vim' + 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' + # install + 'lshw' + 'duperemove' 'squashfs-tools' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'libdigest-sha3-perl' 'micro' + 'iotop' + 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' + ) + local backports=( + ) + # update catalog + apt-get update + # + debian_disable_frontend + # upgrade packages + apt-get upgrade --assume-yes + # + apt_clean_cache + # install packages + for package in "${packages[@]}" ; do + echo ; echo "${package}" + apt-get install \ + --assume-yes \ + "${package}" + apt_clean_cache + done + # install backports + for package in "${backports[@]}" ; do + echo ; echo "${package}" + apt-get install \ + --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done } rescue_hetzner_upload() { local host="${1}" local hostname="${2}" if [ "${hostname}" ] ; then - local user='root' - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o 'StrictHostKeyChecking=accept-new' \ - "${user_host}" - # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' - # attach session - mosh "${user_host}" -- byobu attach-session + local user='root' + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o 'StrictHostKeyChecking=accept-new' \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' + # attach session + mosh "${user_host}" -- byobu attach-session else - echo 'Host?' - return 1 + echo 'Host?' + return 1 fi } rescue_hetzner_wipe_8_8_0_init() { - local device - local devices=( - '/dev/sda' - '/dev/sdb' - ) - local members - local number - local passphrase - local unit='mib' - # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase - # - lsblk - echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' - read - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}" - # - parted "${device}" --script mktable gpt - # - parted "${device}" unit "${unit}" \ - mkpart "crypt-${number}" 33282 7630885 - # - parted "${device}" unit "${unit}" \ - mkpart "boot-${number}" 514 33282 - # - parted "${device}" unit "${unit}" \ - mkpart "esp-${number}" 2 514 - parted "${device}" set 3 esp on - # - parted "${device}" unit "${unit}" \ - mkpart "bios-${number}" 1 2 - parted "${device}" set 4 bios_grub on - done - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}4" - # wipe bios - dd \ - if='/dev/zero' of="${device}4" - done - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}3" - # format esp - dd \ - if='/dev/zero' of="${device}3" bs='1M' - mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "0000000${number}" \ - -n "esp-${number}" \ - "${device}3" - # mount esp - mkdir --parents "/media/esp/${number}" - mount "${device}3" "/media/esp/${number}" - done - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}2" - # wipe boot - dd status='progress' \ - if='/dev/zero' of="${device}2" bs='1G' count=1 - done - # - members=() - for device in "${devices[@]}" ; do - members+=("${device}2") - done - mdadm \ - --create '/dev/md/boot' \ - --level 0 \ - --metadata 1 \ - --name 'md:boot' \ - --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000002' \ - "${members[@]}" - # - mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'boot' \ - --uuid '00000000-0000-0000-0000-00000000000b' \ - '/dev/md/boot' - # mount boot - mkdir --parents '/media/boot' - mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/md/boot' '/media/boot' - # - number=0 - for device in "${devices[@]}" ; do - ((number++)) - echo ; echo "#${number}: ${device}1" - # wipe crypt head - dd status='progress' \ - if='/dev/zero' of="${device}1" bs='1G' count=1 - done - # - members=() - for device in "${devices[@]}" ; do - members+=("${device}1") - done - mdadm \ - --create '/dev/md/crypt' \ - --level 0 \ - --metadata 1 \ - --name 'md:crypt' \ - --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000001' \ - "${members[@]}" - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + local device + local devices=( + '/dev/sda' + '/dev/sdb' + ) + local members + local number + local passphrase + local unit='mib' + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # + lsblk + echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' + read + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}" + # + parted "${device}" --script mktable gpt + # + parted "${device}" unit "${unit}" \ + mkpart "crypt-${number}" 33282 7630885 + # + parted "${device}" unit "${unit}" \ + mkpart "boot-${number}" 514 33282 + # + parted "${device}" unit "${unit}" \ + mkpart "esp-${number}" 2 514 + parted "${device}" set 3 esp on + # + parted "${device}" unit "${unit}" \ + mkpart "bios-${number}" 1 2 + parted "${device}" set 4 bios_grub on + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}4" + # wipe bios + dd \ + if='/dev/zero' of="${device}4" + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}3" + # format esp + dd \ + if='/dev/zero' of="${device}3" bs='1M' + mkfs.vfat \ + -F 32 \ + -S 4096 \ + -i "0000000${number}" \ + -n "esp-${number}" \ + "${device}3" + # mount esp + mkdir --parents "/media/esp/${number}" + mount "${device}3" "/media/esp/${number}" + done + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}2" + # wipe boot + dd status='progress' \ + if='/dev/zero' of="${device}2" bs='1G' count=1 + done + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}2") + done + mdadm \ + --create '/dev/md/boot' \ + --level 0 \ + --metadata 1 \ + --name 'md:boot' \ + --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000002' \ + "${members[@]}" + # + mkfs.btrfs --force \ + --checksum 'sha256' \ + --label 'boot' \ + --uuid '00000000-0000-0000-0000-00000000000b' \ + '/dev/md/boot' + # mount boot + mkdir --parents '/media/boot' + mount \ + --options 'autodefrag,compress-force=zstd' \ + '/dev/md/boot' '/media/boot' + # + number=0 + for device in "${devices[@]}" ; do + ((number++)) + echo ; echo "#${number}: ${device}1" + # wipe crypt head + dd status='progress' \ + if='/dev/zero' of="${device}1" bs='1G' count=1 + done + # + members=() + for device in "${devices[@]}" ; do + members+=("${device}1") + done + mdadm \ + --create '/dev/md/crypt' \ + --level 0 \ + --metadata 1 \ + --name 'md:crypt' \ + --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000001' \ + "${members[@]}" + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' } rescue_hetzner_wipe_8_8_1_zero() { - # wipe crypt - dd status='progress' \ - if='/dev/zero' of='/dev/mapper/crypt' bs='8G' + # wipe crypt + dd status='progress' \ + if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } rescue_hetzner_wipe_8_8_2_make() { - local passphrase - # close - cryptsetup luksClose 'crypt' - # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase - # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' - # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' - # format crypt - mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'crypt' \ - --uuid '00000000-0000-0000-0000-00000000000c' \ - '/dev/mapper/crypt' - # mount crypt - mkdir --parents '/media/crypt' - mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/mapper/crypt' '/media/crypt' - # make swap file - btrfs filesystem mkswapfile \ - --size '64g' \ - --uuid '00000000-0000-0000-0000-000000000005' \ - '/media/crypt/swap' + local passphrase + # close + cryptsetup luksClose 'crypt' + # read passphrase + echo -n 'PassPhrase: ' + read -r -s passphrase + # encrypt + echo "${passphrase}" \ + | cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' + # open + echo "${passphrase}" \ + | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # format crypt + mkfs.btrfs --force \ + --checksum 'sha256' \ + --label 'crypt' \ + --uuid '00000000-0000-0000-0000-00000000000c' \ + '/dev/mapper/crypt' + # mount crypt + mkdir --parents '/media/crypt' + mount \ + --options 'autodefrag,compress-force=zstd' \ + '/dev/mapper/crypt' '/media/crypt' + # make swap file + btrfs filesystem mkswapfile \ + --size '64g' \ + --uuid '00000000-0000-0000-0000-000000000005' \ + '/media/crypt/swap' } rescue_hetzner_wipe_8_8_3_close() { - umount '/media/boot' - # - umount '/media/crypt' \ - && cryptsetup luksClose 'crypt' + umount '/media/boot' + # + umount '/media/crypt' \ + && cryptsetup luksClose 'crypt' } From 5776a03fe4d9aeb8fdea18a5a6997f4ae7962641 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:02:08 +0100 Subject: [PATCH 253/702] indent --- bash/rescue-hetzner.sh | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 49ad0a5..676568d 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -101,33 +101,33 @@ rescue_hetzner_install() { } rescue_hetzner_upload() { -local host="${1}" -local hostname="${2}" -if [ "${hostname}" ] ; then - local user='root' - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o 'StrictHostKeyChecking=accept-new' \ - "${user_host}" - # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' - # attach session - mosh "${user_host}" -- byobu attach-session -else - echo 'Host?' - return 1 -fi + local host="${1}" + local hostname="${2}" + if [ "${hostname}" ] ; then + local user='root' + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o 'StrictHostKeyChecking=accept-new' \ + "${user_host}" + # upload root + rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' + # attach session + mosh "${user_host}" -- byobu attach-session + else + echo 'Host?' + return 1 + fi } rescue_hetzner_wipe_8_8_0_init() { From 641924309802dcfc32ca95fbd73b56f17611b96c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:14:04 +0100 Subject: [PATCH 254/702] shfmt --- bash/rescue-hetzner.sh | 271 +++++++++++++++++++++-------------------- 1 file changed, 141 insertions(+), 130 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 676568d..d170c95 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,10 +1,10 @@ rescue_hetzner_configure() { -local hostname="${1}" + local hostname="${1}" local package local packages=( - 'mosh' - 'screen' 'tmux' 'byobu' - 'apt-file' + 'mosh' + 'screen' 'tmux' 'byobu' + 'apt-file' ) # apt / conf echo -n "\ @@ -17,14 +17,14 @@ APT::Install-Suggests False; APT::Get::Show-Versions True; Dir::Etc::SourceParts ''; Dpkg::Progress True; -" > '/etc/apt/apt.conf' +" >'/etc/apt/apt.conf' # apt / sources echo -n "\ deb https://deb.debian.org/debian bookworm main non-free-firmware contrib non-free deb https://deb.debian.org/debian bookworm-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian bookworm-updates main non-free-firmware contrib non-free deb https://deb.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free -" > '/etc/apt/sources.list' +" >'/etc/apt/sources.list' # bash / rc main_link_bashrc mv .bashrc .bashrc.old @@ -34,7 +34,7 @@ deb https://deb.debian.org/debian-security bookworm-security main non-free-firmw echo -n "\ en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8 -" > '/etc/locale.gen' +" >'/etc/locale.gen' # generate locales locale-gen # update catalog @@ -42,11 +42,12 @@ fr_FR.UTF-8 UTF-8 # debian_disable_frontend # install packages - for package in "${packages[@]}" ; do - echo ; echo "${package}" + for package in "${packages[@]}"; do + echo + echo "${package}" apt-get install \ - --assume-yes \ - "${package}" + --assume-yes \ + "${package}" apt_clean_cache done # update catalog @@ -57,19 +58,19 @@ rescue_hetzner_install() { local package local release='bookworm' local packages=( - # installed - 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' - 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' - 'btrfs-progs' 'dosfstools' - 'git' 'nano' 'python3' 'rsync' 'vim' - 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' - # install - 'lshw' - 'duperemove' 'squashfs-tools' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'libdigest-sha3-perl' 'micro' - 'iotop' - 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' + # installed + 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' + 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' + 'btrfs-progs' 'dosfstools' + 'git' 'nano' 'python3' 'rsync' 'vim' + 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' + # install + 'lshw' + 'duperemove' 'squashfs-tools' + 'grub-efi-amd64-bin' 'grub-pc-bin' + 'libdigest-sha3-perl' 'micro' + 'iotop' + 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' ) local backports=( ) @@ -82,20 +83,22 @@ rescue_hetzner_install() { # apt_clean_cache # install packages - for package in "${packages[@]}" ; do - echo ; echo "${package}" + for package in "${packages[@]}"; do + echo + echo "${package}" apt-get install \ - --assume-yes \ - "${package}" + --assume-yes \ + "${package}" apt_clean_cache done # install backports - for package in "${backports[@]}" ; do - echo ; echo "${package}" + for package in "${backports[@]}"; do + echo + echo "${package}" apt-get install \ - --assume-yes \ - --target-release "${release}-backports" \ - "${package}" + --assume-yes \ + --target-release "${release}-backports" \ + "${package}" apt_clean_cache done } @@ -103,7 +106,7 @@ rescue_hetzner_install() { rescue_hetzner_upload() { local host="${1}" local hostname="${2}" - if [ "${hostname}" ] ; then + if [ "${hostname}" ]; then local user='root' # local user_host="${user}@${host}" @@ -111,8 +114,8 @@ rescue_hetzner_upload() { ssh-keygen -R "${host}" # copy ssh id ssh-copy-id \ - -o 'StrictHostKeyChecking=accept-new' \ - "${user_host}" + -o 'StrictHostKeyChecking=accept-new' \ + "${user_host}" # upload root rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup @@ -149,131 +152,139 @@ rescue_hetzner_wipe_8_8_0_init() { read # number=0 - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do ((number++)) - echo ; echo "#${number}: ${device}" + echo + echo "#${number}: ${device}" # - parted "${device}" --script mktable gpt + parted "${device}" --script \ + mktable gpt # - parted "${device}" unit "${unit}" \ - mkpart "crypt-${number}" 33282 7630885 + parted "${device}" \ + unit "${unit}" mkpart "crypt-${number}" 33282 7630885 # - parted "${device}" unit "${unit}" \ - mkpart "boot-${number}" 514 33282 + parted "${device}" \ + unit "${unit}" mkpart "boot-${number}" 514 33282 # - parted "${device}" unit "${unit}" \ - mkpart "esp-${number}" 2 514 - parted "${device}" set 3 esp on + parted "${device}" \ + unit "${unit}" mkpart "esp-${number}" 2 514 + parted "${device}" \ + set 3 esp on # - parted "${device}" unit "${unit}" \ - mkpart "bios-${number}" 1 2 - parted "${device}" set 4 bios_grub on + parted "${device}" \ + unit "${unit}" mkpart "bios-${number}" 1 2 + parted "${device}" \ + set 4 bios_grub on done # number=0 - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do ((number++)) - echo ; echo "#${number}: ${device}4" + echo + echo "#${number}: ${device}4" # wipe bios dd \ - if='/dev/zero' of="${device}4" + if='/dev/zero' of="${device}4" done # number=0 - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do ((number++)) - echo ; echo "#${number}: ${device}3" + echo + echo "#${number}: ${device}3" # format esp dd \ - if='/dev/zero' of="${device}3" bs='1M' + if='/dev/zero' of="${device}3" bs='1M' mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "0000000${number}" \ - -n "esp-${number}" \ - "${device}3" + -F 32 \ + -S 4096 \ + -i "0000000${number}" \ + -n "esp-${number}" \ + "${device}3" # mount esp mkdir --parents "/media/esp/${number}" mount "${device}3" "/media/esp/${number}" done # number=0 - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do ((number++)) - echo ; echo "#${number}: ${device}2" + echo + echo "#${number}: ${device}2" # wipe boot dd status='progress' \ - if='/dev/zero' of="${device}2" bs='1G' count=1 + if='/dev/zero' of="${device}2" bs='1G' count=1 done # members=() - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do members+=("${device}2") done mdadm \ - --create '/dev/md/boot' \ - --level 0 \ - --metadata 1 \ - --name 'md:boot' \ - --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000002' \ - "${members[@]}" + --create '/dev/md/boot' \ + --level 0 \ + --metadata 1 \ + --name 'md:boot' \ + --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000002' \ + "${members[@]}" # mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'boot' \ - --uuid '00000000-0000-0000-0000-00000000000b' \ - '/dev/md/boot' + --checksum 'sha256' \ + --label 'boot' \ + --uuid '00000000-0000-0000-0000-00000000000b' \ + '/dev/md/boot' # mount boot mkdir --parents '/media/boot' mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/md/boot' '/media/boot' + --options 'autodefrag,compress-force=zstd' \ + '/dev/md/boot' '/media/boot' # number=0 - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do ((number++)) - echo ; echo "#${number}: ${device}1" + echo + echo "#${number}: ${device}1" # wipe crypt head dd status='progress' \ - if='/dev/zero' of="${device}1" bs='1G' count=1 + if='/dev/zero' of="${device}1" bs='1G' count=1 done # members=() - for device in "${devices[@]}" ; do + for device in "${devices[@]}"; do members+=("${device}1") done mdadm \ - --create '/dev/md/crypt' \ - --level 0 \ - --metadata 1 \ - --name 'md:crypt' \ - --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000001' \ - "${members[@]}" + --create '/dev/md/crypt' \ + --level 0 \ + --metadata 1 \ + --name 'md:crypt' \ + --raid-devices ${#devices[@]} \ + --uuid '00000000:00000000:00000000:00000001' \ + "${members[@]}" # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + echo "${passphrase}" | + cryptsetup luksOpen '/dev/md/crypt' 'crypt' } rescue_hetzner_wipe_8_8_1_zero() { # wipe crypt dd status='progress' \ - if='/dev/zero' of='/dev/mapper/crypt' bs='8G' + if='/dev/zero' of='/dev/mapper/crypt' bs='8G' } rescue_hetzner_wipe_8_8_2_make() { @@ -284,43 +295,43 @@ rescue_hetzner_wipe_8_8_2_make() { echo -n 'PassPhrase: ' read -r -s passphrase # encrypt - echo "${passphrase}" \ - | cryptsetup \ - --verbose \ - --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ - --iter-time 8192 \ - --key-size 512 \ - --hash 'sha512' \ - --use-random \ - luksFormat \ - '/dev/md/crypt' + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type 'luks2' \ + --pbkdf 'argon2id' \ + --cipher 'aes-xts-plain64' \ + --iter-time 8192 \ + --key-size 512 \ + --hash 'sha512' \ + --use-random \ + luksFormat \ + '/dev/md/crypt' # open - echo "${passphrase}" \ - | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + echo "${passphrase}" | + cryptsetup luksOpen '/dev/md/crypt' 'crypt' # format crypt mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'crypt' \ - --uuid '00000000-0000-0000-0000-00000000000c' \ - '/dev/mapper/crypt' + --checksum 'sha256' \ + --label 'crypt' \ + --uuid '00000000-0000-0000-0000-00000000000c' \ + '/dev/mapper/crypt' # mount crypt mkdir --parents '/media/crypt' mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/mapper/crypt' '/media/crypt' + --options 'autodefrag,compress-force=zstd' \ + '/dev/mapper/crypt' '/media/crypt' # make swap file btrfs filesystem mkswapfile \ - --size '64g' \ - --uuid '00000000-0000-0000-0000-000000000005' \ - '/media/crypt/swap' + --size '64g' \ + --uuid '00000000-0000-0000-0000-000000000005' \ + '/media/crypt/swap' } rescue_hetzner_wipe_8_8_3_close() { umount '/media/boot' # - umount '/media/crypt' \ - && cryptsetup luksClose 'crypt' + umount '/media/crypt' && + cryptsetup luksClose 'crypt' } From 1f9ba3b19d72b698b2d53f8d2eac56a631c190d4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:19:05 +0100 Subject: [PATCH 255/702] parted --- bash/rescue-hetzner.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index d170c95..ab7d379 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -157,22 +157,27 @@ rescue_hetzner_wipe_8_8_0_init() { echo echo "#${number}: ${device}" # - parted "${device}" --script \ + parted "${device}" \ + --script \ mktable gpt # parted "${device}" \ - unit "${unit}" mkpart "crypt-${number}" 33282 7630885 + unit "${unit}" \ + mkpart "crypt-${number}" 33282 7630885 # parted "${device}" \ - unit "${unit}" mkpart "boot-${number}" 514 33282 + unit "${unit}" \ + mkpart "boot-${number}" 514 33282 # parted "${device}" \ - unit "${unit}" mkpart "esp-${number}" 2 514 + unit "${unit}" \ + mkpart "esp-${number}" 2 514 parted "${device}" \ set 3 esp on # parted "${device}" \ - unit "${unit}" mkpart "bios-${number}" 1 2 + unit "${unit}" \ + mkpart "bios-${number}" 1 2 parted "${device}" \ set 4 bios_grub on done From ef87d4d410ffefa8013167d5a7d3df6211a58351 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:21:21 +0100 Subject: [PATCH 256/702] parted/ovh --- bash/rescue-ovh.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index a98e8f7..a88b9af 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -152,17 +152,29 @@ rescue_ovh_wipe_vle2_0_init() { printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" read -r # - parted "${device}" --script mktable gpt + parted "${device}" \ + --script \ + mktable gpt # - parted "${device}" unit "${unit}" mkpart "crypt" 4610 40960 + parted "${device}" \ + unit "${unit}" \ + mkpart "crypt" 4610 40960 # - parted "${device}" unit "${unit}" mkpart "boot" 514 4610 + parted "${device}" \ + unit "${unit}" \ + mkpart "boot" 514 4610 # - parted "${device}" unit "${unit}" mkpart "esp" 2 514 - parted "${device}" set 3 esp on + parted "${device}" \ + unit "${unit}" \ + mkpart "esp" 2 514 + parted "${device}" \ + set 3 esp on # - parted "${device}" unit "${unit}" mkpart bios 1 2 - parted "${device}" set 4 bios_grub on + parted "${device}" \ + unit "${unit}" \ + mkpart bios 1 2 + parted "${device}" \ + set 4 bios_grub on # bios / wipe dd if="/dev/zero" of="${device}4" # esp / wipe From d11ab01afe392b952f4e7cee08fcf1e4461ce271 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:33:55 +0100 Subject: [PATCH 257/702] configure --- bash/rescue-hetzner.sh | 70 +++++------------------------------------- bash/rescue-ovh.sh | 68 +--------------------------------------- bash/rescue.sh | 65 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 129 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index ab7d379..5b123ab 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,59 +1,3 @@ -rescue_hetzner_configure() { - local hostname="${1}" - local package - local packages=( - 'mosh' - 'screen' 'tmux' 'byobu' - 'apt-file' - ) - # apt / conf - echo -n "\ -Acquire::AllowInsecureRepositories False; -Acquire::AllowWeakRepositories False; -Acquire::AllowDowngradeToInsecureRepositories False; -Acquire::Check-Valid-Until True; -APT::Install-Recommends False; -APT::Install-Suggests False; -APT::Get::Show-Versions True; -Dir::Etc::SourceParts ''; -Dpkg::Progress True; -" >'/etc/apt/apt.conf' - # apt / sources - echo -n "\ -deb https://deb.debian.org/debian bookworm main non-free-firmware contrib non-free -deb https://deb.debian.org/debian bookworm-backports main non-free-firmware contrib non-free -deb https://deb.debian.org/debian bookworm-updates main non-free-firmware contrib non-free -deb https://deb.debian.org/debian-security bookworm-security main non-free-firmware contrib non-free -" >'/etc/apt/sources.list' - # bash / rc - main_link_bashrc - mv .bashrc .bashrc.old - # host name - hostname "${hostname}" - # locales - echo -n "\ -en_US.UTF-8 UTF-8 -fr_FR.UTF-8 UTF-8 -" >'/etc/locale.gen' - # generate locales - locale-gen - # update catalog - apt-get update - # - debian_disable_frontend - # install packages - for package in "${packages[@]}"; do - echo - echo "${package}" - apt-get install \ - --assume-yes \ - "${package}" - apt_clean_cache - done - # update catalog - apt-get update -} - rescue_hetzner_install() { local package local release='bookworm' @@ -107,28 +51,30 @@ rescue_hetzner_upload() { local host="${1}" local hostname="${2}" if [ "${hostname}" ]; then - local user='root' + local user="root" # local user_host="${user}@${host}" # remove fingerprints ssh-keygen -R "${host}" # copy ssh id ssh-copy-id \ - -o 'StrictHostKeyChecking=accept-new' \ + -o "StrictHostKeyChecking=accept-new" \ "${user_host}" # upload root - rsync --delete --recursive "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + rsync --delete --recursive \ + "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable - ssh "${user_host}" -- "source '/etc/bash/main.sh' ; rescue_hetzner_configure '${hostname}'" + ssh "${user_host}" -- "\ +source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys 'rescue_hetzner_install' 'C-m' + ssh "${user_host}" -- byobu send-keys "rescue_hetzner_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else - echo 'Host?' + echo "Host?" return 1 fi } diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index a88b9af..cd91e87 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,71 +1,5 @@ #! /usr/bin/env sh -rescue_ovh_configure() { - local hostname="${1}" - local release="bookworm" - local package - # apt / conf - printf "\ -Acquire::AllowInsecureRepositories False; -Acquire::AllowWeakRepositories False; -Acquire::AllowDowngradeToInsecureRepositories False; -Acquire::Check-Valid-Until True; -APT::Install-Recommends False; -APT::Install-Suggests False; -APT::Get::Show-Versions True; -Dir::Etc::SourceParts \"\"; -Dpkg::Progress True; -" >"/etc/apt/apt.conf.d/apt.conf" - # apt / sources - printf "%s" "\ -deb https://deb.debian.org/debian \ -${release} main non-free-firmware contrib non-free -deb https://deb.debian.org/debian \ -${release}-backports main non-free-firmware contrib non-free -deb https://deb.debian.org/debian \ -${release}-updates main non-free-firmware contrib non-free -deb https://deb.debian.org/debian-security \ -${release}-security main non-free-firmware contrib non-free -" >"/etc/apt/sources.list" - # bash / rc - main_link_bashrc - mv .bashrc .bashrc.old - # host name - hostname "${hostname}" - # locales - printf "\ -en_US.UTF-8 UTF-8 -fr_FR.UTF-8 UTF-8 -" >"/etc/locale.gen" - # generate locales - locale-gen - # update catalog - apt-get update - # disable frontend - debian_disable_frontend - # install backports - set "tmux" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean_cache - done - # install packages - set "apt-file" "mosh" "byobu" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - "${package}" - apt_clean_cache - done - # update catalog - apt-get update -} - rescue_ovh_install() { local package local release="bookworm" @@ -127,7 +61,7 @@ rescue_ovh_upload() { # call setup # TODO variable ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_ovh_configure \"${hostname}\"" +source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys diff --git a/bash/rescue.sh b/bash/rescue.sh index e69de29..8b1bc32 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -0,0 +1,65 @@ +rescue_configure() { + local hostname="${1}" + local release="bookworm" + local package + # apt / conf + printf "\ +Acquire::AllowInsecureRepositories False; +Acquire::AllowWeakRepositories False; +Acquire::AllowDowngradeToInsecureRepositories False; +Acquire::Check-Valid-Until True; +APT::Install-Recommends False; +APT::Install-Suggests False; +APT::Get::Show-Versions True; +Dir::Etc::SourceParts \"\"; +Dpkg::Progress True; +" >"/etc/apt/apt.conf.d/apt.conf" + # apt / sources + printf "%s" "\ +deb https://deb.debian.org/debian \ +${release} main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${release}-backports main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${release}-updates main non-free-firmware contrib non-free +deb https://deb.debian.org/debian-security \ +${release}-security main non-free-firmware contrib non-free +" >"/etc/apt/sources.list" + # bash / rc + main_link_bashrc + mv .bashrc .bashrc.old + # host name + hostname "${hostname}" + # locales + printf "\ +en_US.UTF-8 UTF-8 +fr_FR.UTF-8 UTF-8 +" >"/etc/locale.gen" + # generate locales + locale-gen + # update catalog + apt-get update + # disable frontend + debian_disable_frontend + # install backports + set "tmux" + for package in "${@}"; do + echo + echo "${package}" + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done + # install packages + set "apt-file" "mosh" "screen" "byobu" + for package in "${@}"; do + echo + echo "${package}" + apt-get install --assume-yes \ + "${package}" + apt_clean_cache + done + # update catalog + apt-get update +} From d3a510ab38d16bd46ce831fab3f75edb0dc2a230 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:34:32 +0100 Subject: [PATCH 258/702] shebang --- bash/rescue-ovh.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index cd91e87..b44c5fd 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,5 +1,3 @@ -#! /usr/bin/env sh - rescue_ovh_install() { local package local release="bookworm" From 98c121d8374464a4fa440cfa44ec00f833a74290 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:52:34 +0100 Subject: [PATCH 259/702] install --- bash/rescue-hetzner.sh | 51 +----------------------------------------- bash/rescue-ovh.sh | 44 +----------------------------------- bash/rescue.sh | 42 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 93 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 5b123ab..0af9723 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,52 +1,3 @@ -rescue_hetzner_install() { - local package - local release='bookworm' - local packages=( - # installed - 'dmidecode' 'efibootmgr' 'pciutils' 'usbutils' - 'parted' 'mdadm' 'cryptsetup-bin' 'lvm2' - 'btrfs-progs' 'dosfstools' - 'git' 'nano' 'python3' 'rsync' 'vim' - 'file' 'htop' 'lsof' 'man-db' 'tree' 'uuid-runtime' - # install - 'lshw' - 'duperemove' 'squashfs-tools' - 'grub-efi-amd64-bin' 'grub-pc-bin' - 'libdigest-sha3-perl' 'micro' - 'iotop' - 'exa' 'ipcalc' 'lf' 'ncdu' 'nnn' 'ranger' - ) - local backports=( - ) - # update catalog - apt-get update - # - debian_disable_frontend - # upgrade packages - apt-get upgrade --assume-yes - # - apt_clean_cache - # install packages - for package in "${packages[@]}"; do - echo - echo "${package}" - apt-get install \ - --assume-yes \ - "${package}" - apt_clean_cache - done - # install backports - for package in "${backports[@]}"; do - echo - echo "${package}" - apt-get install \ - --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean_cache - done -} - rescue_hetzner_upload() { local host="${1}" local hostname="${2}" @@ -70,7 +21,7 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys "rescue_hetzner_install" "C-m" + ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index b44c5fd..a62ae4e 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,45 +1,3 @@ -rescue_ovh_install() { - local package - local release="bookworm" - # update catalog - apt-get update - # disable frontend - debian_disable_frontend - # upgrade packages - apt-get upgrade --assume-yes - # clean cache - apt_clean_cache - # install packages - set \ - "man-db" \ - "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ - "parted" "mdadm" "cryptsetup-bin" "lvm2" \ - "btrfs-progs" "dosfstools" "duperemove" "squashfs-tools" \ - "git" "micro" "nano" "python3" "rsync" "vim" \ - "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ - "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - "${package}" - apt_clean_cache - done - # install backports - set \ - "grub-pc-bin" \ - \ - "grub-efi-amd64-bin" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean_cache - done -} - rescue_ovh_upload() { local host="${1}" local hostname="${2}" @@ -63,7 +21,7 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys "rescue_ovh_install" "C-m" + ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else diff --git a/bash/rescue.sh b/bash/rescue.sh index 8b1bc32..2a716bd 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -63,3 +63,45 @@ fr_FR.UTF-8 UTF-8 # update catalog apt-get update } + +rescue_install() { + local package + local release="bookworm" + # update catalog + apt-get update + # disable frontend + debian_disable_frontend + # upgrade packages + apt-get upgrade --assume-yes + # clean cache + apt_clean_cache + # install packages + set \ + "man-db" \ + "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ + "parted" "mdadm" "cryptsetup-bin" "lvm2" \ + "btrfs-progs" "dosfstools" "duperemove" "squashfs-tools" \ + "git" "micro" "nano" "python3" "rsync" "vim" \ + "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ + "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" + for package in "${@}"; do + echo + echo "${package}" + apt-get install --assume-yes \ + "${package}" + apt_clean_cache + done + # install backports + set \ + "grub-pc-bin" \ + \ + "grub-efi-amd64-bin" + for package in "${@}"; do + echo + echo "${package}" + apt-get install --assume-yes \ + --target-release "${release}-backports" \ + "${package}" + apt_clean_cache + done +} From ddde3e3c6b8462f0a74460d18116da589c489f02 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:56:25 +0100 Subject: [PATCH 260/702] upload --- bash/rescue-hetzner.sh | 32 -------------------------------- bash/rescue-ovh.sh | 32 -------------------------------- bash/rescue.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 64 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 0af9723..0ef1d8a 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,35 +1,3 @@ -rescue_hetzner_upload() { - local host="${1}" - local hostname="${2}" - if [ "${hostname}" ]; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive \ - "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session - else - echo "Host?" - return 1 - fi -} - rescue_hetzner_wipe_8_8_0_init() { local device local devices=( diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index a62ae4e..8312dab 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,35 +1,3 @@ -rescue_ovh_upload() { - local host="${1}" - local hostname="${2}" - if [ "${hostname}" ]; then - local user="root" - # - local user_host="${user}@${host}" - # remove fingerprints - ssh-keygen -R "${host}" - # copy ssh id - ssh-copy-id \ - -o "StrictHostKeyChecking=accept-new" \ - "${user_host}" - # upload root - rsync --delete --recursive \ - "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" - # call setup - # TODO variable - ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" - # create session - ssh "${user_host}" -- byobu new-session -d - # send keys - ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" - # attach session - mosh "${user_host}" -- byobu attach-session - else - echo "Host?" - return 1 - fi -} - rescue_ovh_wipe_vle2_0_init() { local device="/dev/sdb" local passphrase diff --git a/bash/rescue.sh b/bash/rescue.sh index 2a716bd..c40abcc 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -105,3 +105,35 @@ rescue_install() { apt_clean_cache done } + +rescue_upload() { + local host="${1}" + local hostname="${2}" + if [ "${hostname}" ]; then + local user="root" + # + local user_host="${user}@${host}" + # remove fingerprints + ssh-keygen -R "${host}" + # copy ssh id + ssh-copy-id \ + -o "StrictHostKeyChecking=accept-new" \ + "${user_host}" + # upload root + rsync --delete --recursive \ + "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + # call setup + # TODO variable + ssh "${user_host}" -- "\ +source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" + # create session + ssh "${user_host}" -- byobu new-session -d + # send keys + ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" + # attach session + mosh "${user_host}" -- byobu attach-session + else + echo "Host?" + return 1 + fi +} From 6b81ee0a5a458d569cdad3325da12816dfcfef21 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 17:59:03 +0100 Subject: [PATCH 261/702] close --- bash/rescue-hetzner.sh | 7 ------- bash/rescue-ovh.sh | 6 ------ bash/rescue.sh | 6 ++++++ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 0ef1d8a..4d1100c 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -198,10 +198,3 @@ rescue_hetzner_wipe_8_8_2_make() { --uuid '00000000-0000-0000-0000-000000000005' \ '/media/crypt/swap' } - -rescue_hetzner_wipe_8_8_3_close() { - umount '/media/boot' - # - umount '/media/crypt' && - cryptsetup luksClose 'crypt' -} diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 8312dab..0b26d0d 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -125,9 +125,3 @@ rescue_ovh_wipe_vle2_2_make() { --uuid "00000000-0000-0000-0000-000000000005" \ "/media/crypt/swap" } - -rescue_ovh_wipe_vle2_3_close() { - umount "/media/boot" - umount "/media/crypt" && - cryptsetup luksClose "crypt" -} diff --git a/bash/rescue.sh b/bash/rescue.sh index c40abcc..a23f6d9 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -137,3 +137,9 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" return 1 fi } + +rescue_wipe_3_close() { + umount "/media/boot" + umount "/media/crypt" && + cryptsetup luksClose "crypt" +} From c4fcfbdca29dc618db4ce209bd6e2966594d1864 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 18:02:21 +0100 Subject: [PATCH 262/702] zero --- bash/rescue-hetzner.sh | 6 ------ bash/rescue-ovh.sh | 5 ----- bash/rescue.sh | 5 +++++ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 4d1100c..5a076fc 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -151,12 +151,6 @@ rescue_hetzner_wipe_8_8_0_init() { cryptsetup luksOpen '/dev/md/crypt' 'crypt' } -rescue_hetzner_wipe_8_8_1_zero() { - # wipe crypt - dd status='progress' \ - if='/dev/zero' of='/dev/mapper/crypt' bs='8G' -} - rescue_hetzner_wipe_8_8_2_make() { local passphrase # close diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 0b26d0d..1b7af69 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -80,11 +80,6 @@ rescue_ovh_wipe_vle2_0_init() { cryptsetup luksOpen "${device}1" "crypt" } -rescue_ovh_wipe_vle2_1_zero() { - # crypt / zero - dd status="progress" if="/dev/zero" of="/dev/mapper/crypt" bs="1G" -} - rescue_ovh_wipe_vle2_2_make() { local passphrase # crypt / close diff --git a/bash/rescue.sh b/bash/rescue.sh index a23f6d9..beee576 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -138,6 +138,11 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" fi } +rescue_wipe_1_zero() { + dd status="progress" \ + if="/dev/zero" of="/dev/mapper/crypt" bs="1G" +} + rescue_wipe_3_close() { umount "/media/boot" umount "/media/crypt" && From 9f550c4412c3012b1c3b4039a44cbaff2c3a6222 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 18:06:27 +0100 Subject: [PATCH 263/702] functions --- bash/rescue-hetzner.sh | 4 ++-- bash/rescue-ovh.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 5a076fc..bbbf94a 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,4 +1,4 @@ -rescue_hetzner_wipe_8_8_0_init() { +rescue_wipe_0_init_hetzner_8_8() { local device local devices=( '/dev/sda' @@ -151,7 +151,7 @@ rescue_hetzner_wipe_8_8_0_init() { cryptsetup luksOpen '/dev/md/crypt' 'crypt' } -rescue_hetzner_wipe_8_8_2_make() { +rescue_wipe_2_make_hetzner_8_8() { local passphrase # close cryptsetup luksClose 'crypt' diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 1b7af69..1ef38a2 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,4 +1,4 @@ -rescue_ovh_wipe_vle2_0_init() { +rescue_wipe_0_init_ovh_vle2() { local device="/dev/sdb" local passphrase local unit="mib" @@ -80,7 +80,7 @@ rescue_ovh_wipe_vle2_0_init() { cryptsetup luksOpen "${device}1" "crypt" } -rescue_ovh_wipe_vle2_2_make() { +rescue_wipe_2_make_ovh_vle2() { local passphrase # crypt / close cryptsetup luksClose "crypt" From 9b9e5032250a80c9283a9eda3673fb4aa2e2d1e0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 20:30:11 +0100 Subject: [PATCH 264/702] .shellcheckrc --- bash/.shellcheckrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 bash/.shellcheckrc diff --git a/bash/.shellcheckrc b/bash/.shellcheckrc new file mode 100644 index 0000000..26775fc --- /dev/null +++ b/bash/.shellcheckrc @@ -0,0 +1,3 @@ +#disable=2312,3043 +enable=all +shell=sh From a6180ecd657bbc2ceeaff1144545dbe2951ef983 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 20:33:23 +0100 Subject: [PATCH 265/702] log --- bash/log.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bash/log.sh b/bash/log.sh index f7d325e..5bb7906 100644 --- a/bash/log.sh +++ b/bash/log.sh @@ -7,14 +7,14 @@ LOG_LEVEL_TRACE=5 LOG_LEVEL=${LOG_LEVEL_WARN} -function log_fatal { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_FATAL} ] && echo "${@}" ; } +log_fatal() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ] && echo "${@}" ; } -function log_error { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_ERROR} ] && echo "${@}" ; } +log_error() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ] && echo "${@}" ; } -function log_warn { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_WARN} ] && echo "${@}" ; } +log_warn() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ] && echo "${@}" ; } -function log_info { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_INFO} ] && echo "${@}" ; } +log_info() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ] && echo "${@}" ; } -function log_debug { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_DEBUG} ] && echo "${@}" ; } +log_debug() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ] && echo "${@}" ; } -function log_trace { [ ${LOG_LEVEL} -ge ${LOG_LEVEL_TRACE} ] && echo "${@}" ; } +log_trace() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ] && echo "${@}" ; } From e139ac77580ff1217515c39760471b2ad84bc452 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 20:37:25 +0100 Subject: [PATCH 266/702] apt_clean --- bash/apt.sh | 4 ++-- bash/rescue.sh | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bash/apt.sh b/bash/apt.sh index e83ccc1..36bd5d6 100644 --- a/bash/apt.sh +++ b/bash/apt.sh @@ -1,3 +1,3 @@ -function apt_clean_cache { - apt-get clean +apt_clean() { + apt-get clean } diff --git a/bash/rescue.sh b/bash/rescue.sh index beee576..05ecac8 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -49,7 +49,7 @@ fr_FR.UTF-8 UTF-8 apt-get install --assume-yes \ --target-release "${release}-backports" \ "${package}" - apt_clean_cache + apt_clean done # install packages set "apt-file" "mosh" "screen" "byobu" @@ -58,7 +58,7 @@ fr_FR.UTF-8 UTF-8 echo "${package}" apt-get install --assume-yes \ "${package}" - apt_clean_cache + apt_clean done # update catalog apt-get update @@ -74,7 +74,7 @@ rescue_install() { # upgrade packages apt-get upgrade --assume-yes # clean cache - apt_clean_cache + apt_clean # install packages set \ "man-db" \ @@ -89,7 +89,7 @@ rescue_install() { echo "${package}" apt-get install --assume-yes \ "${package}" - apt_clean_cache + apt_clean done # install backports set \ @@ -102,7 +102,7 @@ rescue_install() { apt-get install --assume-yes \ --target-release "${release}-backports" \ "${package}" - apt_clean_cache + apt_clean done } From cc7e1cafb449177a5343a46dba1bc61366557f4d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 20:40:56 +0100 Subject: [PATCH 267/702] apt_upgrade --- bash/apt.sh | 9 ++++++++- bash/rescue.sh | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bash/apt.sh b/bash/apt.sh index 36bd5d6..ce43f1a 100644 --- a/bash/apt.sh +++ b/bash/apt.sh @@ -1,3 +1,10 @@ apt_clean() { - apt-get clean + apt-get \ + clean +} + +apt_upgrade() { + apt-get \ + upgrade \ + --assume-yes } diff --git a/bash/rescue.sh b/bash/rescue.sh index 05ecac8..34f1881 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -72,7 +72,7 @@ rescue_install() { # disable frontend debian_disable_frontend # upgrade packages - apt-get upgrade --assume-yes + apt_upgrade # clean cache apt_clean # install packages From 7c8f2d8f4963d1c2e09b03a298593f0b565fc06a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 20:42:37 +0100 Subject: [PATCH 268/702] apt_update --- bash/apt.sh | 5 +++++ bash/rescue.sh | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bash/apt.sh b/bash/apt.sh index ce43f1a..5b821e2 100644 --- a/bash/apt.sh +++ b/bash/apt.sh @@ -3,6 +3,11 @@ apt_clean() { clean } +apt_update() { + apt-get \ + update +} + apt_upgrade() { apt-get \ upgrade \ diff --git a/bash/rescue.sh b/bash/rescue.sh index 34f1881..1d64d59 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -38,7 +38,7 @@ fr_FR.UTF-8 UTF-8 # generate locales locale-gen # update catalog - apt-get update + apt_update # disable frontend debian_disable_frontend # install backports @@ -61,14 +61,14 @@ fr_FR.UTF-8 UTF-8 apt_clean done # update catalog - apt-get update + apt_update } rescue_install() { local package local release="bookworm" # update catalog - apt-get update + apt_update # disable frontend debian_disable_frontend # upgrade packages From c2d83e717f8c3fbb9862f4d8e2aa70a6e23e88a0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 21:08:52 +0100 Subject: [PATCH 269/702] error --- bash/rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/rescue.sh b/bash/rescue.sh index 1d64d59..b466b92 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -133,7 +133,7 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # attach session mosh "${user_host}" -- byobu attach-session else - echo "Host?" + echo "host & hostname" return 1 fi } From dbf1295148b97b19f982bf657234a8764498822e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 22:16:37 +0100 Subject: [PATCH 270/702] fixes --- bash/rescue-ovh.sh | 3 ++- bash/rescue.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 1ef38a2..5dee19b 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -16,7 +16,7 @@ rescue_wipe_0_init_ovh_vle2() { # parted "${device}" \ unit "${unit}" \ - mkpart "crypt" 4610 40960 + mkpart "crypt" 4610 40959 # parted "${device}" \ unit "${unit}" \ @@ -81,6 +81,7 @@ rescue_wipe_0_init_ovh_vle2() { } rescue_wipe_2_make_ovh_vle2() { + local device="/dev/sdb" local passphrase # crypt / close cryptsetup luksClose "crypt" diff --git a/bash/rescue.sh b/bash/rescue.sh index b466b92..732d1ea 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -140,7 +140,7 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" rescue_wipe_1_zero() { dd status="progress" \ - if="/dev/zero" of="/dev/mapper/crypt" bs="1G" + if="/dev/zero" of="/dev/mapper/crypt" bs="512M" } rescue_wipe_3_close() { From 918090d9be0d794e5d468c5db954fa3eaddab774 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 11 Nov 2024 22:21:17 +0100 Subject: [PATCH 271/702] mapper --- bash/rescue-ovh.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 5dee19b..314d452 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -110,11 +110,11 @@ rescue_wipe_2_make_ovh_vle2() { --checksum "sha256" \ --label "crypt" \ --uuid "00000000-0000-0000-0000-00000000000c" \ - "${device}1" + "/dev/mapper/crypt" # crypt / mount mkdir --parents "/media/crypt" mount --options "autodefrag,compress-force=zstd" \ - "${device}1" "/media/crypt" + "/dev/mapper/crypt" "/media/crypt" # crypt / swap btrfs filesystem mkswapfile \ --size "4g" \ From 084c92e50a63bcfafeea6140ae1305048031245c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:03:36 +0100 Subject: [PATCH 272/702] install --- bash/apt.sh | 25 ++++++++++++++++++++++++ bash/debian.sh | 9 +++++++-- bash/rescue.sh | 52 ++++++++------------------------------------------ 3 files changed, 40 insertions(+), 46 deletions(-) diff --git a/bash/apt.sh b/bash/apt.sh index 5b821e2..a0f7353 100644 --- a/bash/apt.sh +++ b/bash/apt.sh @@ -3,6 +3,30 @@ apt_clean() { clean } +apt_install_backports() { + apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" +} + +apt_install_release() { + apt_install_target "${DEBIAN_CODENAME}" "${@}" +} + +apt_install_target() { + local target="${1}" + shift + local package + for package in "${@}"; do + log_info + log_info "${package} ← ${target}" + apt-get \ + install \ + --assume-yes \ + --target-release "${target}" \ + "${package}" + apt_clean + done +} + apt_update() { apt-get \ update @@ -12,4 +36,5 @@ apt_upgrade() { apt-get \ upgrade \ --assume-yes + apt_clean } diff --git a/bash/debian.sh b/bash/debian.sh index acf628d..e3aa7ba 100644 --- a/bash/debian.sh +++ b/bash/debian.sh @@ -1,3 +1,8 @@ -function debian_disable_frontend { - export DEBIAN_FRONTEND='noninteractive' +DEBIAN_CODENAME="$( + grep "VERSION_CODENAME" "/etc/os-release" | + cut --delimiter "=" --fields "2" +)" + +debian_disable_frontend() { + export DEBIAN_FRONTEND='noninteractive' } diff --git a/bash/rescue.sh b/bash/rescue.sh index 732d1ea..3a4bb7d 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -1,7 +1,5 @@ rescue_configure() { local hostname="${1}" - local release="bookworm" - local package # apt / conf printf "\ Acquire::AllowInsecureRepositories False; @@ -17,13 +15,13 @@ Dpkg::Progress True; # apt / sources printf "%s" "\ deb https://deb.debian.org/debian \ -${release} main non-free-firmware contrib non-free +${DEBIAN_CODENAME} main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${release}-backports main non-free-firmware contrib non-free +${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${release}-updates main non-free-firmware contrib non-free +${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free deb https://deb.debian.org/debian-security \ -${release}-security main non-free-firmware contrib non-free +${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" # bash / rc main_link_bashrc @@ -42,41 +40,22 @@ fr_FR.UTF-8 UTF-8 # disable frontend debian_disable_frontend # install backports - set "tmux" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean - done + apt_install_backports "tmux" # install packages - set "apt-file" "mosh" "screen" "byobu" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - "${package}" - apt_clean - done + apt_install_release "apt-file" "mosh" "screen" "byobu" # update catalog apt_update } rescue_install() { - local package - local release="bookworm" # update catalog apt_update # disable frontend debian_disable_frontend # upgrade packages apt_upgrade - # clean cache - apt_clean # install packages - set \ + apt_install_release \ "man-db" \ "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \ @@ -84,26 +63,11 @@ rescue_install() { "git" "micro" "nano" "python3" "rsync" "vim" \ "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - "${package}" - apt_clean - done # install backports - set \ + apt_install_backports \ "grub-pc-bin" \ \ "grub-efi-amd64-bin" - for package in "${@}"; do - echo - echo "${package}" - apt-get install --assume-yes \ - --target-release "${release}-backports" \ - "${package}" - apt_clean - done } rescue_upload() { From 68d5c0b51a9053f88475d2b50a963041843e8330 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:26:24 +0100 Subject: [PATCH 273/702] local --- bash/.shellcheckrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/.shellcheckrc b/bash/.shellcheckrc index 26775fc..4a9be0e 100644 --- a/bash/.shellcheckrc +++ b/bash/.shellcheckrc @@ -1,3 +1,3 @@ -#disable=2312,3043 +disable=3043 enable=all shell=sh From 763d199cdef29cc40b9ba30b5a032209dcb9f41e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:26:59 +0100 Subject: [PATCH 274/702] gpg_ssh --- bash/gpg.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bash/gpg.sh b/bash/gpg.sh index 358b4ca..f9d6ef6 100644 --- a/bash/gpg.sh +++ b/bash/gpg.sh @@ -1,5 +1,12 @@ -if [ ${EUID} -ne 0 ] ; then - if [ -f "${HOME}/.gnupg/gpg-agent.conf" ] ; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - fi -fi +gpg_ssh() { + local user_id + user_id=$(id --user) + if [ "${user_id}" -ne 0 ]; then + if [ -f "${HOME}/.gnupg/gpg-agent.conf" ]; then + SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + export SSH_AUTH_SOCK + fi + fi +} + +gpg_ssh From abb6ed3a26c14be29eb88d65d4a20ab6b5bfb140 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:30:26 +0100 Subject: [PATCH 275/702] bsl --- bash/btrfs.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bash/btrfs.sh b/bash/btrfs.sh index 2513eda..1172d2d 100644 --- a/bash/btrfs.sh +++ b/bash/btrfs.sh @@ -1,7 +1,7 @@ -function bsl { - if [ "${1}" ] ; then - btrfs subvolume list "${1}" \ - | cut -d ' ' -f 9 \ - | sort - fi +bsl() { + if [ -n "${1}" ]; then + btrfs subvolume list "${1}" | + cut --delimiter " " --fields 9 | + sort + fi } From b37e4abc4ec13c54e095e8fda0ae8ab24bbeb68d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:42:16 +0100 Subject: [PATCH 276/702] not --- bash/util.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 bash/util.sh diff --git a/bash/util.sh b/bash/util.sh new file mode 100644 index 0000000..e3781a7 --- /dev/null +++ b/bash/util.sh @@ -0,0 +1,7 @@ +not() { + case "${1}" in + "false") echo "true" ;; + "true") echo "false" ;; + *) ;; + esac +} From 304d163d74daaceb2305a929a894460bf3666c25 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:43:20 +0100 Subject: [PATCH 277/702] ws --- bash/gsettings.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bash/gsettings.sh b/bash/gsettings.sh index 1fd3b72..e7e6a9d 100644 --- a/bash/gsettings.sh +++ b/bash/gsettings.sh @@ -1,12 +1,12 @@ -function ws { -local boolean="${1}" - if [ "${boolean}" == '1' ] ; then - boolean='true' - else - boolean='false' - fi - gsettings 'set' \ - 'org.gnome.mutter' \ - 'workspaces-only-on-primary' \ - "${boolean}" +ws() { + local boolean="${1}" + if [ "${boolean}" = "1" ]; then + boolean="true" + else + boolean="false" + fi + gsettings set \ + "org.gnome.mutter" \ + "workspaces-only-on-primary" \ + "${boolean}" } From 3d784b81c471b366f9f8d1d69032f537d80230b9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 06:52:21 +0100 Subject: [PATCH 278/702] ws --- bash/gsettings.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bash/gsettings.sh b/bash/gsettings.sh index e7e6a9d..1b4a08b 100644 --- a/bash/gsettings.sh +++ b/bash/gsettings.sh @@ -1,12 +1,9 @@ ws() { - local boolean="${1}" - if [ "${boolean}" = "1" ]; then - boolean="true" - else - boolean="false" - fi - gsettings set \ - "org.gnome.mutter" \ - "workspaces-only-on-primary" \ - "${boolean}" + local bool + local group="org.gnome.mutter" + local var="workspaces-only-on-primary" + bool="$(gsettings get "${group}" "${var}")" + bool="$(not "${bool}")" + gsettings set "${group}" "${var}" "${bool}" + log_info "${group}/${var}: ${bool}" } From 95828fe06ccec736bd2dd299e732db1ad9ee4e84 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:20:25 +0100 Subject: [PATCH 279/702] log --- bash/log.sh | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/bash/log.sh b/bash/log.sh index 5bb7906..069377e 100644 --- a/bash/log.sh +++ b/bash/log.sh @@ -5,16 +5,40 @@ LOG_LEVEL_INFO=3 LOG_LEVEL_DEBUG=4 LOG_LEVEL_TRACE=5 -LOG_LEVEL=${LOG_LEVEL_WARN} +LOG_LEVEL=${LOG_LEVEL_INFO} -log_fatal() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ] && echo "${@}" ; } +log_debug() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ]; then + echo "${@}" + fi +} -log_error() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ] && echo "${@}" ; } +log_error() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ]; then + echo "${@}" + fi +} -log_warn() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ] && echo "${@}" ; } +log_fatal() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ]; then + echo "${@}" + fi +} -log_info() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ] && echo "${@}" ; } +log_info() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ]; then + echo "${@}" + fi +} -log_debug() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ] && echo "${@}" ; } +log_trace() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ]; then + echo "${@}" + fi +} -log_trace() { [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ] && echo "${@}" ; } +log_warn() { + if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ]; then + echo "${@}" + fi +} From 9da2ddeb6f127ec8c41776305484fabb61a5e170 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:28:41 +0100 Subject: [PATCH 280/702] ws --- bash/gsettings.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bash/gsettings.sh b/bash/gsettings.sh index 1b4a08b..d47db25 100644 --- a/bash/gsettings.sh +++ b/bash/gsettings.sh @@ -1,9 +1,15 @@ ws() { local bool local group="org.gnome.mutter" - local var="workspaces-only-on-primary" - bool="$(gsettings get "${group}" "${var}")" + local name="workspaces-only-on-primary" + local var="${group}/${name}" + # get + bool="$(gsettings get "${group}" "${name}")" + log_debug "${var}: ${bool}" + # not bool="$(not "${bool}")" - gsettings set "${group}" "${var}" "${bool}" - log_info "${group}/${var}: ${bool}" + log_debug "${var}: ${bool}" + # set + gsettings set "${group}" "${name}" "${bool}" + log_info "${var}: ${bool}" } From f163abbd37ffbbd0daf7059c186cefb7f1275703 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:29:36 +0100 Subject: [PATCH 281/702] bool --- bash/gsettings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/gsettings.sh b/bash/gsettings.sh index d47db25..8916766 100644 --- a/bash/gsettings.sh +++ b/bash/gsettings.sh @@ -8,7 +8,7 @@ ws() { log_debug "${var}: ${bool}" # not bool="$(not "${bool}")" - log_debug "${var}: ${bool}" + log_debug "bool: ${bool}" # set gsettings set "${group}" "${name}" "${bool}" log_info "${var}: ${bool}" From 976cb6e919eb925076c252e9525c8745a357976b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:44:21 +0100 Subject: [PATCH 282/702] fixes --- bash/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 59788aa..dacbbfc 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -4,14 +4,14 @@ MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" -function main_link_bashrc { +main_link_bashrc() { local file='/etc/bash.bashrc' rm --force "${file}" ln --symbolic "${MAIN_BASH_FILE}" "${file}" } # import modules -function main_import_modules { +main_import_modules() { local file="${1}" if [ -f "${file}" ] ; then local path="$(realpath "${file}")" @@ -21,7 +21,7 @@ if [ -f "${file}" ] ; then local module for module in "${modules[@]}" ; do if [ "${module}" != "${path}" ] ; then - source "${module}" + . "${module}" fi done log_trace "${modules[@]}" From 195b185f6e879b6366055905b732742ffa3c853a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:58:17 +0100 Subject: [PATCH 283/702] completion --- bash/bash/completion.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/bash/completion.sh b/bash/bash/completion.sh index 748a2b9..21e8a21 100644 --- a/bash/bash/completion.sh +++ b/bash/bash/completion.sh @@ -1,5 +1,5 @@ -file='/usr/share/bash-completion/bash_completion' +file="/usr/share/bash-completion/bash_completion" -if [ -f "${file}" ] ; then - source "${file}" +if [ -f "${file}" ]; then + . "${file}" fi From 671beb4b0e124e4d4ef46eaf4e2a47de2180e9c5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 07:59:50 +0100 Subject: [PATCH 284/702] history --- bash/bash/history.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/bash/history.sh b/bash/bash/history.sh index 4a47ba3..59234ad 100644 --- a/bash/bash/history.sh +++ b/bash/bash/history.sh @@ -1,5 +1,5 @@ -HISTCONTROL='ignorespace' +HISTCONTROL="ignorespace" HISTSIZE=-1 -HISTTIMEFORMAT='%Y%m%d %H%M%S ' +HISTTIMEFORMAT="%Y%m%d %H%M%S " From fe5c75b1424ce29c4a1733bd822c4165222792d9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:28:08 +0100 Subject: [PATCH 285/702] passphrase --- bash/rescue-hetzner.sh | 10 ++++++---- bash/rescue-ovh.sh | 10 ++++++---- bash/util.sh | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index bbbf94a..f2e6d34 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -9,8 +9,7 @@ rescue_wipe_0_init_hetzner_8_8() { local passphrase local unit='mib' # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase + passphrase="$(read_passphrase)" # lsblk echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' @@ -149,6 +148,8 @@ rescue_wipe_0_init_hetzner_8_8() { # open echo "${passphrase}" | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # passphrase + unset passphrase } rescue_wipe_2_make_hetzner_8_8() { @@ -156,8 +157,7 @@ rescue_wipe_2_make_hetzner_8_8() { # close cryptsetup luksClose 'crypt' # read passphrase - echo -n 'PassPhrase: ' - read -r -s passphrase + passphrase="$(read_passphrase)" # encrypt echo "${passphrase}" | cryptsetup \ @@ -175,6 +175,8 @@ rescue_wipe_2_make_hetzner_8_8() { # open echo "${passphrase}" | cryptsetup luksOpen '/dev/md/crypt' 'crypt' + # passphrase + unset passphrase # format crypt mkfs.btrfs --force \ --checksum 'sha256' \ diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 314d452..ea71bcf 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -3,8 +3,7 @@ rescue_wipe_0_init_ovh_vle2() { local passphrase local unit="mib" # read passphrase - printf "PassPhrase: " - read -r -s passphrase + passphrase="$(read_passphrase)" # warn lsblk printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" @@ -78,6 +77,8 @@ rescue_wipe_0_init_ovh_vle2() { # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" + # passphrase + unset passphrase } rescue_wipe_2_make_ovh_vle2() { @@ -86,8 +87,7 @@ rescue_wipe_2_make_ovh_vle2() { # crypt / close cryptsetup luksClose "crypt" # read passphrase - printf "PassPhrase: " - read -r -s passphrase + passphrase="$(read_passphrase)" # crypt / encrypt echo "${passphrase}" | cryptsetup \ @@ -105,6 +105,8 @@ rescue_wipe_2_make_ovh_vle2() { # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" + # passphrase + unset passphrase # crypt / format mkfs.btrfs --force \ --checksum "sha256" \ diff --git a/bash/util.sh b/bash/util.sh index e3781a7..2711b03 100644 --- a/bash/util.sh +++ b/bash/util.sh @@ -5,3 +5,17 @@ not() { *) ;; esac } + +read_passphrase() { + read_secret "PassPhrase: " +} + +read_secret() { + local prompt="${1}" + local secret + printf "${prompt}" 1>&2 + read -r -s secret + echo >&2 + echo "${secret}" + unset secret +} From 305968a9e678cfe17aef0c968bb700f413a354f3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:31:24 +0100 Subject: [PATCH 286/702] noninteractive --- bash/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/debian.sh b/bash/debian.sh index e3aa7ba..ffce0da 100644 --- a/bash/debian.sh +++ b/bash/debian.sh @@ -4,5 +4,5 @@ DEBIAN_CODENAME="$( )" debian_disable_frontend() { - export DEBIAN_FRONTEND='noninteractive' + export DEBIAN_FRONTEND="noninteractive" } From 4e81f18817c18d70dd3b456cb46c8683532f48d9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:35:29 +0100 Subject: [PATCH 287/702] quotes --- bash/rescue-hetzner.sh | 92 +++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index f2e6d34..6991368 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,18 +1,18 @@ rescue_wipe_0_init_hetzner_8_8() { local device local devices=( - '/dev/sda' - '/dev/sdb' + "/dev/sda" + "/dev/sdb" ) local members local number local passphrase - local unit='mib' + local unit="mib" # read passphrase passphrase="$(read_passphrase)" # lsblk - echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\' + echo -n "WIPE" "${devices[@]}" "/?\\ OR CANCEL /!\\" read # number=0 @@ -53,7 +53,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo "#${number}: ${device}4" # wipe bios dd \ - if='/dev/zero' of="${device}4" + if="/dev/zero" of="${device}4" done # number=0 @@ -63,7 +63,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo "#${number}: ${device}3" # format esp dd \ - if='/dev/zero' of="${device}3" bs='1M' + if="/dev/zero" of="${device}3" bs="1M" mkfs.vfat \ -F 32 \ -S 4096 \ @@ -81,8 +81,8 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}2" # wipe boot - dd status='progress' \ - if='/dev/zero' of="${device}2" bs='1G' count=1 + dd status="progress" \ + if="/dev/zero" of="${device}2" bs="1G" count=1 done # members=() @@ -90,24 +90,24 @@ rescue_wipe_0_init_hetzner_8_8() { members+=("${device}2") done mdadm \ - --create '/dev/md/boot' \ + --create "/dev/md/boot" \ --level 0 \ --metadata 1 \ - --name 'md:boot' \ + --name "md:boot" \ --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000002' \ + --uuid "00000000:00000000:00000000:00000002" \ "${members[@]}" # mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'boot' \ - --uuid '00000000-0000-0000-0000-00000000000b' \ - '/dev/md/boot' + --checksum "sha256" \ + --label "boot" \ + --uuid "00000000-0000-0000-0000-00000000000b" \ + "/dev/md/boot" # mount boot - mkdir --parents '/media/boot' + mkdir --parents "/media/boot" mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/md/boot' '/media/boot' + --options "autodefrag,compress-force=zstd" \ + "/dev/md/boot" "/media/boot" # number=0 for device in "${devices[@]}"; do @@ -115,8 +115,8 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}1" # wipe crypt head - dd status='progress' \ - if='/dev/zero' of="${device}1" bs='1G' count=1 + dd status="progress" \ + if="/dev/zero" of="${device}1" bs="1G" count=1 done # members=() @@ -124,30 +124,30 @@ rescue_wipe_0_init_hetzner_8_8() { members+=("${device}1") done mdadm \ - --create '/dev/md/crypt' \ + --create "/dev/md/crypt" \ --level 0 \ --metadata 1 \ - --name 'md:crypt' \ + --name "md:crypt" \ --raid-devices ${#devices[@]} \ - --uuid '00000000:00000000:00000000:00000001' \ + --uuid "00000000:00000000:00000000:00000001" \ "${members[@]}" # encrypt echo "${passphrase}" | cryptsetup \ --verbose \ --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ --iter-time 8192 \ --key-size 512 \ - --hash 'sha512' \ + --hash "sha512" \ --use-random \ luksFormat \ - '/dev/md/crypt' + "/dev/md/crypt" # open echo "${passphrase}" | - cryptsetup luksOpen '/dev/md/crypt' 'crypt' + cryptsetup luksOpen "/dev/md/crypt" "crypt" # passphrase unset passphrase } @@ -155,7 +155,7 @@ rescue_wipe_0_init_hetzner_8_8() { rescue_wipe_2_make_hetzner_8_8() { local passphrase # close - cryptsetup luksClose 'crypt' + cryptsetup luksClose "crypt" # read passphrase passphrase="$(read_passphrase)" # encrypt @@ -163,34 +163,34 @@ rescue_wipe_2_make_hetzner_8_8() { cryptsetup \ --verbose \ --batch-mode \ - --type 'luks2' \ - --pbkdf 'argon2id' \ - --cipher 'aes-xts-plain64' \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ --iter-time 8192 \ --key-size 512 \ - --hash 'sha512' \ + --hash "sha512" \ --use-random \ luksFormat \ - '/dev/md/crypt' + "/dev/md/crypt" # open echo "${passphrase}" | - cryptsetup luksOpen '/dev/md/crypt' 'crypt' + cryptsetup luksOpen "/dev/md/crypt" "crypt" # passphrase unset passphrase # format crypt mkfs.btrfs --force \ - --checksum 'sha256' \ - --label 'crypt' \ - --uuid '00000000-0000-0000-0000-00000000000c' \ - '/dev/mapper/crypt' + --checksum "sha256" \ + --label "crypt" \ + --uuid "00000000-0000-0000-0000-00000000000c" \ + "/dev/mapper/crypt" # mount crypt - mkdir --parents '/media/crypt' + mkdir --parents "/media/crypt" mount \ - --options 'autodefrag,compress-force=zstd' \ - '/dev/mapper/crypt' '/media/crypt' + --options "autodefrag,compress-force=zstd" \ + "/dev/mapper/crypt" "/media/crypt" # make swap file btrfs filesystem mkswapfile \ - --size '64g' \ - --uuid '00000000-0000-0000-0000-000000000005' \ - '/media/crypt/swap' + --size "64g" \ + --uuid "00000000-0000-0000-0000-000000000005" \ + "/media/crypt/swap" } From 6840588cd5143cf482c763f13a1c05ac5d87b27e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:43:56 +0100 Subject: [PATCH 288/702] fixes --- bash/alias/bash.sh | 2 +- bash/alias/ls.sh | 2 +- bash/alias/pass.sh | 2 +- bash/mount-lxc.sh | 16 ++++++++-------- bash/mount.sh | 14 +++++++------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bash/alias/bash.sh b/bash/alias/bash.sh index f363670..aaa10ca 100644 --- a/bash/alias/bash.sh +++ b/bash/alias/bash.sh @@ -4,7 +4,7 @@ cd \ .. \ " -# change current directory to its parent's parent +# change current directory to its parent’s parent alias ...="\ cd \ ../.. \ diff --git a/bash/alias/ls.sh b/bash/alias/ls.sh index 952bc85..b6d3204 100644 --- a/bash/alias/ls.sh +++ b/bash/alias/ls.sh @@ -2,7 +2,7 @@ export LS_COLORS="\ di=0;94\ " -# list current directory's entries +# list current directory’s entries alias l="\ ls \ --all \ diff --git a/bash/alias/pass.sh b/bash/alias/pass.sh index f01c653..1f48255 100644 --- a/bash/alias/pass.sh +++ b/bash/alias/pass.sh @@ -1,4 +1,4 @@ -# display pass entry's content +# display pass entry’s content alias p="\ pass \ " diff --git a/bash/mount-lxc.sh b/bash/mount-lxc.sh index a0b3ace..2cc5a7e 100644 --- a/bash/mount-lxc.sh +++ b/bash/mount-lxc.sh @@ -1,31 +1,31 @@ -function mrc { +mrc() { local container="${1}" local f - for f in 'dev' 'dev/pts' 'proc' 'sys' ; do + for f in "dev" "dev/pts" "proc" "sys" ; do mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" done } -function crc { +crc() { local container="${1}" shift chroot "overlay/mount/var/lib/lxc/${container}/squashfs-root" "${@}" } -function urc { +urc() { local container="${1}" - for f in 'sys' 'proc' 'dev/pts' 'dev' ; do + for f in "sys" "proc" "dev/pts" "dev" ; do umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" done } -function mmc { +mmc() { local container="${1}" - mount --bind '/deb' "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" + mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" } -function umc { +umc() { local container="${1}" umount "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" } diff --git a/bash/mount.sh b/bash/mount.sh index c3ee8a3..5fe26a7 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -1,4 +1,4 @@ -function mo { +mo() { local directory="${1}" local file if [ "${directory}" ] ; then @@ -18,7 +18,7 @@ else fi } -function uo { +uo() { cd 'overlay' if umount 'mount' ; then rmdir 'mount' @@ -32,7 +32,7 @@ rmdir 'overlay' } -function mr { +mr() { for f in 'dev' 'dev/pts' 'proc' 'sys' ; do mount --bind "/${f}" "overlay/mount/${f}" done @@ -49,23 +49,23 @@ chroot \ \"overlay/mount\" \ " -function ur { +ur() { for f in 'sys' 'proc' 'dev/pts' 'dev' ; do umount --lazy "overlay/mount/${f}" done } -function mm { +mm() { mount --make-rslave --rbind '/deb' 'overlay/mount/deb' } -function um { +um() { umount --recursive 'overlay/mount/deb' } -function ms { +ms() { local directory="${1}" local level="${2}" if [ "${directory}" ] ; then From 3b979057c1bb5dc8d54a71709651c86e27af1bfa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:46:29 +0100 Subject: [PATCH 289/702] mount --- bash/mount.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/bash/mount.sh b/bash/mount.sh index 5fe26a7..9fda047 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -4,36 +4,36 @@ local file if [ "${directory}" ] ; then directory="$(realpath "${directory}")" file="${directory}/filesystem.squashfs" - if mkdir 'overlay' ; then - cd 'overlay' + if mkdir "overlay" ; then + cd "overlay" mkdir {lower,upper,work,mount} - if mount "${file}" 'lower' ; then - mount -t 'overlay' 'overlay' 'mount' \ --o lowerdir='lower',upperdir='upper',workdir='work' + if mount "${file}" "lower" ; then + mount -t "overlay" "overlay" "mount" \ +-o lowerdir="lower",upperdir="upper",workdir="work" fi cd .. fi else - echo 'KO: directory?' + echo "KO: directory?" fi } uo() { -cd 'overlay' -if umount 'mount' ; then - rmdir 'mount' - rm --recursive 'upper' 'work' - if umount 'lower' ; then - rmdir 'lower' +cd "overlay" +if umount "mount" ; then + rmdir "mount" + rm --recursive "upper" "work" + if umount "lower" ; then + rmdir "lower" fi fi cd .. -rmdir 'overlay' +rmdir "overlay" } mr() { -for f in 'dev' 'dev/pts' 'proc' 'sys' ; do +for f in "dev" "dev/pts" "proc" "sys" ; do mount --bind "/${f}" "overlay/mount/${f}" done } @@ -50,18 +50,18 @@ chroot \ " ur() { -for f in 'sys' 'proc' 'dev/pts' 'dev' ; do +for f in "sys" "proc" "dev/pts" "dev" ; do umount --lazy "overlay/mount/${f}" done } mm() { -mount --make-rslave --rbind '/deb' 'overlay/mount/deb' +mount --make-rslave --rbind "/deb" "overlay/mount/deb" } um() { -umount --recursive 'overlay/mount/deb' +umount --recursive "overlay/mount/deb" } @@ -70,12 +70,12 @@ local directory="${1}" local level="${2}" if [ "${directory}" ] ; then if mkdir "${directory}" ; then - [ "${level}" ] || level='18' + [ "${level}" ] || level="18" cp overlay/mount/{vmlinuz,initrd.img} "${directory}" mksquashfs \ -'overlay/mount' "${directory}/filesystem.squashfs" \ +"overlay/mount" "${directory}/filesystem.squashfs" \ -noappend \ --comp 'zstd' -Xcompression-level "${level}" +-comp "zstd" -Xcompression-level "${level}" chown --recursive 1000:1000 "${directory}" fi fi From d7e2f152573a7e1daa685d596a91c0a438875264 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:49:47 +0100 Subject: [PATCH 290/702] function --- bash/bash/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index da8a978..30e9014 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -15,7 +15,7 @@ local view="└ " view="${view}\e[0;32m" fi view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" - if [ "$(type -t __git_ps1)" == 'function' ] ; then + if [ "$(type -t __git_ps1)" == "function" ] ; then git="$(__git_ps1)" if [ "${git}" ] ; then view="${view} –\e[0;35m${git}\e[0m" From 6267af5ef8f062856788ddb83c1884e2fe99117e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:50:58 +0100 Subject: [PATCH 291/702] proxy --- bash/proxy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/proxy.sh b/bash/proxy.sh index a5713ad..e594e63 100644 --- a/bash/proxy.sh +++ b/bash/proxy.sh @@ -1,8 +1,8 @@ function socks { local value case "${1}" in - 'on') value='manual' ;; - *) value='none' ;; + "on") value="manual" ;; + *) value="none" ;; esac - gsettings set 'org.gnome.system.proxy' 'mode' "${value}" + gsettings set "org.gnome.system.proxy" "mode" "${value}" } From 3a2a6a483c235d39b6710ecd2de0539da04a041b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:51:58 +0100 Subject: [PATCH 292/702] main --- bash/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index dacbbfc..7df12eb 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -5,7 +5,7 @@ MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" main_link_bashrc() { - local file='/etc/bash.bashrc' + local file="/etc/bash.bashrc" rm --force "${file}" ln --symbolic "${MAIN_BASH_FILE}" "${file}" } @@ -17,7 +17,7 @@ if [ -f "${file}" ] ; then local path="$(realpath "${file}")" local root="$(dirname "${path}")" local IFS=$'\n' - local modules=($(find "${root}" -type 'f' -name '*.sh' | sort)) + local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) local module for module in "${modules[@]}" ; do if [ "${module}" != "${path}" ] ; then From 373b40dcf1d154f628ca923e452c7237c0a5daf9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:56:52 +0100 Subject: [PATCH 293/702] ps2 --- bash/bash/prompt.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 30e9014..12ab4a7 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,14 +1,11 @@ -PS2="\ -├ " - -function ps1 { -local code=${1} -local date="$(date +%H:%M:%S)" -local git -local host="$(hostname)" -local path="${PWD}" -local user="${USER}" -local view="└ " +ps1() { + local code=${1} + local date="$(date +%H:%M:%S)" + local git + local host="$(hostname)" + local path="${PWD}" + local user="${USER}" + local view="└ " if [ ${code} -ne 0 ] ; then view="${view}\e[0;31m" else @@ -33,3 +30,6 @@ local view="└ " } PS1='$(eval ps1 ${?})' + +PS2="\ +├ " From d3bfa52eda4d4c3c83db0450df0bc99c6843c912 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 09:59:53 +0100 Subject: [PATCH 294/702] ps1 --- bash/bash/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 12ab4a7..2fd0724 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -29,7 +29,7 @@ ps1() { echo -e "${view}\n${PS2}" } -PS1='$(eval ps1 ${?})' +PS1="\$(ps1 \${?})" PS2="\ ├ " From 44adf7cc8ffac17c5f1f163774a7d2c5fb0cccfa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:00:55 +0100 Subject: [PATCH 295/702] socks --- bash/proxy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/proxy.sh b/bash/proxy.sh index e594e63..02ee28a 100644 --- a/bash/proxy.sh +++ b/bash/proxy.sh @@ -1,5 +1,5 @@ -function socks { -local value +socks() { + local value case "${1}" in "on") value="manual" ;; *) value="none" ;; From fbfb4c27e623dffcfdae5d0c7480e0ddab2ad7bb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:11:35 +0100 Subject: [PATCH 296/702] mount --- bash/mount.sh | 100 ++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/bash/mount.sh b/bash/mount.sh index 9fda047..b9bc609 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -1,41 +1,44 @@ mo() { -local directory="${1}" -local file -if [ "${directory}" ] ; then - directory="$(realpath "${directory}")" - file="${directory}/filesystem.squashfs" - if mkdir "overlay" ; then - cd "overlay" - mkdir {lower,upper,work,mount} - if mount "${file}" "lower" ; then - mount -t "overlay" "overlay" "mount" \ --o lowerdir="lower",upperdir="upper",workdir="work" - fi - cd .. - fi -else - echo "KO: directory?" -fi + local directory="${1}" + local file + if [ "${directory}" ] ; then + directory="$(realpath "${directory}")" + file="${directory}/filesystem.squashfs" + if mkdir "overlay" ; then + cd "overlay" + mkdir {lower,upper,work,mount} + if mount "${file}" "lower" ; then + mount \ + -o lowerdir="lower",upperdir="upper",workdir="work" + -t "overlay" \ + "overlay" "mount" + fi + cd .. + fi + else + echo "KO: directory?" + fi } uo() { -cd "overlay" -if umount "mount" ; then - rmdir "mount" - rm --recursive "upper" "work" - if umount "lower" ; then - rmdir "lower" - fi -fi -cd .. -rmdir "overlay" + cd "overlay" + if umount "mount" ; then + rmdir "mount" + rm --recursive "upper" "work" + if umount "lower" ; then + rmdir "lower" + fi + fi + cd .. + rmdir "overlay" } mr() { -for f in "dev" "dev/pts" "proc" "sys" ; do - mount --bind "/${f}" "overlay/mount/${f}" -done + local f + for f in "dev" "dev/pts" "proc" "sys" ; do + mount --bind "/${f}" "overlay/mount/${f}" + done } alias cr="\ @@ -50,33 +53,34 @@ chroot \ " ur() { -for f in "sys" "proc" "dev/pts" "dev" ; do - umount --lazy "overlay/mount/${f}" -done + local f + for f in "sys" "proc" "dev/pts" "dev" ; do + umount --lazy "overlay/mount/${f}" + done } mm() { -mount --make-rslave --rbind "/deb" "overlay/mount/deb" + mount --make-rslave --rbind "/deb" "overlay/mount/deb" } um() { -umount --recursive "overlay/mount/deb" + umount --recursive "overlay/mount/deb" } ms() { -local directory="${1}" -local level="${2}" -if [ "${directory}" ] ; then - if mkdir "${directory}" ; then - [ "${level}" ] || level="18" - cp overlay/mount/{vmlinuz,initrd.img} "${directory}" - mksquashfs \ -"overlay/mount" "${directory}/filesystem.squashfs" \ --noappend \ --comp "zstd" -Xcompression-level "${level}" - chown --recursive 1000:1000 "${directory}" - fi -fi + local directory="${1}" + local level="${2}" + if [ "${directory}" ] ; then + if mkdir "${directory}" ; then + [ "${level}" ] || level="18" + cp overlay/mount/{vmlinuz,initrd.img} "${directory}" + mksquashfs \ + "overlay/mount" "${directory}/filesystem.squashfs" \ + -noappend \ + -comp "zstd" -Xcompression-level "${level}" + chown --recursive 1000:1000 "${directory}" + fi + fi } From 8b39df8ed0727a8b7087c6ab05f21df728d534fe Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:14:08 +0100 Subject: [PATCH 297/702] main,proxy --- bash/main.sh | 42 +++++++++++++++++++++--------------------- bash/proxy.sh | 12 ++++++------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 7df12eb..01b2691 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -5,31 +5,31 @@ MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" main_link_bashrc() { - local file="/etc/bash.bashrc" - rm --force "${file}" - ln --symbolic "${MAIN_BASH_FILE}" "${file}" + local file="/etc/bash.bashrc" + rm --force "${file}" + ln --symbolic "${MAIN_BASH_FILE}" "${file}" } # import modules main_import_modules() { -local file="${1}" -if [ -f "${file}" ] ; then - local path="$(realpath "${file}")" - local root="$(dirname "${path}")" - local IFS=$'\n' - local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) - local module - for module in "${modules[@]}" ; do - if [ "${module}" != "${path}" ] ; then - . "${module}" - fi - done - log_trace "${modules[@]}" - return 0 -else - log_fatal "No file: ${file}" - return 1 -fi + local file="${1}" + if [ -f "${file}" ] ; then + local path="$(realpath "${file}")" + local root="$(dirname "${path}")" + local IFS=$'\n' + local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) + local module + for module in "${modules[@]}" ; do + if [ "${module}" != "${path}" ] ; then + . "${module}" + fi + done + log_trace "${modules[@]}" + return 0 + else + log_fatal "No file: ${file}" + return 1 + fi } # import modules diff --git a/bash/proxy.sh b/bash/proxy.sh index 02ee28a..0ccc891 100644 --- a/bash/proxy.sh +++ b/bash/proxy.sh @@ -1,8 +1,8 @@ socks() { - local value - case "${1}" in - "on") value="manual" ;; - *) value="none" ;; - esac - gsettings set "org.gnome.system.proxy" "mode" "${value}" + local value + case "${1}" in + "on") value="manual" ;; + *) value="none" ;; + esac + gsettings set "org.gnome.system.proxy" "mode" "${value}" } From 663d99bb14fd92d4b47f06a12ed344893e96e843 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:15:58 +0100 Subject: [PATCH 298/702] lxc --- bash/mount-lxc.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/bash/mount-lxc.sh b/bash/mount-lxc.sh index 2cc5a7e..2a4b5a1 100644 --- a/bash/mount-lxc.sh +++ b/bash/mount-lxc.sh @@ -1,31 +1,32 @@ mrc() { -local container="${1}" -local f - for f in "dev" "dev/pts" "proc" "sys" ; do - mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" - done + local container="${1}" + local f + for f in "dev" "dev/pts" "proc" "sys" ; do + mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" + done } crc() { -local container="${1}" - shift - chroot "overlay/mount/var/lib/lxc/${container}/squashfs-root" "${@}" + local container="${1}" + shift + chroot "overlay/mount/var/lib/lxc/${container}/squashfs-root" "${@}" } urc() { -local container="${1}" - for f in "sys" "proc" "dev/pts" "dev" ; do - umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" - done + local container="${1}" + local f + for f in "sys" "proc" "dev/pts" "dev" ; do + umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" + done } mmc() { -local container="${1}" - mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" + local container="${1}" + mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" } umc() { -local container="${1}" - umount "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" + local container="${1}" + umount "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" } From 88162d22fe44d12878599fc106081a37e4c74eaf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:18:44 +0100 Subject: [PATCH 299/702] prompt --- bash/bash/prompt.sh | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 2fd0724..069b34e 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,32 +1,32 @@ ps1() { - local code=${1} - local date="$(date +%H:%M:%S)" - local git - local host="$(hostname)" - local path="${PWD}" - local user="${USER}" - local view="└ " - if [ ${code} -ne 0 ] ; then - view="${view}\e[0;31m" - else - view="${view}\e[0;32m" - fi - view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" - if [ "$(type -t __git_ps1)" == "function" ] ; then - git="$(__git_ps1)" - if [ "${git}" ] ; then - view="${view} –\e[0;35m${git}\e[0m" - fi - fi - view="${view}\n\e[0;36m${path}\e[0m" - view="${view}\n┌ " - if [ ${EUID} -eq 0 ] ; then - view="${view}\e[0;31m" - else - view="${view}\e[0;32m" - fi - view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m" - echo -e "${view}\n${PS2}" + local code=${1} + local date="$(date +%H:%M:%S)" + local git + local host="$(hostname)" + local path="${PWD}" + local user="${USER}" + local view="└ " + if [ ${code} -ne 0 ] ; then + view="${view}\e[0;31m" + else + view="${view}\e[0;32m" + fi + view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" + if [ "$(type -t __git_ps1)" == "function" ] ; then + git="$(__git_ps1)" + if [ "${git}" ] ; then + view="${view} –\e[0;35m${git}\e[0m" + fi + fi + view="${view}\n\e[0;36m${path}\e[0m" + view="${view}\n┌ " + if [ ${EUID} -eq 0 ] ; then + view="${view}\e[0;31m" + else + view="${view}\e[0;32m" + fi + view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m" + echo -e "${view}\n${PS2}" } PS1="\$(ps1 \${?})" From a4ed6cdbdbf40d202a342acf530dbf3a44712336 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:25:44 +0100 Subject: [PATCH 300/702] fixes --- bash/mount.sh | 6 +++--- bash/rescue.sh | 2 +- bash/util.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/mount.sh b/bash/mount.sh index b9bc609..ca6ac45 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -9,7 +9,7 @@ mo() { mkdir {lower,upper,work,mount} if mount "${file}" "lower" ; then mount \ - -o lowerdir="lower",upperdir="upper",workdir="work" + -o lowerdir="lower",upperdir="upper",workdir="work" \ -t "overlay" \ "overlay" "mount" fi @@ -72,9 +72,9 @@ um() { ms() { local directory="${1}" local level="${2}" - if [ "${directory}" ] ; then + if [ -n "${directory}" ] ; then if mkdir "${directory}" ; then - [ "${level}" ] || level="18" + [ -n "${level}" ] || level="18" cp overlay/mount/{vmlinuz,initrd.img} "${directory}" mksquashfs \ "overlay/mount" "${directory}/filesystem.squashfs" \ diff --git a/bash/rescue.sh b/bash/rescue.sh index 3a4bb7d..58076e6 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -73,7 +73,7 @@ rescue_install() { rescue_upload() { local host="${1}" local hostname="${2}" - if [ "${hostname}" ]; then + if [ -n "${hostname}" ]; then local user="root" # local user_host="${user}@${host}" diff --git a/bash/util.sh b/bash/util.sh index 2711b03..458995f 100644 --- a/bash/util.sh +++ b/bash/util.sh @@ -13,7 +13,7 @@ read_passphrase() { read_secret() { local prompt="${1}" local secret - printf "${prompt}" 1>&2 + printf "%s" "${prompt}" 1>&2 read -r -s secret echo >&2 echo "${secret}" From 0dfc4d99ed4e48b5e1edf84e16380bbd8b480c49 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:27:50 +0100 Subject: [PATCH 301/702] read --- bash/rescue-hetzner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 6991368..b4cf60a 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -13,7 +13,7 @@ rescue_wipe_0_init_hetzner_8_8() { # lsblk echo -n "WIPE" "${devices[@]}" "/?\\ OR CANCEL /!\\" - read + read -r # number=0 for device in "${devices[@]}"; do From 11c131e849230f53587d21058e18f769e5ce9e29 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:29:09 +0100 Subject: [PATCH 302/702] nano --- bash/mount.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/mount.sh b/bash/mount.sh index ca6ac45..ee14c83 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -1,7 +1,7 @@ mo() { local directory="${1}" local file - if [ "${directory}" ] ; then + if [ -n "${directory}" ] ; then directory="$(realpath "${directory}")" file="${directory}/filesystem.squashfs" if mkdir "overlay" ; then From 5cf0d4021ea1f5755758de30c69d0d4398a57b9a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 19:45:47 +0100 Subject: [PATCH 303/702] partitions --- bash/rescue-hetzner.sh | 31 ++++++++----------------------- bash/rescue-ovh.sh | 31 ++++++++----------------------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index b4cf60a..4536e47 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -7,7 +7,6 @@ rescue_wipe_0_init_hetzner_8_8() { local members local number local passphrase - local unit="mib" # read passphrase passphrase="$(read_passphrase)" # @@ -21,28 +20,14 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}" # - parted "${device}" \ - --script \ - mktable gpt - # - parted "${device}" \ - unit "${unit}" \ - mkpart "crypt-${number}" 33282 7630885 - # - parted "${device}" \ - unit "${unit}" \ - mkpart "boot-${number}" 514 33282 - # - parted "${device}" \ - unit "${unit}" \ - mkpart "esp-${number}" 2 514 - parted "${device}" \ - set 3 esp on - # - parted "${device}" \ - unit "${unit}" \ - mkpart "bios-${number}" 1 2 - parted "${device}" \ + parted --script "${device}" \ + mktable gpt \ + unit "mib" \ + mkpart "crypt-${number}" 33282 7630885 \ + mkpart "boot-${number}" 514 33282 \ + mkpart "esp-${number}" 2 514 \ + set 3 esp on \ + mkpart "bios-${number}" 1 2 \ set 4 bios_grub on done # diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index ea71bcf..c267929 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -1,7 +1,6 @@ rescue_wipe_0_init_ovh_vle2() { local device="/dev/sdb" local passphrase - local unit="mib" # read passphrase passphrase="$(read_passphrase)" # warn @@ -9,28 +8,14 @@ rescue_wipe_0_init_ovh_vle2() { printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" read -r # - parted "${device}" \ - --script \ - mktable gpt - # - parted "${device}" \ - unit "${unit}" \ - mkpart "crypt" 4610 40959 - # - parted "${device}" \ - unit "${unit}" \ - mkpart "boot" 514 4610 - # - parted "${device}" \ - unit "${unit}" \ - mkpart "esp" 2 514 - parted "${device}" \ - set 3 esp on - # - parted "${device}" \ - unit "${unit}" \ - mkpart bios 1 2 - parted "${device}" \ + parted --script "${device}" \ + mktable gpt \ + unit "mib" \ + mkpart "crypt" 4610 40959 \ + mkpart "boot" 514 4610 \ + mkpart "esp" 2 514 \ + set 3 esp on \ + mkpart bios 1 2 \ set 4 bios_grub on # bios / wipe dd if="/dev/zero" of="${device}4" From dfe3be4f1cf521d24f49713c2196af66bbad2078 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 20:03:47 +0100 Subject: [PATCH 304/702] fat --- bash/fs.sh | 19 +++++++++++++++++++ bash/rescue-hetzner.sh | 7 +------ bash/rescue-ovh.sh | 7 +------ 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 bash/fs.sh diff --git a/bash/fs.sh b/bash/fs.sh new file mode 100644 index 0000000..df0980e --- /dev/null +++ b/bash/fs.sh @@ -0,0 +1,19 @@ +fs_make_fat() { + local device="${1}" + local name="${2}" + local volid="${3}" + if [ -b "${device}" ]; then + set -- \ + -F 32 \ + -S 4096 + if [ -n "${name}" ]; then + set -- "${@}" \ + -n "${name}" + fi + if [ -n "${volid}" ]; then + set -- "${@}" \ + -i "${volid}" + fi + mkfs.fat "${@}" "${device}" + fi +} diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 4536e47..3ca0f3b 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -49,12 +49,7 @@ rescue_wipe_0_init_hetzner_8_8() { # format esp dd \ if="/dev/zero" of="${device}3" bs="1M" - mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "0000000${number}" \ - -n "esp-${number}" \ - "${device}3" + fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" mount "${device}3" "/media/esp/${number}" diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index c267929..63c5192 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -22,12 +22,7 @@ rescue_wipe_0_init_ovh_vle2() { # esp / wipe dd if="/dev/zero" of="${device}3" bs="1M" # esp / format - mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "00000001" \ - -n "esp" \ - "${device}3" + fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp" From 3b2df8f8a067bef320a3e941f997e43f3c55e7b4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 20:13:32 +0100 Subject: [PATCH 305/702] fs_wipe --- bash/fs.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index df0980e..1b2e72b 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -17,3 +17,24 @@ fs_make_fat() { mkfs.fat "${@}" "${device}" fi } + +fs_wipe() { + local device="${1}" + local buffer="${2}" + local count="${3}" + if [ -b "${device}" ]; then + set -- \ + status="progress" \ + if="/dev/zero" \ + of="${device}" + if [ -n "${buffer}" ]; then + set -- "${@}" \ + bs="${buffer}" + fi + if [ -n "${count}" ]; then + set -- "${@}" \ + count=${count} + fi + dd "${@}" + fi +} From 378e0e530f7bd0bda618d28ffc0f79c837ac63aa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 20:22:58 +0100 Subject: [PATCH 306/702] wipes --- bash/rescue-hetzner.sh | 12 ++++-------- bash/rescue-ovh.sh | 8 ++++---- bash/rescue.sh | 3 +-- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 3ca0f3b..6386621 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -37,8 +37,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}4" # wipe bios - dd \ - if="/dev/zero" of="${device}4" + fs_wipe "${device}4" done # number=0 @@ -47,8 +46,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}3" # format esp - dd \ - if="/dev/zero" of="${device}3" bs="1M" + fs_wipe "${device}3" "1M" fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" @@ -61,8 +59,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}2" # wipe boot - dd status="progress" \ - if="/dev/zero" of="${device}2" bs="1G" count=1 + fs_wipe "${device}2" "1G" 1 done # members=() @@ -95,8 +92,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}1" # wipe crypt head - dd status="progress" \ - if="/dev/zero" of="${device}1" bs="1G" count=1 + fs_wipe "${device}1" "1G" 1 done # members=() diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 63c5192..0683acf 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -18,16 +18,16 @@ rescue_wipe_0_init_ovh_vle2() { mkpart bios 1 2 \ set 4 bios_grub on # bios / wipe - dd if="/dev/zero" of="${device}4" + fs_wipe "${device}4" # esp / wipe - dd if="/dev/zero" of="${device}3" bs="1M" + fs_wipe "${device}3" "1M" # esp / format fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp" # boot / wipe - dd status="progress" if="/dev/zero" of="${device}2" bs="1G" count=1 + fs_wipe "${device}2" "1G" 1 # boot / format mkfs.btrfs --force \ --checksum "sha256" \ @@ -39,7 +39,7 @@ rescue_wipe_0_init_ovh_vle2() { mount --options "autodefrag,compress-force=zstd" \ "${device}2" "/media/boot" # crypt / wipe - dd status="progress" if="/dev/zero" of="${device}1" bs="1G" count=1 + fs_wipe "${device}1" "1G" 1 # crypt / encrypt echo "${passphrase}" | cryptsetup \ diff --git a/bash/rescue.sh b/bash/rescue.sh index 58076e6..47f6ca7 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -103,8 +103,7 @@ source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" } rescue_wipe_1_zero() { - dd status="progress" \ - if="/dev/zero" of="/dev/mapper/crypt" bs="512M" + fs_wipe "/dev/mapper/crypt" "512M" } rescue_wipe_3_close() { From fdffd7fb08549d21d7d6b94aa9b7573712d3aad1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:38:38 +0100 Subject: [PATCH 307/702] fs_make_btrfs --- bash/fs.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index 1b2e72b..e13a498 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -1,3 +1,23 @@ +fs_make_btrfs() { + local device="${1}" + local label="${2}" + local uuid="${3}" + if [ -b "${device}" ]; then + set -- \ + --force \ + --checksum "sha256" + if [ -n "${label}" ]; then + set -- "${@}" \ + --label "${label}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" \ + --uuid "${uuid}" + fi + mkfs.btrfs "${@}" "${device}" + fi +} + fs_make_fat() { local device="${1}" local name="${2}" From 7611ee6103605f5d83c9d59f63c840a40c4dc074 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:47:18 +0100 Subject: [PATCH 308/702] btrfs --- bash/rescue-hetzner.sh | 14 ++++---------- bash/rescue-ovh.sh | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 6386621..142e07d 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -75,11 +75,8 @@ rescue_wipe_0_init_hetzner_8_8() { --uuid "00000000:00000000:00000000:00000002" \ "${members[@]}" # - mkfs.btrfs --force \ - --checksum "sha256" \ - --label "boot" \ - --uuid "00000000-0000-0000-0000-00000000000b" \ - "/dev/md/boot" + fs_make_btrfs "/dev/md/boot" "boot" \ + "00000000-0000-0000-0000-00000000000b" # mount boot mkdir --parents "/media/boot" mount \ @@ -154,11 +151,8 @@ rescue_wipe_2_make_hetzner_8_8() { # passphrase unset passphrase # format crypt - mkfs.btrfs --force \ - --checksum "sha256" \ - --label "crypt" \ - --uuid "00000000-0000-0000-0000-00000000000c" \ - "/dev/mapper/crypt" + fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + "00000000-0000-0000-0000-00000000000c" # mount crypt mkdir --parents "/media/crypt" mount \ diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 0683acf..4792c6c 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -29,11 +29,8 @@ rescue_wipe_0_init_ovh_vle2() { # boot / wipe fs_wipe "${device}2" "1G" 1 # boot / format - mkfs.btrfs --force \ - --checksum "sha256" \ - --label "boot" \ - --uuid "00000000-0000-0000-0000-00000000000b" \ - "${device}2" + fs_make_btrfs "${device}2" "boot" \ + "00000000-0000-0000-0000-00000000000b" # boot / mount mkdir --parents "/media/boot" mount --options "autodefrag,compress-force=zstd" \ @@ -88,11 +85,8 @@ rescue_wipe_2_make_ovh_vle2() { # passphrase unset passphrase # crypt / format - mkfs.btrfs --force \ - --checksum "sha256" \ - --label "crypt" \ - --uuid "00000000-0000-0000-0000-00000000000c" \ - "/dev/mapper/crypt" + fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + "00000000-0000-0000-0000-00000000000c" # crypt / mount mkdir --parents "/media/crypt" mount --options "autodefrag,compress-force=zstd" \ From 4590c5cda6eb08d7eada76162a13b4eb3faa61e8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:52:21 +0100 Subject: [PATCH 309/702] fs_make_btrfs_swap --- bash/fs.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index e13a498..71db3a7 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -18,6 +18,24 @@ fs_make_btrfs() { fi } +fs_make_btrfs_swap() { + local path="${1}" + local size="${2}" + local uuid="${3}" + if [ -n "${path}" ]; then + set filesystem mkswapfile + if [ -n "${size}" ]; then + set -- "${@}" \ + --size "${size}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" \ + --uuid "${uuid}" + fi + btrfs "${@}" "${path}" + fi +} + fs_make_fat() { local device="${1}" local name="${2}" From 799732c8ef52e5587e8cb725c50a478e30811b0c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:59:49 +0100 Subject: [PATCH 310/702] swaps --- bash/rescue-hetzner.sh | 6 ++---- bash/rescue-ovh.sh | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 142e07d..9637910 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -159,8 +159,6 @@ rescue_wipe_2_make_hetzner_8_8() { --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # make swap file - btrfs filesystem mkswapfile \ - --size "64g" \ - --uuid "00000000-0000-0000-0000-000000000005" \ - "/media/crypt/swap" + fs_make_btrfs_swap "/media/crypt/swap" "64g" \ + "00000000-0000-0000-0000-000000000005" } diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index 4792c6c..e15c9d9 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -92,8 +92,6 @@ rescue_wipe_2_make_ovh_vle2() { mount --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # crypt / swap - btrfs filesystem mkswapfile \ - --size "4g" \ - --uuid "00000000-0000-0000-0000-000000000005" \ - "/media/crypt/swap" + fs_make_btrfs_swap "/media/crypt/swap" "4g" \ + "00000000-0000-0000-0000-000000000005" } From 6be681d0fbb67d8f56c720bbfc4d288efc3ded10 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 23:13:45 +0100 Subject: [PATCH 311/702] luks_format --- bash/fs.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index 71db3a7..567479d 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -76,3 +76,23 @@ fs_wipe() { dd "${@}" fi } + +luks_format() { + local device="${1}" + local passphrase="${2}" + if [ -b "${device}" ]; then + echo "${passphrase}" | + cryptsetup \ + --verbose \ + --batch-mode \ + --type "luks2" \ + --pbkdf "argon2id" \ + --cipher "aes-xts-plain64" \ + --iter-time 4096 \ + --key-size 512 \ + --hash "sha512" \ + --use-random \ + luksFormat \ + "${device}" + fi +} From 7bce373af61db6b14ec2c74b71eafff160b708b4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 23:27:19 +0100 Subject: [PATCH 312/702] =?UTF-8?q?=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/fs.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bash/fs.sh b/bash/fs.sh index 567479d..07bd84f 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -78,20 +78,22 @@ fs_wipe() { } luks_format() { - local device="${1}" - local passphrase="${2}" + local passphrase="${1}" + local device="${2}" + local label="${3}" + local uuid="${4}" if [ -b "${device}" ]; then echo "${passphrase}" | cryptsetup \ - --verbose \ --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ --cipher "aes-xts-plain64" \ + --hash "sha512" \ --iter-time 4096 \ --key-size 512 \ - --hash "sha512" \ + --pbkdf "argon2id" \ + --type "luks2" \ --use-random \ + --verbose \ luksFormat \ "${device}" fi From 5e800b713d9abcd09c130bcb08919e2da5aafaf8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 23:32:14 +0100 Subject: [PATCH 313/702] args --- bash/fs.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/bash/fs.sh b/bash/fs.sh index 07bd84f..bf59782 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -83,18 +83,23 @@ luks_format() { local label="${3}" local uuid="${4}" if [ -b "${device}" ]; then + set -- \ + --batch-mode \ + --cipher "aes-xts-plain64" \ + --hash "sha512" \ + --iter-time 4096 \ + --key-size 512 \ + --pbkdf "argon2id" \ + --type "luks2" \ + --use-random \ + --verbose + if [ -n "${label}" ]; then + set -- "${@}" --label "${label}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" --label "${uuid}" + fi echo "${passphrase}" | - cryptsetup \ - --batch-mode \ - --cipher "aes-xts-plain64" \ - --hash "sha512" \ - --iter-time 4096 \ - --key-size 512 \ - --pbkdf "argon2id" \ - --type "luks2" \ - --use-random \ - --verbose \ - luksFormat \ - "${device}" + cryptsetup "${@}" luksFormat "${device}" fi } From c4f68fc29b8cff6d833492dc8b3ff789b12c7c14 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 23:32:36 +0100 Subject: [PATCH 314/702] fix --- bash/fs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/fs.sh b/bash/fs.sh index bf59782..9c1d122 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -97,7 +97,7 @@ luks_format() { set -- "${@}" --label "${label}" fi if [ -n "${uuid}" ]; then - set -- "${@}" --label "${uuid}" + set -- "${@}" --uuid "${uuid}" fi echo "${passphrase}" | cryptsetup "${@}" luksFormat "${device}" From b557ddde70c1f7b203f89b9cd32089ecd9d8b509 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 23:36:20 +0100 Subject: [PATCH 315/702] formats --- bash/rescue-hetzner.sh | 28 ++-------------------------- bash/rescue-ovh.sh | 28 ++-------------------------- 2 files changed, 4 insertions(+), 52 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 9637910..81930b4 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -105,19 +105,7 @@ rescue_wipe_0_init_hetzner_8_8() { --uuid "00000000:00000000:00000000:00000001" \ "${members[@]}" # encrypt - echo "${passphrase}" | - cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 8192 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "/dev/md/crypt" + luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" @@ -132,19 +120,7 @@ rescue_wipe_2_make_hetzner_8_8() { # read passphrase passphrase="$(read_passphrase)" # encrypt - echo "${passphrase}" | - cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 8192 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "/dev/md/crypt" + luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index e15c9d9..ed225d1 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -38,19 +38,7 @@ rescue_wipe_0_init_ovh_vle2() { # crypt / wipe fs_wipe "${device}1" "1G" 1 # crypt / encrypt - echo "${passphrase}" | - cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 4096 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "${device}1" + luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" @@ -66,19 +54,7 @@ rescue_wipe_2_make_ovh_vle2() { # read passphrase passphrase="$(read_passphrase)" # crypt / encrypt - echo "${passphrase}" | - cryptsetup \ - --verbose \ - --batch-mode \ - --type "luks2" \ - --pbkdf "argon2id" \ - --cipher "aes-xts-plain64" \ - --iter-time 4096 \ - --key-size 512 \ - --hash "sha512" \ - --use-random \ - luksFormat \ - "${device}1" + luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" From 010cb76003dfbf45431ec62b9039249e8307c153 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 09:11:24 +0100 Subject: [PATCH 316/702] _shell_ --- bash/main.sh | 8 ++++---- bash/rescue.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 01b2691..44c3910 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,13 +1,13 @@ #! /usr/bin/env bash -MAIN_BASH_FILE="$(realpath "${BASH_SOURCE[0]}")" +MAIN_SHELL_FILE="$(realpath "${BASH_SOURCE[0]}")" -MAIN_BASH_ROOT="$(dirname "${MAIN_BASH_FILE}")" +MAIN_SHELL_ROOT="$(dirname "${MAIN_SHELL_FILE}")" main_link_bashrc() { local file="/etc/bash.bashrc" rm --force "${file}" - ln --symbolic "${MAIN_BASH_FILE}" "${file}" + ln --symbolic "${MAIN_SHELL_FILE}" "${file}" } # import modules @@ -33,4 +33,4 @@ main_import_modules() { } # import modules -main_import_modules "${MAIN_BASH_FILE}" +main_import_modules "${MAIN_SHELL_FILE}" diff --git a/bash/rescue.sh b/bash/rescue.sh index 47f6ca7..162985a 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -85,7 +85,7 @@ rescue_upload() { "${user_host}" # upload root rsync --delete --recursive \ - "${MAIN_BASH_ROOT}/" "${user_host}:/etc/bash/" + "${MAIN_SHELL_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable ssh "${user_host}" -- "\ From 40c151d69e8d9d6c43e34074c8cc77bfc6d7f64c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 09:30:59 +0100 Subject: [PATCH 317/702] main/readlink --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 44c3910..63d91f2 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -MAIN_SHELL_FILE="$(realpath "${BASH_SOURCE[0]}")" +MAIN_SHELL_FILE="$(readlink --canonicalize-existing "${0}")" MAIN_SHELL_ROOT="$(dirname "${MAIN_SHELL_FILE}")" From e8c65c9821f91a7d1f7968973bd91bdbae5ef3e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 09:41:47 +0100 Subject: [PATCH 318/702] users --- bash/main.sh | 8 ++++---- bash/rescue.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 63d91f2..797aed1 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,13 +1,13 @@ #! /usr/bin/env bash -MAIN_SHELL_FILE="$(readlink --canonicalize-existing "${0}")" +MAIN_USERS_FILE="$(readlink --canonicalize-existing "${0}")" -MAIN_SHELL_ROOT="$(dirname "${MAIN_SHELL_FILE}")" +MAIN_USERS_ROOT="$(dirname "${MAIN_USERS_FILE}")" main_link_bashrc() { local file="/etc/bash.bashrc" rm --force "${file}" - ln --symbolic "${MAIN_SHELL_FILE}" "${file}" + ln --symbolic "${MAIN_USERS_FILE}" "${file}" } # import modules @@ -33,4 +33,4 @@ main_import_modules() { } # import modules -main_import_modules "${MAIN_SHELL_FILE}" +main_import_modules "${MAIN_USERS_FILE}" diff --git a/bash/rescue.sh b/bash/rescue.sh index 162985a..ded689d 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -85,7 +85,7 @@ rescue_upload() { "${user_host}" # upload root rsync --delete --recursive \ - "${MAIN_SHELL_ROOT}/" "${user_host}:/etc/bash/" + "${MAIN_USERS_ROOT}/" "${user_host}:/etc/bash/" # call setup # TODO variable ssh "${user_host}" -- "\ From 0cc06b6de097d63a626874134bcb57f100f88aac Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 09:43:27 +0100 Subject: [PATCH 319/702] shfmt --- bash/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 797aed1..4442460 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -13,14 +13,14 @@ main_link_bashrc() { # import modules main_import_modules() { local file="${1}" - if [ -f "${file}" ] ; then + if [ -f "${file}" ]; then local path="$(realpath "${file}")" local root="$(dirname "${path}")" local IFS=$'\n' local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) local module - for module in "${modules[@]}" ; do - if [ "${module}" != "${path}" ] ; then + for module in "${modules[@]}"; do + if [ "${module}" != "${path}" ]; then . "${module}" fi done From 8f81cb445568f58669d34ddcfa9378122d46e8b6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 10:40:27 +0100 Subject: [PATCH 320/702] realpath --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 4442460..e9c0d27 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -MAIN_USERS_FILE="$(readlink --canonicalize-existing "${0}")" +MAIN_USERS_FILE="$(realpath --canonicalize-existing "${0}")" MAIN_USERS_ROOT="$(dirname "${MAIN_USERS_FILE}")" From c22e6d18ce3ecf9a7d79c1ae191c4a37eb514a13 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:21:37 +0100 Subject: [PATCH 321/702] source --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index e9c0d27..bbfcc87 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -MAIN_USERS_FILE="$(realpath --canonicalize-existing "${0}")" +MAIN_USERS_FILE="$(realpath --canonicalize-existing "${BASH_SOURCE[0]}")" MAIN_USERS_ROOT="$(dirname "${MAIN_USERS_FILE}")" From 39fdabd885711063e363d1c66c19b06acc0e096d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:24:51 +0100 Subject: [PATCH 322/702] . --- bash/rescue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/rescue.sh b/bash/rescue.sh index ded689d..e7ff374 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -89,7 +89,7 @@ rescue_upload() { # call setup # TODO variable ssh "${user_host}" -- "\ -source \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" +. \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys From a6e63a67228d7bc5e2af8cd2eb66b981581bbb36 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:34:59 +0100 Subject: [PATCH 323/702] shfmt --- bash/bash/prompt.sh | 8 ++++---- bash/mount-lxc.sh | 5 ++--- bash/mount.sh | 21 +++++++++------------ bash/proxy.sh | 4 ++-- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 069b34e..d77a307 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -6,21 +6,21 @@ ps1() { local path="${PWD}" local user="${USER}" local view="└ " - if [ ${code} -ne 0 ] ; then + if [ ${code} -ne 0 ]; then view="${view}\e[0;31m" else view="${view}\e[0;32m" fi view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" - if [ "$(type -t __git_ps1)" == "function" ] ; then + if [ "$(type -t __git_ps1)" == "function" ]; then git="$(__git_ps1)" - if [ "${git}" ] ; then + if [ "${git}" ]; then view="${view} –\e[0;35m${git}\e[0m" fi fi view="${view}\n\e[0;36m${path}\e[0m" view="${view}\n┌ " - if [ ${EUID} -eq 0 ] ; then + if [ ${EUID} -eq 0 ]; then view="${view}\e[0;31m" else view="${view}\e[0;32m" diff --git a/bash/mount-lxc.sh b/bash/mount-lxc.sh index 2a4b5a1..8cc946e 100644 --- a/bash/mount-lxc.sh +++ b/bash/mount-lxc.sh @@ -1,7 +1,7 @@ mrc() { local container="${1}" local f - for f in "dev" "dev/pts" "proc" "sys" ; do + for f in "dev" "dev/pts" "proc" "sys"; do mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" done } @@ -15,12 +15,11 @@ crc() { urc() { local container="${1}" local f - for f in "sys" "proc" "dev/pts" "dev" ; do + for f in "sys" "proc" "dev/pts" "dev"; do umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" done } - mmc() { local container="${1}" mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" diff --git a/bash/mount.sh b/bash/mount.sh index ee14c83..fe5b273 100644 --- a/bash/mount.sh +++ b/bash/mount.sh @@ -1,13 +1,13 @@ mo() { local directory="${1}" local file - if [ -n "${directory}" ] ; then + if [ -n "${directory}" ]; then directory="$(realpath "${directory}")" file="${directory}/filesystem.squashfs" - if mkdir "overlay" ; then + if mkdir "overlay"; then cd "overlay" mkdir {lower,upper,work,mount} - if mount "${file}" "lower" ; then + if mount "${file}" "lower"; then mount \ -o lowerdir="lower",upperdir="upper",workdir="work" \ -t "overlay" \ @@ -22,10 +22,10 @@ mo() { uo() { cd "overlay" - if umount "mount" ; then + if umount "mount"; then rmdir "mount" rm --recursive "upper" "work" - if umount "lower" ; then + if umount "lower"; then rmdir "lower" fi fi @@ -33,10 +33,9 @@ uo() { rmdir "overlay" } - mr() { local f - for f in "dev" "dev/pts" "proc" "sys" ; do + for f in "dev" "dev/pts" "proc" "sys"; do mount --bind "/${f}" "overlay/mount/${f}" done } @@ -54,12 +53,11 @@ chroot \ ur() { local f - for f in "sys" "proc" "dev/pts" "dev" ; do + for f in "sys" "proc" "dev/pts" "dev"; do umount --lazy "overlay/mount/${f}" done } - mm() { mount --make-rslave --rbind "/deb" "overlay/mount/deb" } @@ -68,12 +66,11 @@ um() { umount --recursive "overlay/mount/deb" } - ms() { local directory="${1}" local level="${2}" - if [ -n "${directory}" ] ; then - if mkdir "${directory}" ; then + if [ -n "${directory}" ]; then + if mkdir "${directory}"; then [ -n "${level}" ] || level="18" cp overlay/mount/{vmlinuz,initrd.img} "${directory}" mksquashfs \ diff --git a/bash/proxy.sh b/bash/proxy.sh index 0ccc891..dd154a6 100644 --- a/bash/proxy.sh +++ b/bash/proxy.sh @@ -1,8 +1,8 @@ socks() { local value case "${1}" in - "on") value="manual" ;; - *) value="none" ;; + "on") value="manual" ;; + *) value="none" ;; esac gsettings set "org.gnome.system.proxy" "mode" "${value}" } From 76225ff81532d7733317b1a432a9d10c323e7761 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:43:12 +0100 Subject: [PATCH 324/702] quote --- bash/fs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/fs.sh b/bash/fs.sh index 9c1d122..5b53b9a 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -71,7 +71,7 @@ fs_wipe() { fi if [ -n "${count}" ]; then set -- "${@}" \ - count=${count} + count="${count}" fi dd "${@}" fi From 7398fa0726d88e9626433917b1f8daff6bcadec3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:55:48 +0100 Subject: [PATCH 325/702] rc/. --- bash/.shellcheckrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/.shellcheckrc b/bash/.shellcheckrc index 4a9be0e..173f983 100644 --- a/bash/.shellcheckrc +++ b/bash/.shellcheckrc @@ -1,3 +1,3 @@ -disable=3043 +disable=1090,3043 enable=all shell=sh From 28330ca3c8886b77e15d98450480a058da3d1b19 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 11:57:56 +0100 Subject: [PATCH 326/702] path,root --- bash/main.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index bbfcc87..c12cdf8 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -14,8 +14,10 @@ main_link_bashrc() { main_import_modules() { local file="${1}" if [ -f "${file}" ]; then - local path="$(realpath "${file}")" - local root="$(dirname "${path}")" + local path + local root + path="$(realpath "${file}")" + root="$(dirname "${path}")" local IFS=$'\n' local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) local module From f332104d12f3a672f3920c208be732360b6d9153 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 12:03:00 +0100 Subject: [PATCH 327/702] main_get_root --- bash/main.sh | 4 +++- bash/rescue.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index c12cdf8..5237bd3 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -2,7 +2,9 @@ MAIN_USERS_FILE="$(realpath --canonicalize-existing "${BASH_SOURCE[0]}")" -MAIN_USERS_ROOT="$(dirname "${MAIN_USERS_FILE}")" +main_get_root() { + dirname "${MAIN_USERS_FILE}" +} main_link_bashrc() { local file="/etc/bash.bashrc" diff --git a/bash/rescue.sh b/bash/rescue.sh index e7ff374..0d14bbd 100644 --- a/bash/rescue.sh +++ b/bash/rescue.sh @@ -85,7 +85,7 @@ rescue_upload() { "${user_host}" # upload root rsync --delete --recursive \ - "${MAIN_USERS_ROOT}/" "${user_host}:/etc/bash/" + "$(main_get_root)/" "${user_host}:/etc/bash/" # call setup # TODO variable ssh "${user_host}" -- "\ From dae14f780e7584e0691e64dbe3298b945fc2c27b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 12:08:04 +0100 Subject: [PATCH 328/702] log/prefix --- bash/log.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/log.sh b/bash/log.sh index 069377e..1891609 100644 --- a/bash/log.sh +++ b/bash/log.sh @@ -9,19 +9,19 @@ LOG_LEVEL=${LOG_LEVEL_INFO} log_debug() { if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ]; then - echo "${@}" + echo "[DEBUG]" "${@}" fi } log_error() { if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ]; then - echo "${@}" + echo "[ERROR]" "${@}" fi } log_fatal() { if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ]; then - echo "${@}" + echo "[FATAL]" "${@}" fi } @@ -33,12 +33,12 @@ log_info() { log_trace() { if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ]; then - echo "${@}" + echo "[TRACE]" "${@}" fi } log_warn() { if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ]; then - echo "${@}" + echo " [WARN]" "${@}" fi } From 2a568eeb221079ac69d840246e35882a4d3e0a15 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 12:41:37 +0100 Subject: [PATCH 329/702] ifs --- bash/main.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 5237bd3..029e6f4 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -16,19 +16,20 @@ main_link_bashrc() { main_import_modules() { local file="${1}" if [ -f "${file}" ]; then - local path - local root - path="$(realpath "${file}")" + local ifs module modules path root + path="$(realpath --canonicalize-existing "${file}")" root="$(dirname "${path}")" - local IFS=$'\n' - local modules=($(find "${root}" -type "f" -name "*.sh" | sort)) - local module - for module in "${modules[@]}"; do + modules="$(find "${root}" -type "f" -name "*.sh" | sort)" + ifs="${IFS}" + IFS=" +" + for module in ${modules}; do if [ "${module}" != "${path}" ]; then . "${module}" fi done - log_trace "${modules[@]}" + IFS="${ifs}" + log_trace "${modules}" return 0 else log_fatal "No file: ${file}" From 458e4b60f6ada50582b7011d63dd0aacd72ea1e1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 12:50:49 +0100 Subject: [PATCH 330/702] relative --- bash/main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 029e6f4..6adce22 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -19,11 +19,13 @@ main_import_modules() { local ifs module modules path root path="$(realpath --canonicalize-existing "${file}")" root="$(dirname "${path}")" - modules="$(find "${root}" -type "f" -name "*.sh" | sort)" + modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P +" | sort)" ifs="${IFS}" IFS=" " for module in ${modules}; do + module="${root}/${module}" if [ "${module}" != "${path}" ]; then . "${module}" fi From 3b062767c3e31cbe4a603d6f3ad422ce40d4805e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 12:55:14 +0100 Subject: [PATCH 331/702] log --- bash/main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index 6adce22..540747f 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -31,7 +31,9 @@ main_import_modules() { fi done IFS="${ifs}" - log_trace "${modules}" + log_info + log_info "${root}" + log_info "${modules}" return 0 else log_fatal "No file: ${file}" From c4e9f06cb24d925fbed0720e580015e4f65e3f3c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 13:08:09 +0100 Subject: [PATCH 332/702] stty --- bash/util.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bash/util.sh b/bash/util.sh index 458995f..8a345ba 100644 --- a/bash/util.sh +++ b/bash/util.sh @@ -14,7 +14,9 @@ read_secret() { local prompt="${1}" local secret printf "%s" "${prompt}" 1>&2 - read -r -s secret + stty -echo + read -r secret + stty echo echo >&2 echo "${secret}" unset secret From 818f48d92f4239712fdcbdc3d879883483edeba6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 13:10:19 +0100 Subject: [PATCH 333/702] -n --- bash/bash/prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index d77a307..73ef1ff 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -14,7 +14,7 @@ ps1() { view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" if [ "$(type -t __git_ps1)" == "function" ]; then git="$(__git_ps1)" - if [ "${git}" ]; then + if [ -n "${git}" ]; then view="${view} –\e[0;35m${git}\e[0m" fi fi From 87c53a18bafc1bdbd6ca05b91a4f9dd6e6131340 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 13:14:58 +0100 Subject: [PATCH 334/702] lint --- bash/bash/prompt.sh | 9 +++++---- bash/fs.sh | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 73ef1ff..5ba1159 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,12 +1,13 @@ ps1() { - local code=${1} - local date="$(date +%H:%M:%S)" + local date host + local code="${1}" + date="$(date +%H:%M:%S)" local git - local host="$(hostname)" + host="$(hostname)" local path="${PWD}" local user="${USER}" local view="└ " - if [ ${code} -ne 0 ]; then + if [ "${code}" -ne 0 ]; then view="${view}\e[0;31m" else view="${view}\e[0;32m" diff --git a/bash/fs.sh b/bash/fs.sh index 5b53b9a..05ac088 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -23,7 +23,7 @@ fs_make_btrfs_swap() { local size="${2}" local uuid="${3}" if [ -n "${path}" ]; then - set filesystem mkswapfile + set -- filesystem mkswapfile if [ -n "${size}" ]; then set -- "${@}" \ --size "${size}" From d028d83f7ac722463347eacbc267b528fd37de90 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 13:54:13 +0100 Subject: [PATCH 335/702] number --- bash/rescue-hetzner.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 81930b4..ee68157 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -16,7 +16,7 @@ rescue_wipe_0_init_hetzner_8_8() { # number=0 for device in "${devices[@]}"; do - ((number++)) + number=$((number + 1)) echo echo "#${number}: ${device}" # @@ -33,7 +33,7 @@ rescue_wipe_0_init_hetzner_8_8() { # number=0 for device in "${devices[@]}"; do - ((number++)) + number=$((number + 1)) echo echo "#${number}: ${device}4" # wipe bios @@ -42,7 +42,7 @@ rescue_wipe_0_init_hetzner_8_8() { # number=0 for device in "${devices[@]}"; do - ((number++)) + number=$((number + 1)) echo echo "#${number}: ${device}3" # format esp @@ -55,7 +55,7 @@ rescue_wipe_0_init_hetzner_8_8() { # number=0 for device in "${devices[@]}"; do - ((number++)) + number=$((number + 1)) echo echo "#${number}: ${device}2" # wipe boot @@ -85,7 +85,7 @@ rescue_wipe_0_init_hetzner_8_8() { # number=0 for device in "${devices[@]}"; do - ((number++)) + number=$((number + 1)) echo echo "#${number}: ${device}1" # wipe crypt head From 8d53e86bcdace9881ac3f1738bc5ff26b1edb2c3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:00:10 +0100 Subject: [PATCH 336/702] devices --- bash/rescue-hetzner.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index ee68157..82694d6 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -1,9 +1,8 @@ rescue_wipe_0_init_hetzner_8_8() { local device - local devices=( - "/dev/sda" + set \ + "/dev/sda" \ "/dev/sdb" - ) local members local number local passphrase @@ -11,11 +10,11 @@ rescue_wipe_0_init_hetzner_8_8() { passphrase="$(read_passphrase)" # lsblk - echo -n "WIPE" "${devices[@]}" "/?\\ OR CANCEL /!\\" + echo -n "WIPE" "${@}" "/?\\ OR CANCEL /!\\" read -r # number=0 - for device in "${devices[@]}"; do + for device in "${@}"; do number=$((number + 1)) echo echo "#${number}: ${device}" @@ -32,7 +31,7 @@ rescue_wipe_0_init_hetzner_8_8() { done # number=0 - for device in "${devices[@]}"; do + for device in "${@}"; do number=$((number + 1)) echo echo "#${number}: ${device}4" @@ -41,7 +40,7 @@ rescue_wipe_0_init_hetzner_8_8() { done # number=0 - for device in "${devices[@]}"; do + for device in "${@}"; do number=$((number + 1)) echo echo "#${number}: ${device}3" @@ -54,7 +53,7 @@ rescue_wipe_0_init_hetzner_8_8() { done # number=0 - for device in "${devices[@]}"; do + for device in "${@}"; do number=$((number + 1)) echo echo "#${number}: ${device}2" @@ -63,7 +62,7 @@ rescue_wipe_0_init_hetzner_8_8() { done # members=() - for device in "${devices[@]}"; do + for device in "${@}"; do members+=("${device}2") done mdadm \ @@ -71,7 +70,7 @@ rescue_wipe_0_init_hetzner_8_8() { --level 0 \ --metadata 1 \ --name "md:boot" \ - --raid-devices ${#devices[@]} \ + --raid-devices ${#} \ --uuid "00000000:00000000:00000000:00000002" \ "${members[@]}" # @@ -84,7 +83,7 @@ rescue_wipe_0_init_hetzner_8_8() { "/dev/md/boot" "/media/boot" # number=0 - for device in "${devices[@]}"; do + for device in "${@}"; do number=$((number + 1)) echo echo "#${number}: ${device}1" @@ -93,7 +92,7 @@ rescue_wipe_0_init_hetzner_8_8() { done # members=() - for device in "${devices[@]}"; do + for device in "${@}"; do members+=("${device}1") done mdadm \ @@ -101,7 +100,7 @@ rescue_wipe_0_init_hetzner_8_8() { --level 0 \ --metadata 1 \ --name "md:crypt" \ - --raid-devices ${#devices[@]} \ + --raid-devices ${#} \ --uuid "00000000:00000000:00000000:00000001" \ "${members[@]}" # encrypt From 2722134a0f7beda608b211efec7b76c23203b44c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:24:58 +0100 Subject: [PATCH 337/702] raid_create --- bash/fs.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index 05ac088..005a56d 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -103,3 +103,19 @@ luks_format() { cryptsetup "${@}" luksFormat "${device}" fi } + +raid_create() { + if [ -n "${4}" ]; then + local name="${1}" + local uuid="${2}" + shift 2 + mdadm \ + --create "/dev/md/${name}" \ + --level 0 \ + --metadata 1 \ + --name "md:${name}" \ + --raid-devices ${#} \ + --uuid "${uuid}" \ + "${@}" + fi +} From 6603c88198a0989079947408df72d091fc867390 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:30:50 +0100 Subject: [PATCH 338/702] raids --- bash/fs.sh | 32 ++++++++++++++++---------------- bash/rescue-hetzner.sh | 20 ++++---------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/bash/fs.sh b/bash/fs.sh index 005a56d..2635ce0 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -56,6 +56,22 @@ fs_make_fat() { fi } +fs_raid_create() { + if [ -n "${4}" ]; then + local name="${1}" + local uuid="${2}" + shift 2 + mdadm \ + --create "/dev/md/${name}" \ + --level 0 \ + --metadata 1 \ + --name "md:${name}" \ + --raid-devices ${#} \ + --uuid "${uuid}" \ + "${@}" + fi +} + fs_wipe() { local device="${1}" local buffer="${2}" @@ -103,19 +119,3 @@ luks_format() { cryptsetup "${@}" luksFormat "${device}" fi } - -raid_create() { - if [ -n "${4}" ]; then - local name="${1}" - local uuid="${2}" - shift 2 - mdadm \ - --create "/dev/md/${name}" \ - --level 0 \ - --metadata 1 \ - --name "md:${name}" \ - --raid-devices ${#} \ - --uuid "${uuid}" \ - "${@}" - fi -} diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 82694d6..0417230 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -65,14 +65,8 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members+=("${device}2") done - mdadm \ - --create "/dev/md/boot" \ - --level 0 \ - --metadata 1 \ - --name "md:boot" \ - --raid-devices ${#} \ - --uuid "00000000:00000000:00000000:00000002" \ - "${members[@]}" + fs_raid_create \ + "boot" "00000000:00000000:00000000:00000002" "${members[@]}" # fs_make_btrfs "/dev/md/boot" "boot" \ "00000000-0000-0000-0000-00000000000b" @@ -95,14 +89,8 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members+=("${device}1") done - mdadm \ - --create "/dev/md/crypt" \ - --level 0 \ - --metadata 1 \ - --name "md:crypt" \ - --raid-devices ${#} \ - --uuid "00000000:00000000:00000000:00000001" \ - "${members[@]}" + fs_raid_create \ + "crypt" "00000000:00000000:00000000:00000001" "${members[@]}" # encrypt luks_format "${passphrase}" "/dev/md/crypt" # open From 216fe057c915ae664dc69da87a460c7c1e0c8e01 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:38:35 +0100 Subject: [PATCH 339/702] echoes --- bash/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 540747f..9125fc9 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -19,21 +19,21 @@ main_import_modules() { local ifs module modules path root path="$(realpath --canonicalize-existing "${file}")" root="$(dirname "${path}")" + echo + echo "${root}" modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P " | sort)" ifs="${IFS}" IFS=" " for module in ${modules}; do + echo "${module%.sh}" module="${root}/${module}" if [ "${module}" != "${path}" ]; then . "${module}" fi done IFS="${ifs}" - log_info - log_info "${root}" - log_info "${modules}" return 0 else log_fatal "No file: ${file}" From 8982496082a7621f72e19e6653965a236e326f79 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 14:55:20 +0100 Subject: [PATCH 340/702] count --- bash/main.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index 9125fc9..b809dfe 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -16,18 +16,21 @@ main_link_bashrc() { main_import_modules() { local file="${1}" if [ -f "${file}" ]; then - local ifs module modules path root + local count ifs module modules path root path="$(realpath --canonicalize-existing "${file}")" root="$(dirname "${path}")" - echo - echo "${root}" modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P " | sort)" ifs="${IFS}" IFS=" " + count=0 + echo + echo "${root}" for module in ${modules}; do - echo "${module%.sh}" + count=$((count + 1)) + printf "%02d" "${count}" + echo " ${module%.sh}" module="${root}/${module}" if [ "${module}" != "${path}" ]; then . "${module}" From 00183fecc18e0fa411797333d7b8ea4bd22e6164 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 13 Nov 2024 15:01:02 +0100 Subject: [PATCH 341/702] . --- bash/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/main.sh b/bash/main.sh index b809dfe..c692412 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -26,7 +26,7 @@ main_import_modules() { " count=0 echo - echo "${root}" + echo ". ${root}" for module in ${modules}; do count=$((count + 1)) printf "%02d" "${count}" From 05710e7ef7cafb3b0043ce10d90550d4c0d3763e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 14 Nov 2024 00:07:05 +0100 Subject: [PATCH 342/702] rescue/ --- bash/{rescue.sh => rescue/common.sh} | 0 bash/{rescue-hetzner.sh => rescue/hetzner.sh} | 0 bash/{rescue-ovh.sh => rescue/ovh.sh} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename bash/{rescue.sh => rescue/common.sh} (100%) rename bash/{rescue-hetzner.sh => rescue/hetzner.sh} (100%) rename bash/{rescue-ovh.sh => rescue/ovh.sh} (100%) diff --git a/bash/rescue.sh b/bash/rescue/common.sh similarity index 100% rename from bash/rescue.sh rename to bash/rescue/common.sh diff --git a/bash/rescue-hetzner.sh b/bash/rescue/hetzner.sh similarity index 100% rename from bash/rescue-hetzner.sh rename to bash/rescue/hetzner.sh diff --git a/bash/rescue-ovh.sh b/bash/rescue/ovh.sh similarity index 100% rename from bash/rescue-ovh.sh rename to bash/rescue/ovh.sh From 672b385447efb5b39f7fcaa4b4a5fbfa963706f7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 16:26:54 +0100 Subject: [PATCH 343/702] wip/env --- bash/main.sh | 10 +++------- bash/rescue/common.sh | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bash/main.sh b/bash/main.sh index c692412..ff56a3c 100644 --- a/bash/main.sh +++ b/bash/main.sh @@ -1,9 +1,5 @@ -#! /usr/bin/env bash - -MAIN_USERS_FILE="$(realpath --canonicalize-existing "${BASH_SOURCE[0]}")" - -main_get_root() { - dirname "${MAIN_USERS_FILE}" +main_env_root() { + dirname "${ENV}" } main_link_bashrc() { @@ -45,4 +41,4 @@ main_import_modules() { } # import modules -main_import_modules "${MAIN_USERS_FILE}" +main_import_modules "${ENV}" diff --git a/bash/rescue/common.sh b/bash/rescue/common.sh index 0d14bbd..3671d15 100644 --- a/bash/rescue/common.sh +++ b/bash/rescue/common.sh @@ -85,7 +85,7 @@ rescue_upload() { "${user_host}" # upload root rsync --delete --recursive \ - "$(main_get_root)/" "${user_host}:/etc/bash/" + "$(main_env_root)" "${user_host}:/etc" # call setup # TODO variable ssh "${user_host}" -- "\ From f52abc28b34fe72c6156aeaaabba50b1b02726a8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 16:27:41 +0100 Subject: [PATCH 344/702] wip/shell --- {bash => shell}/.shellcheckrc | 0 {bash => shell}/alias/apt.sh | 0 {bash => shell}/alias/bash.sh | 0 {bash => shell}/alias/batcat.sh | 0 {bash => shell}/alias/btrfs.sh | 0 {bash => shell}/alias/byobu.sh | 0 {bash => shell}/alias/chmod.sh | 0 {bash => shell}/alias/chown.sh | 0 {bash => shell}/alias/clear.sh | 0 {bash => shell}/alias/cp.sh | 0 {bash => shell}/alias/emacs.sh | 0 {bash => shell}/alias/evince.sh | 0 {bash => shell}/alias/git.sh | 0 {bash => shell}/alias/gpg.sh | 0 {bash => shell}/alias/grep.sh | 0 {bash => shell}/alias/kill.sh | 0 {bash => shell}/alias/killall.sh | 0 {bash => shell}/alias/ls.sh | 0 {bash => shell}/alias/lsblk.sh | 0 {bash => shell}/alias/micro.sh | 0 {bash => shell}/alias/mkdir.sh | 0 {bash => shell}/alias/mount.sh | 0 {bash => shell}/alias/mv.sh | 0 {bash => shell}/alias/nano.sh | 0 {bash => shell}/alias/newsboat.sh | 0 {bash => shell}/alias/otpclient-cli.sh | 0 {bash => shell}/alias/pass.sh | 0 {bash => shell}/alias/ps.sh | 0 {bash => shell}/alias/pwgen.sh | 0 {bash => shell}/alias/rsync.sh | 0 {bash => shell}/alias/tar.sh | 0 {bash => shell}/alias/tree.sh | 0 {bash => shell}/apt.sh | 0 {bash => shell}/bash/completion.sh | 0 {bash => shell}/bash/history.sh | 0 {bash => shell}/bash/prompt.sh | 0 {bash => shell}/btrfs.sh | 0 {bash => shell}/debian.sh | 0 {bash => shell}/fs.sh | 0 {bash => shell}/gpg.sh | 0 {bash => shell}/gsettings.sh | 0 {bash => shell}/log.sh | 0 {bash => shell}/main.sh | 0 {bash => shell}/mount-lxc.sh | 0 {bash => shell}/mount.sh | 0 {bash => shell}/proxy.sh | 0 {bash => shell}/rescue/common.sh | 0 {bash => shell}/rescue/hetzner.sh | 0 {bash => shell}/rescue/ovh.sh | 0 {bash => shell}/util.sh | 0 50 files changed, 0 insertions(+), 0 deletions(-) rename {bash => shell}/.shellcheckrc (100%) rename {bash => shell}/alias/apt.sh (100%) rename {bash => shell}/alias/bash.sh (100%) rename {bash => shell}/alias/batcat.sh (100%) rename {bash => shell}/alias/btrfs.sh (100%) rename {bash => shell}/alias/byobu.sh (100%) rename {bash => shell}/alias/chmod.sh (100%) rename {bash => shell}/alias/chown.sh (100%) rename {bash => shell}/alias/clear.sh (100%) rename {bash => shell}/alias/cp.sh (100%) rename {bash => shell}/alias/emacs.sh (100%) rename {bash => shell}/alias/evince.sh (100%) rename {bash => shell}/alias/git.sh (100%) rename {bash => shell}/alias/gpg.sh (100%) rename {bash => shell}/alias/grep.sh (100%) rename {bash => shell}/alias/kill.sh (100%) rename {bash => shell}/alias/killall.sh (100%) rename {bash => shell}/alias/ls.sh (100%) rename {bash => shell}/alias/lsblk.sh (100%) rename {bash => shell}/alias/micro.sh (100%) rename {bash => shell}/alias/mkdir.sh (100%) rename {bash => shell}/alias/mount.sh (100%) rename {bash => shell}/alias/mv.sh (100%) rename {bash => shell}/alias/nano.sh (100%) rename {bash => shell}/alias/newsboat.sh (100%) rename {bash => shell}/alias/otpclient-cli.sh (100%) rename {bash => shell}/alias/pass.sh (100%) rename {bash => shell}/alias/ps.sh (100%) rename {bash => shell}/alias/pwgen.sh (100%) rename {bash => shell}/alias/rsync.sh (100%) rename {bash => shell}/alias/tar.sh (100%) rename {bash => shell}/alias/tree.sh (100%) rename {bash => shell}/apt.sh (100%) rename {bash => shell}/bash/completion.sh (100%) rename {bash => shell}/bash/history.sh (100%) rename {bash => shell}/bash/prompt.sh (100%) rename {bash => shell}/btrfs.sh (100%) rename {bash => shell}/debian.sh (100%) rename {bash => shell}/fs.sh (100%) rename {bash => shell}/gpg.sh (100%) rename {bash => shell}/gsettings.sh (100%) rename {bash => shell}/log.sh (100%) rename {bash => shell}/main.sh (100%) rename {bash => shell}/mount-lxc.sh (100%) rename {bash => shell}/mount.sh (100%) rename {bash => shell}/proxy.sh (100%) rename {bash => shell}/rescue/common.sh (100%) rename {bash => shell}/rescue/hetzner.sh (100%) rename {bash => shell}/rescue/ovh.sh (100%) rename {bash => shell}/util.sh (100%) diff --git a/bash/.shellcheckrc b/shell/.shellcheckrc similarity index 100% rename from bash/.shellcheckrc rename to shell/.shellcheckrc diff --git a/bash/alias/apt.sh b/shell/alias/apt.sh similarity index 100% rename from bash/alias/apt.sh rename to shell/alias/apt.sh diff --git a/bash/alias/bash.sh b/shell/alias/bash.sh similarity index 100% rename from bash/alias/bash.sh rename to shell/alias/bash.sh diff --git a/bash/alias/batcat.sh b/shell/alias/batcat.sh similarity index 100% rename from bash/alias/batcat.sh rename to shell/alias/batcat.sh diff --git a/bash/alias/btrfs.sh b/shell/alias/btrfs.sh similarity index 100% rename from bash/alias/btrfs.sh rename to shell/alias/btrfs.sh diff --git a/bash/alias/byobu.sh b/shell/alias/byobu.sh similarity index 100% rename from bash/alias/byobu.sh rename to shell/alias/byobu.sh diff --git a/bash/alias/chmod.sh b/shell/alias/chmod.sh similarity index 100% rename from bash/alias/chmod.sh rename to shell/alias/chmod.sh diff --git a/bash/alias/chown.sh b/shell/alias/chown.sh similarity index 100% rename from bash/alias/chown.sh rename to shell/alias/chown.sh diff --git a/bash/alias/clear.sh b/shell/alias/clear.sh similarity index 100% rename from bash/alias/clear.sh rename to shell/alias/clear.sh diff --git a/bash/alias/cp.sh b/shell/alias/cp.sh similarity index 100% rename from bash/alias/cp.sh rename to shell/alias/cp.sh diff --git a/bash/alias/emacs.sh b/shell/alias/emacs.sh similarity index 100% rename from bash/alias/emacs.sh rename to shell/alias/emacs.sh diff --git a/bash/alias/evince.sh b/shell/alias/evince.sh similarity index 100% rename from bash/alias/evince.sh rename to shell/alias/evince.sh diff --git a/bash/alias/git.sh b/shell/alias/git.sh similarity index 100% rename from bash/alias/git.sh rename to shell/alias/git.sh diff --git a/bash/alias/gpg.sh b/shell/alias/gpg.sh similarity index 100% rename from bash/alias/gpg.sh rename to shell/alias/gpg.sh diff --git a/bash/alias/grep.sh b/shell/alias/grep.sh similarity index 100% rename from bash/alias/grep.sh rename to shell/alias/grep.sh diff --git a/bash/alias/kill.sh b/shell/alias/kill.sh similarity index 100% rename from bash/alias/kill.sh rename to shell/alias/kill.sh diff --git a/bash/alias/killall.sh b/shell/alias/killall.sh similarity index 100% rename from bash/alias/killall.sh rename to shell/alias/killall.sh diff --git a/bash/alias/ls.sh b/shell/alias/ls.sh similarity index 100% rename from bash/alias/ls.sh rename to shell/alias/ls.sh diff --git a/bash/alias/lsblk.sh b/shell/alias/lsblk.sh similarity index 100% rename from bash/alias/lsblk.sh rename to shell/alias/lsblk.sh diff --git a/bash/alias/micro.sh b/shell/alias/micro.sh similarity index 100% rename from bash/alias/micro.sh rename to shell/alias/micro.sh diff --git a/bash/alias/mkdir.sh b/shell/alias/mkdir.sh similarity index 100% rename from bash/alias/mkdir.sh rename to shell/alias/mkdir.sh diff --git a/bash/alias/mount.sh b/shell/alias/mount.sh similarity index 100% rename from bash/alias/mount.sh rename to shell/alias/mount.sh diff --git a/bash/alias/mv.sh b/shell/alias/mv.sh similarity index 100% rename from bash/alias/mv.sh rename to shell/alias/mv.sh diff --git a/bash/alias/nano.sh b/shell/alias/nano.sh similarity index 100% rename from bash/alias/nano.sh rename to shell/alias/nano.sh diff --git a/bash/alias/newsboat.sh b/shell/alias/newsboat.sh similarity index 100% rename from bash/alias/newsboat.sh rename to shell/alias/newsboat.sh diff --git a/bash/alias/otpclient-cli.sh b/shell/alias/otpclient-cli.sh similarity index 100% rename from bash/alias/otpclient-cli.sh rename to shell/alias/otpclient-cli.sh diff --git a/bash/alias/pass.sh b/shell/alias/pass.sh similarity index 100% rename from bash/alias/pass.sh rename to shell/alias/pass.sh diff --git a/bash/alias/ps.sh b/shell/alias/ps.sh similarity index 100% rename from bash/alias/ps.sh rename to shell/alias/ps.sh diff --git a/bash/alias/pwgen.sh b/shell/alias/pwgen.sh similarity index 100% rename from bash/alias/pwgen.sh rename to shell/alias/pwgen.sh diff --git a/bash/alias/rsync.sh b/shell/alias/rsync.sh similarity index 100% rename from bash/alias/rsync.sh rename to shell/alias/rsync.sh diff --git a/bash/alias/tar.sh b/shell/alias/tar.sh similarity index 100% rename from bash/alias/tar.sh rename to shell/alias/tar.sh diff --git a/bash/alias/tree.sh b/shell/alias/tree.sh similarity index 100% rename from bash/alias/tree.sh rename to shell/alias/tree.sh diff --git a/bash/apt.sh b/shell/apt.sh similarity index 100% rename from bash/apt.sh rename to shell/apt.sh diff --git a/bash/bash/completion.sh b/shell/bash/completion.sh similarity index 100% rename from bash/bash/completion.sh rename to shell/bash/completion.sh diff --git a/bash/bash/history.sh b/shell/bash/history.sh similarity index 100% rename from bash/bash/history.sh rename to shell/bash/history.sh diff --git a/bash/bash/prompt.sh b/shell/bash/prompt.sh similarity index 100% rename from bash/bash/prompt.sh rename to shell/bash/prompt.sh diff --git a/bash/btrfs.sh b/shell/btrfs.sh similarity index 100% rename from bash/btrfs.sh rename to shell/btrfs.sh diff --git a/bash/debian.sh b/shell/debian.sh similarity index 100% rename from bash/debian.sh rename to shell/debian.sh diff --git a/bash/fs.sh b/shell/fs.sh similarity index 100% rename from bash/fs.sh rename to shell/fs.sh diff --git a/bash/gpg.sh b/shell/gpg.sh similarity index 100% rename from bash/gpg.sh rename to shell/gpg.sh diff --git a/bash/gsettings.sh b/shell/gsettings.sh similarity index 100% rename from bash/gsettings.sh rename to shell/gsettings.sh diff --git a/bash/log.sh b/shell/log.sh similarity index 100% rename from bash/log.sh rename to shell/log.sh diff --git a/bash/main.sh b/shell/main.sh similarity index 100% rename from bash/main.sh rename to shell/main.sh diff --git a/bash/mount-lxc.sh b/shell/mount-lxc.sh similarity index 100% rename from bash/mount-lxc.sh rename to shell/mount-lxc.sh diff --git a/bash/mount.sh b/shell/mount.sh similarity index 100% rename from bash/mount.sh rename to shell/mount.sh diff --git a/bash/proxy.sh b/shell/proxy.sh similarity index 100% rename from bash/proxy.sh rename to shell/proxy.sh diff --git a/bash/rescue/common.sh b/shell/rescue/common.sh similarity index 100% rename from bash/rescue/common.sh rename to shell/rescue/common.sh diff --git a/bash/rescue/hetzner.sh b/shell/rescue/hetzner.sh similarity index 100% rename from bash/rescue/hetzner.sh rename to shell/rescue/hetzner.sh diff --git a/bash/rescue/ovh.sh b/shell/rescue/ovh.sh similarity index 100% rename from bash/rescue/ovh.sh rename to shell/rescue/ovh.sh diff --git a/bash/util.sh b/shell/util.sh similarity index 100% rename from bash/util.sh rename to shell/util.sh From 52e7cf8f9cb2efce6519a0e5a5433149c7b10616 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 16:43:48 +0100 Subject: [PATCH 345/702] wip/default --- shell/main.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index ff56a3c..f39c92b 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,3 +1,5 @@ +[ "${ENV}" ] || export ENV="/etc/shell/main.sh" + main_env_root() { dirname "${ENV}" } @@ -40,5 +42,4 @@ main_import_modules() { fi } -# import modules main_import_modules "${ENV}" From b73663cf4bbe7ddd42de0e869c35b069dbcf7271 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 16:58:16 +0100 Subject: [PATCH 346/702] wip/bash --- shell/{bash/prompt.sh => bash.sh} | 10 ++++++++++ shell/bash/completion.sh | 5 ----- shell/bash/history.sh | 5 ----- 3 files changed, 10 insertions(+), 10 deletions(-) rename shell/{bash/prompt.sh => bash.sh} (81%) delete mode 100644 shell/bash/completion.sh delete mode 100644 shell/bash/history.sh diff --git a/shell/bash/prompt.sh b/shell/bash.sh similarity index 81% rename from shell/bash/prompt.sh rename to shell/bash.sh index 5ba1159..7b0f3c7 100644 --- a/shell/bash/prompt.sh +++ b/shell/bash.sh @@ -1,3 +1,13 @@ +HISTCONTROL="ignorespace" + +HISTSIZE=-1 + +HISTTIMEFORMAT="%Y%m%d %H%M%S " +file="/usr/share/bash-completion/bash_completion" + +if [ -f "${file}" ]; then + . "${file}" +fi ps1() { local date host local code="${1}" diff --git a/shell/bash/completion.sh b/shell/bash/completion.sh deleted file mode 100644 index 21e8a21..0000000 --- a/shell/bash/completion.sh +++ /dev/null @@ -1,5 +0,0 @@ -file="/usr/share/bash-completion/bash_completion" - -if [ -f "${file}" ]; then - . "${file}" -fi diff --git a/shell/bash/history.sh b/shell/bash/history.sh deleted file mode 100644 index 59234ad..0000000 --- a/shell/bash/history.sh +++ /dev/null @@ -1,5 +0,0 @@ -HISTCONTROL="ignorespace" - -HISTSIZE=-1 - -HISTTIMEFORMAT="%Y%m%d %H%M%S " From 1486ff4246e30be8312bf7338d5bb1fb7ccaff9d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 17:06:29 +0100 Subject: [PATCH 347/702] wip/bash --- shell/bash.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/shell/bash.sh b/shell/bash.sh index 7b0f3c7..9e2b27e 100644 --- a/shell/bash.sh +++ b/shell/bash.sh @@ -1,13 +1,23 @@ -HISTCONTROL="ignorespace" +[ "$(cat /proc/$$/comm)" = "bash" ] || return -HISTSIZE=-1 +# completion -HISTTIMEFORMAT="%Y%m%d %H%M%S " file="/usr/share/bash-completion/bash_completion" if [ -f "${file}" ]; then . "${file}" fi + +# history + +HISTCONTROL="ignorespace" + +HISTSIZE=-1 + +HISTTIMEFORMAT="%Y%m%d %H%M%S " + +# prompt + ps1() { local date host local code="${1}" From 4f6e6e7ba20bdb7189012ad82ad4e152e080f597 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 17:07:19 +0100 Subject: [PATCH 348/702] wip/hetzner --- shell/rescue/hetzner.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index 0417230..d5ec527 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -1,3 +1,5 @@ +[ "$(cat /proc/$$/comm)" = "bash" ] || return + rescue_wipe_0_init_hetzner_8_8() { local device set \ From ba5d7403622fed72327fe11848922422424d7522 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 17:17:57 +0100 Subject: [PATCH 349/702] wip/user --- shell/main.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/main.sh b/shell/main.sh index f39c92b..ea2f2e1 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -43,3 +43,4 @@ main_import_modules() { } main_import_modules "${ENV}" +main_import_modules ~/shell/main.sh From 6ce158712d909143fbed0b1e3417efa42967cfd4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:02:22 +0100 Subject: [PATCH 350/702] wip/path --- shell/main.sh | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index ea2f2e1..de250bc 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -10,37 +10,44 @@ main_link_bashrc() { ln --symbolic "${MAIN_USERS_FILE}" "${file}" } -# import modules -main_import_modules() { - local file="${1}" - if [ -f "${file}" ]; then - local count ifs module modules path root - path="$(realpath --canonicalize-existing "${file}")" - root="$(dirname "${path}")" - modules="$(find "${root}" -type "f" -name "*.sh" -printf "%P +main_import_directory() { + local path="${1}" + if [ -d "${path}" ]; then + local count ifs module modules + modules="$(find "${path}" -type "f" -name "*.sh" -printf "%P " | sort)" ifs="${IFS}" IFS=" " count=0 echo - echo ". ${root}" + echo ". ${path}" for module in ${modules}; do count=$((count + 1)) printf "%02d" "${count}" echo " ${module%.sh}" - module="${root}/${module}" - if [ "${module}" != "${path}" ]; then + module="${path}/${module}" + if [ "${module}" != "${ENV}" ]; then . "${module}" fi done IFS="${ifs}" - return 0 else - log_fatal "No file: ${file}" + echo "Not a directory: ${path}" return 1 fi } -main_import_modules "${ENV}" -main_import_modules ~/shell/main.sh +main_import_file() { + local path="${1}" + if [ -f "${path}" ]; then + main_import_directory "$(dirname "${path}")" + else + echo "Not a file: ${path}" + return 1 + fi +} + +main_import_file "${ENV}" + +main_import_directory ~/shell From d7bf240ba0e4bf3d8472820911024baef0d4e6bd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:06:14 +0100 Subject: [PATCH 351/702] main_source_ --- shell/main.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index de250bc..63e00f6 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -10,7 +10,7 @@ main_link_bashrc() { ln --symbolic "${MAIN_USERS_FILE}" "${file}" } -main_import_directory() { +main_source_directory() { local path="${1}" if [ -d "${path}" ]; then local count ifs module modules @@ -38,7 +38,7 @@ main_import_directory() { fi } -main_import_file() { +main_source_file() { local path="${1}" if [ -f "${path}" ]; then main_import_directory "$(dirname "${path}")" @@ -48,6 +48,6 @@ main_import_file() { fi } -main_import_file "${ENV}" +main_source_file "${ENV}" -main_import_directory ~/shell +main_source_directory ~/shell From 8c5b43a4e8e20247e1d6e73a6194284d40f94621 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:10:40 +0100 Subject: [PATCH 352/702] args --- shell/main.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index 63e00f6..afd1d56 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -14,7 +14,10 @@ main_source_directory() { local path="${1}" if [ -d "${path}" ]; then local count ifs module modules - modules="$(find "${path}" -type "f" -name "*.sh" -printf "%P + modules="$(find "${path}" \ + -type "f" \ + -name "*.sh" \ + -printf "%P " | sort)" ifs="${IFS}" IFS=" From 9b5d0de8407f56914b12563f8edd95778a6a4ca7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:11:16 +0100 Subject: [PATCH 353/702] fix --- shell/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index afd1d56..a286723 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -44,7 +44,7 @@ main_source_directory() { main_source_file() { local path="${1}" if [ -f "${path}" ]; then - main_import_directory "$(dirname "${path}")" + main_source_directory "$(dirname "${path}")" else echo "Not a file: ${path}" return 1 From 1a05b48cf5de16b2b8419bcacea6d7a340a52da9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:20:55 +0100 Subject: [PATCH 354/702] =?UTF-8?q?=E2=88=92apt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/apt.sh | 40 ---------------------------------------- shell/debian.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) delete mode 100644 shell/apt.sh diff --git a/shell/apt.sh b/shell/apt.sh deleted file mode 100644 index a0f7353..0000000 --- a/shell/apt.sh +++ /dev/null @@ -1,40 +0,0 @@ -apt_clean() { - apt-get \ - clean -} - -apt_install_backports() { - apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" -} - -apt_install_release() { - apt_install_target "${DEBIAN_CODENAME}" "${@}" -} - -apt_install_target() { - local target="${1}" - shift - local package - for package in "${@}"; do - log_info - log_info "${package} ← ${target}" - apt-get \ - install \ - --assume-yes \ - --target-release "${target}" \ - "${package}" - apt_clean - done -} - -apt_update() { - apt-get \ - update -} - -apt_upgrade() { - apt-get \ - upgrade \ - --assume-yes - apt_clean -} diff --git a/shell/debian.sh b/shell/debian.sh index ffce0da..4ce02de 100644 --- a/shell/debian.sh +++ b/shell/debian.sh @@ -3,6 +3,47 @@ DEBIAN_CODENAME="$( cut --delimiter "=" --fields "2" )" +apt_clean() { + apt-get \ + clean +} + +apt_install_backports() { + apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" +} + +apt_install_release() { + apt_install_target "${DEBIAN_CODENAME}" "${@}" +} + +apt_install_target() { + local target="${1}" + shift + local package + for package in "${@}"; do + log_info + log_info "${package} ← ${target}" + apt-get \ + install \ + --assume-yes \ + --target-release "${target}" \ + "${package}" + apt_clean + done +} + +apt_update() { + apt-get \ + update +} + +apt_upgrade() { + apt-get \ + upgrade \ + --assume-yes + apt_clean +} + debian_disable_frontend() { export DEBIAN_FRONTEND="noninteractive" } From 1d86226365715379255715bd984e90f446aa6c4f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:23:33 +0100 Subject: [PATCH 355/702] apt_sources_write --- shell/debian.sh | 13 +++++++++++++ shell/rescue/common.sh | 11 +---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/shell/debian.sh b/shell/debian.sh index 4ce02de..e4085df 100644 --- a/shell/debian.sh +++ b/shell/debian.sh @@ -32,6 +32,19 @@ apt_install_target() { done } +apt_sources_write() { + printf "%s" "\ +deb https://deb.debian.org/debian \ +${DEBIAN_CODENAME} main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free +deb https://deb.debian.org/debian \ +${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free +deb https://deb.debian.org/debian-security \ +${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free +" >"/etc/apt/sources.list" +} + apt_update() { apt-get \ update diff --git a/shell/rescue/common.sh b/shell/rescue/common.sh index 3671d15..306f7fa 100644 --- a/shell/rescue/common.sh +++ b/shell/rescue/common.sh @@ -13,16 +13,7 @@ Dir::Etc::SourceParts \"\"; Dpkg::Progress True; " >"/etc/apt/apt.conf.d/apt.conf" # apt / sources - printf "%s" "\ -deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME} main non-free-firmware contrib non-free -deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free -deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free -deb https://deb.debian.org/debian-security \ -${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free -" >"/etc/apt/sources.list" + apt_sources_write # bash / rc main_link_bashrc mv .bashrc .bashrc.old From 5ff98571f938315ca665b923fc363fe234421fd3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:24:48 +0100 Subject: [PATCH 356/702] apt_conf_write --- shell/debian.sh | 14 ++++++++++++++ shell/rescue/common.sh | 12 +----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/shell/debian.sh b/shell/debian.sh index e4085df..f806ba6 100644 --- a/shell/debian.sh +++ b/shell/debian.sh @@ -8,6 +8,20 @@ apt_clean() { clean } +apt_conf_write() { + printf "\ +Acquire::AllowInsecureRepositories False; +Acquire::AllowWeakRepositories False; +Acquire::AllowDowngradeToInsecureRepositories False; +Acquire::Check-Valid-Until True; +APT::Install-Recommends False; +APT::Install-Suggests False; +APT::Get::Show-Versions True; +Dir::Etc::SourceParts \"\"; +Dpkg::Progress True; +" >"/etc/apt/apt.conf.d/apt.conf" +} + apt_install_backports() { apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" } diff --git a/shell/rescue/common.sh b/shell/rescue/common.sh index 306f7fa..49a9305 100644 --- a/shell/rescue/common.sh +++ b/shell/rescue/common.sh @@ -1,17 +1,7 @@ rescue_configure() { local hostname="${1}" # apt / conf - printf "\ -Acquire::AllowInsecureRepositories False; -Acquire::AllowWeakRepositories False; -Acquire::AllowDowngradeToInsecureRepositories False; -Acquire::Check-Valid-Until True; -APT::Install-Recommends False; -APT::Install-Suggests False; -APT::Get::Show-Versions True; -Dir::Etc::SourceParts \"\"; -Dpkg::Progress True; -" >"/etc/apt/apt.conf.d/apt.conf" + apt_conf_write # apt / sources apt_sources_write # bash / rc From bc7b4962f63bbbd55edfcbed8cc9abf5916fe1de Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:29:10 +0100 Subject: [PATCH 357/702] -n --- shell/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index a286723..7925a6f 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,4 +1,4 @@ -[ "${ENV}" ] || export ENV="/etc/shell/main.sh" +[ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" main_env_root() { dirname "${ENV}" From 4d888d97843583127abea05ad9fdfa464d52b92d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 15 Nov 2024 19:38:54 +0100 Subject: [PATCH 358/702] =?UTF-8?q?=E2=88=92main=5Fenv=5Froot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/main.sh | 4 ---- shell/rescue/common.sh | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index 7925a6f..c8d2607 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,9 +1,5 @@ [ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" -main_env_root() { - dirname "${ENV}" -} - main_link_bashrc() { local file="/etc/bash.bashrc" rm --force "${file}" diff --git a/shell/rescue/common.sh b/shell/rescue/common.sh index 49a9305..f33c5aa 100644 --- a/shell/rescue/common.sh +++ b/shell/rescue/common.sh @@ -66,11 +66,11 @@ rescue_upload() { "${user_host}" # upload root rsync --delete --recursive \ - "$(main_env_root)" "${user_host}:/etc" + "$(dirname "${ENV}")" "${user_host}:/etc" # call setup # TODO variable - ssh "${user_host}" -- "\ -. \"/etc/bash/main.sh\" ; rescue_configure \"${hostname}\"" + ssh "${user_host}" -- \ + ". \"${ENV}\" ; rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys From e27dcc2eb3306a59e13a97db5e763f3c6734bafb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 01:23:33 +0100 Subject: [PATCH 359/702] readme --- readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.md b/readme.md index 4021d7f..9a0b6d3 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,6 @@ ## ToDo -* [ ] import modules recursively * [ ] log * [ ] ovh * [ ] clean apt cache after each install/upgrade step From 4cc5b8a502288415fe593eb8b1ad77fb76e5f0d7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 01:24:20 +0100 Subject: [PATCH 360/702] wip/shell --- shell/{bash.sh => shell.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename shell/{bash.sh => shell.sh} (100%) diff --git a/shell/bash.sh b/shell/shell.sh similarity index 100% rename from shell/bash.sh rename to shell/shell.sh From 62a33a5583853413e151e65783a1f0c086f0537a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 01:41:42 +0100 Subject: [PATCH 361/702] wip/fixes --- shell/shell.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 9e2b27e..82a1ed2 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,29 +1,30 @@ -[ "$(cat /proc/$$/comm)" = "bash" ] || return +SH="$(cat /proc/$$/comm)" -# completion - -file="/usr/share/bash-completion/bash_completion" - -if [ -f "${file}" ]; then - . "${file}" -fi - -# history - -HISTCONTROL="ignorespace" - -HISTSIZE=-1 - -HISTTIMEFORMAT="%Y%m%d %H%M%S " +case "${SH}" in +"bash") + # completion + file="/usr/share/bash-completion/bash_completion" + if [ -f "${file}" ]; then + . "${file}" + fi + # history + HISTCONTROL="ignorespace" + HISTSIZE=-1 + HISTTIMEFORMAT="%Y%m%d %H%M%S " + ;; +*) + ;; +esac # prompt ps1() { - local date host + local date host id local code="${1}" date="$(date +%H:%M:%S)" local git host="$(hostname)" + id="$(id --user)" local path="${PWD}" local user="${USER}" local view="└ " @@ -33,7 +34,7 @@ ps1() { view="${view}\e[0;32m" fi view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" - if [ "$(type -t __git_ps1)" == "function" ]; then + if [ "$(type -t __git_ps1)" = "function" ]; then git="$(__git_ps1)" if [ -n "${git}" ]; then view="${view} –\e[0;35m${git}\e[0m" @@ -41,7 +42,7 @@ ps1() { fi view="${view}\n\e[0;36m${path}\e[0m" view="${view}\n┌ " - if [ ${EUID} -eq 0 ]; then + if [ "${id}" -eq 0 ]; then view="${view}\e[0;31m" else view="${view}\e[0;32m" From 347951cbdf3362ddb85849b2a9c1fa3ef4a21d67 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 01:54:13 +0100 Subject: [PATCH 362/702] wip/shell_color --- shell/shell.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/shell/shell.sh b/shell/shell.sh index 82a1ed2..e164562 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,5 +1,16 @@ SH="$(cat /proc/$$/comm)" +shell_color() { + local code="${1}" + if [ -n "${code}" ]; then + case "${SH}" in + "bash") printf "\e[0;" ;; + *) printf "\033[" ;; + esac + printf "%s" "${code}m" + fi +} + case "${SH}" in "bash") # completion From ba3b90366b7ca3ad7aab79757430657b9170ecc7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:19:41 +0100 Subject: [PATCH 363/702] wip/colors --- shell/shell.sh | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index e164562..7fde50e 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -2,14 +2,30 @@ SH="$(cat /proc/$$/comm)" shell_color() { local code="${1}" - if [ -n "${code}" ]; then - case "${SH}" in - "bash") printf "\e[0;" ;; - *) printf "\033[" ;; - esac - printf "%s" "${code}m" - fi + case "${SH}" in + "bash") + printf "\e[0" + if [ -n "${code}" ]; then + printf "%s" ";${code}" + fi + ;; + *) + printf "\033[" + if [ -n "${code}" ]; then + printf "%s" "${code}" + else + printf "0" + fi + ;; + esac + printf "m" } +SH_DEFAULT="$(shell_color)" +SH_GREEN="$(shell_color 31)" +SH_RED="$(shell_color 32)" +SH_BROWN="$(shell_color 33)" +SH_MAGENTA="$(shell_color 35)" +SH_CYAN="$(shell_color 36)" case "${SH}" in "bash") @@ -40,25 +56,25 @@ ps1() { local user="${USER}" local view="└ " if [ "${code}" -ne 0 ]; then - view="${view}\e[0;31m" + view="${view}${SH_GREEN}" else - view="${view}\e[0;32m" + view="${view}${SH_RED}" fi - view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" + view="${view}${code}${SH_DEFAULT} @ ${SH_BROWN}${date}${SH_DEFAULT}" if [ "$(type -t __git_ps1)" = "function" ]; then git="$(__git_ps1)" if [ -n "${git}" ]; then - view="${view} –\e[0;35m${git}\e[0m" + view="${view} –${SH_MAGENTA}${git}${SH_DEFAULT}" fi fi - view="${view}\n\e[0;36m${path}\e[0m" + view="${view}\n${SH_CYAN}${path}${SH_DEFAULT}" view="${view}\n┌ " if [ "${id}" -eq 0 ]; then - view="${view}\e[0;31m" + view="${view}${SH_GREEN}" else - view="${view}\e[0;32m" + view="${view}${SH_RED}" fi - view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m" + view="${view}${user}${SH_DEFAULT} @ ${SH_BROWN}${host}${SH_DEFAULT}" echo -e "${view}\n${PS2}" } From ce576b7a9957f73116de43f983083028f7fa638f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:27:43 +0100 Subject: [PATCH 364/702] splits --- shell/shell.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 7fde50e..b205caf 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -55,26 +55,41 @@ ps1() { local path="${PWD}" local user="${USER}" local view="└ " + # code if [ "${code}" -ne 0 ]; then view="${view}${SH_GREEN}" else view="${view}${SH_RED}" fi - view="${view}${code}${SH_DEFAULT} @ ${SH_BROWN}${date}${SH_DEFAULT}" + view="${view}${code}" + # date + view="${view}${SH_DEFAULT} @ " + view="${view}${SH_BROWN}${date}" + # git if [ "$(type -t __git_ps1)" = "function" ]; then git="$(__git_ps1)" if [ -n "${git}" ]; then - view="${view} –${SH_MAGENTA}${git}${SH_DEFAULT}" + view="${view}${SH_DEFAULT} –${SH_MAGENTA}${git}" fi fi - view="${view}\n${SH_CYAN}${path}${SH_DEFAULT}" - view="${view}\n┌ " + # new + view="${view}\n" + # path + view="${view}${SH_CYAN}${path}" + # new + view="${view}\n" + # frame + view="${view}┌ " + # user if [ "${id}" -eq 0 ]; then view="${view}${SH_GREEN}" else view="${view}${SH_RED}" fi - view="${view}${user}${SH_DEFAULT} @ ${SH_BROWN}${host}${SH_DEFAULT}" + view="${view}${user}" + # host + view="${view}${SH_DEFAULT} @ " + view="${view}${SH_BROWN}${host}${SH_DEFAULT}" echo -e "${view}\n${PS2}" } From 60adeb9f4096cae45d210412af1a5f7c96e8eff3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:32:58 +0100 Subject: [PATCH 365/702] fixes --- shell/shell.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index b205caf..d5ed4e2 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,3 +1,6 @@ +PS1="\$(ps1 \${?})" +PS2="\ +├ " SH="$(cat /proc/$$/comm)" shell_color() { @@ -20,12 +23,12 @@ shell_color() { esac printf "m" } +SH_BROWN="$(shell_color 33)" +SH_CYAN="$(shell_color 36)" SH_DEFAULT="$(shell_color)" SH_GREEN="$(shell_color 31)" -SH_RED="$(shell_color 32)" -SH_BROWN="$(shell_color 33)" SH_MAGENTA="$(shell_color 35)" -SH_CYAN="$(shell_color 36)" +SH_RED="$(shell_color 32)" case "${SH}" in "bash") @@ -79,7 +82,7 @@ ps1() { # new view="${view}\n" # frame - view="${view}┌ " + view="${view}${SH_DEFAULT}┌ " # user if [ "${id}" -eq 0 ]; then view="${view}${SH_GREEN}" @@ -90,10 +93,5 @@ ps1() { # host view="${view}${SH_DEFAULT} @ " view="${view}${SH_BROWN}${host}${SH_DEFAULT}" - echo -e "${view}\n${PS2}" + printf "%s" "${view}\n${PS2}" } - -PS1="\$(ps1 \${?})" - -PS2="\ -├ " From 62ae8d73cc3d89fdcea21d68c03de4aa878e6e07 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:43:06 +0100 Subject: [PATCH 366/702] wip/works --- shell/shell.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index d5ed4e2..ec85222 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -7,13 +7,13 @@ shell_color() { local code="${1}" case "${SH}" in "bash") - printf "\e[0" + printf "\\e[0" if [ -n "${code}" ]; then printf "%s" ";${code}" fi ;; *) - printf "\033[" + printf "\\033[" if [ -n "${code}" ]; then printf "%s" "${code}" else @@ -76,11 +76,13 @@ ps1() { fi fi # new - view="${view}\n" + view="${view} +" # path view="${view}${SH_CYAN}${path}" # new - view="${view}\n" + view="${view} +" # frame view="${view}${SH_DEFAULT}┌ " # user @@ -92,6 +94,12 @@ ps1() { view="${view}${user}" # host view="${view}${SH_DEFAULT} @ " - view="${view}${SH_BROWN}${host}${SH_DEFAULT}" - printf "%s" "${view}\n${PS2}" + view="${view}${SH_BROWN}${host}" + # new + view="${view} +" + # prompt + view="${view}${SH_DEFAULT}${PS2}" + # print + printf "%s" "${view}" } From e8dfd1b98a3d73c17b420703564611718217b6b0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:44:04 +0100 Subject: [PATCH 367/702] useless --- shell/shell.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index ec85222..52a00f3 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -7,13 +7,13 @@ shell_color() { local code="${1}" case "${SH}" in "bash") - printf "\\e[0" + printf "\e[0" if [ -n "${code}" ]; then printf "%s" ";${code}" fi ;; *) - printf "\\033[" + printf "\033[" if [ -n "${code}" ]; then printf "%s" "${code}" else From 6eaab0b75f6575f5309083d43d4c25de1089b79c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:49:14 +0100 Subject: [PATCH 368/702] fixes --- shell/shell.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 52a00f3..b984e6c 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -49,13 +49,14 @@ esac # prompt ps1() { - local date host id + local date host id type local code="${1}" date="$(date +%H:%M:%S)" local git host="$(hostname)" id="$(id --user)" local path="${PWD}" + type="$(type -t __git_ps1)" local user="${USER}" local view="└ " # code @@ -69,7 +70,7 @@ ps1() { view="${view}${SH_DEFAULT} @ " view="${view}${SH_BROWN}${date}" # git - if [ "$(type -t __git_ps1)" = "function" ]; then + if [ "${type}" = "function" ]; then git="$(__git_ps1)" if [ -n "${git}" ]; then view="${view}${SH_DEFAULT} –${SH_MAGENTA}${git}" From f3666204183eca2c3ba172fd21d49b437d4276ef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 02:55:41 +0100 Subject: [PATCH 369/702] =?UTF-8?q?=E2=88=92type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/shell.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index b984e6c..5e100fa 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -49,14 +49,13 @@ esac # prompt ps1() { - local date host id type + local date host id local code="${1}" date="$(date +%H:%M:%S)" local git host="$(hostname)" id="$(id --user)" local path="${PWD}" - type="$(type -t __git_ps1)" local user="${USER}" local view="└ " # code @@ -70,7 +69,7 @@ ps1() { view="${view}${SH_DEFAULT} @ " view="${view}${SH_BROWN}${date}" # git - if [ "${type}" = "function" ]; then + if command -v "__git_ps1" >"/dev/null"; then git="$(__git_ps1)" if [ -n "${git}" ]; then view="${view}${SH_DEFAULT} –${SH_MAGENTA}${git}" From 5139c4367ea1fd0f6fc06849435650289c9551b6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 03:21:30 +0100 Subject: [PATCH 370/702] fixes --- shell/main.sh | 6 ------ shell/shell.sh | 48 +++++++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index c8d2607..0ccf86b 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,11 +1,5 @@ [ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" -main_link_bashrc() { - local file="/etc/bash.bashrc" - rm --force "${file}" - ln --symbolic "${MAIN_USERS_FILE}" "${file}" -} - main_source_directory() { local path="${1}" if [ -d "${path}" ]; then diff --git a/shell/shell.sh b/shell/shell.sh index 5e100fa..d8df42b 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,4 +1,4 @@ -PS1="\$(ps1 \${?})" +PS1="\$(shell_prompt \${?})" PS2="\ ├ " SH="$(cat /proc/$$/comm)" @@ -30,25 +30,26 @@ SH_GREEN="$(shell_color 31)" SH_MAGENTA="$(shell_color 35)" SH_RED="$(shell_color 32)" -case "${SH}" in -"bash") - # completion - file="/usr/share/bash-completion/bash_completion" - if [ -f "${file}" ]; then - . "${file}" - fi - # history - HISTCONTROL="ignorespace" - HISTSIZE=-1 - HISTTIMEFORMAT="%Y%m%d %H%M%S " - ;; -*) - ;; -esac +shell_configure() { + case "${SH}" in + "bash") + # completion + file="/usr/share/bash-completion/bash_completion" + if [ -f "${file}" ]; then + . "${file}" + fi + # history + HISTCONTROL="ignorespace" + HISTSIZE=-1 + HISTTIMEFORMAT="%Y%m%d %H%M%S " + ;; + *) + ;; + esac +} +shell_configure -# prompt - -ps1() { +shell_prompt() { local date host id local code="${1}" date="$(date +%H:%M:%S)" @@ -103,3 +104,12 @@ ps1() { # print printf "%s" "${view}" } + +shell_setup() { + # shell + echo "export ENV=\"${ENV}\"" >"/etc/profile.d/shell.sh" + # bash + local file="/etc/bash.bashrc" + rm --force --recursive "${file}" + ln --symbolic "${ENV}" "${file}" +} From 964df6e8dc3a471d9e9a33fc255aca62897baae3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 03:23:19 +0100 Subject: [PATCH 371/702] fixes --- shell/shell.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index d8df42b..b50964e 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -34,7 +34,7 @@ shell_configure() { case "${SH}" in "bash") # completion - file="/usr/share/bash-completion/bash_completion" + local file="/usr/share/bash-completion/bash_completion" if [ -f "${file}" ]; then . "${file}" fi @@ -43,8 +43,7 @@ shell_configure() { HISTSIZE=-1 HISTTIMEFORMAT="%Y%m%d %H%M%S " ;; - *) - ;; + *) ;; esac } shell_configure From 2b807632b3fc7688fde01a439499dbb54ab606b8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 03:34:01 +0100 Subject: [PATCH 372/702] directories & files --- shell/mount.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index fe5b273..cb7bb5a 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -1,12 +1,14 @@ mo() { - local directory="${1}" - local file - if [ -n "${directory}" ]; then - directory="$(realpath "${directory}")" - file="${directory}/filesystem.squashfs" + local root="${1}" + local directory file + if [ -n "${root}" ]; then + root="$(realpath "${root}")" + file="${root}/filesystem.squashfs" if mkdir "overlay"; then cd "overlay" - mkdir {lower,upper,work,mount} + for directory in "lower" "upper" "work" "mount"; do + mkdir "${directory}" + done if mount "${file}" "lower"; then mount \ -o lowerdir="lower",upperdir="upper",workdir="work" \ @@ -16,7 +18,8 @@ mo() { cd .. fi else - echo "KO: directory?" + log_fatal "No root" + return 1 fi } @@ -68,11 +71,14 @@ um() { ms() { local directory="${1}" + local file local level="${2}" if [ -n "${directory}" ]; then if mkdir "${directory}"; then [ -n "${level}" ] || level="18" - cp overlay/mount/{vmlinuz,initrd.img} "${directory}" + for file in "vmlinuz" "initrd.img"; do + cp "overlay/mount/${file}" "${directory}" + done mksquashfs \ "overlay/mount" "${directory}/filesystem.squashfs" \ -noappend \ From 36aaa275a7a888a51d269072dabf338a4a6c7f4e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:04:44 +0100 Subject: [PATCH 373/702] mo --- shell/mount.sh | 51 +++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index cb7bb5a..118f8e9 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -1,26 +1,39 @@ mo() { local root="${1}" - local directory file - if [ -n "${root}" ]; then - root="$(realpath "${root}")" - file="${root}/filesystem.squashfs" - if mkdir "overlay"; then - cd "overlay" - for directory in "lower" "upper" "work" "mount"; do - mkdir "${directory}" - done - if mount "${file}" "lower"; then - mount \ - -o lowerdir="lower",upperdir="upper",workdir="work" \ - -t "overlay" \ - "overlay" "mount" - fi - cd .. - fi - else - log_fatal "No root" + if [ -z "${root}" ]; then + log_error "No root" return 1 fi + root="$(realpath "${root}")" + if ! mkdir "overlay"; then + log_error "Unable to make mount directory" + return 2 + fi + { + if ! cd "overlay"; then + log_error "Unable to move into mount directory" + return 3 + fi + local directory + for directory in "lower" "upper" "work" "mount"; do + if ! mkdir --parents "${directory}"; then + log_error "Unable to move into: ${directory}" + return 4 + fi + done + local file="${root}/filesystem.squashfs" + if ! mount "${file}" "lower"; then + log_error "Unable to mount: ${file}" + return 5 + fi + if ! mount \ + -o "lowerdir=lower,upperdir=upper,workdir=work" \ + -t "overlay" \ + "overlay" "mount"; then + log_error "Unable to mount: ${file}" + return 6 + fi + } } uo() { From 58ca9eb86fa35da57eafcbf3e75d2700d569e5bc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:23:54 +0100 Subject: [PATCH 374/702] wip/mount --- shell/mount.sh | 55 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index 118f8e9..ed78546 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -1,52 +1,75 @@ mo() { local root="${1}" if [ -z "${root}" ]; then - log_error "No root" + log_error "No root target directory" return 1 fi root="$(realpath "${root}")" if ! mkdir "overlay"; then - log_error "Unable to make mount directory" + log_error "Unable to make overlay directory" return 2 fi - { + ( if ! cd "overlay"; then - log_error "Unable to move into mount directory" + log_error "Unable to move into overlay directory" return 3 fi local directory for directory in "lower" "upper" "work" "mount"; do if ! mkdir --parents "${directory}"; then - log_error "Unable to move into: ${directory}" + log_error "Unable to make directory: ${directory}" return 4 fi done local file="${root}/filesystem.squashfs" if ! mount "${file}" "lower"; then - log_error "Unable to mount: ${file}" + log_error "Unable to lower mount: ${file}" return 5 fi if ! mount \ -o "lowerdir=lower,upperdir=upper,workdir=work" \ -t "overlay" \ "overlay" "mount"; then - log_error "Unable to mount: ${file}" + log_error "Unable to overlay mount" return 6 fi - } + ) } uo() { - cd "overlay" - if umount "mount"; then - rmdir "mount" - rm --recursive "upper" "work" - if umount "lower"; then - rmdir "lower" + ( + if ! cd "overlay"; then + log_error "Unable to move into overlay directory" + return 1 fi + if ! umount "mount"; then + log_error "Unable to unmount mount directory" + return 2 + fi + if ! rmdir "mount"; then + log_error "Unable to remove mount directory" + return 3 + fi + local directory + for directory in "upper" "work"; do + if ! rm --force --recursive "${directory}"; then + log_error "Unable to remove directory: ${directory}" + return 4 + fi + done + if ! umount "lower"; then + log_error "Unable to unmount lower directory" + return 5 + fi + if ! rmdir "lower"; then + log_error "Unable to remove lower directory" + return 6 + fi + ) + if ! rmdir "overlay"; then + log_error "Unable to remove overlay directory" + return 7 fi - cd .. - rmdir "overlay" } mr() { From 94746ca4977d3f851364ed1009c573b01f71bd10 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:27:07 +0100 Subject: [PATCH 375/702] mr --- shell/mount.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index ed78546..b27b1a2 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -73,9 +73,12 @@ uo() { } mr() { - local f - for f in "dev" "dev/pts" "proc" "sys"; do - mount --bind "/${f}" "overlay/mount/${f}" + local directory + for directory in "dev" "dev/pts" "proc" "sys"; do + if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then + log_error "Unable to bind mount directory: ${directory}" + return 1 + fi done } From dc087a205b2fad63c9868d34e3fad19b0c11ce2a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:28:32 +0100 Subject: [PATCH 376/702] ur --- shell/mount.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index b27b1a2..0211131 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -94,9 +94,12 @@ chroot \ " ur() { - local f - for f in "sys" "proc" "dev/pts" "dev"; do - umount --lazy "overlay/mount/${f}" + local directory + for directory in "sys" "proc" "dev/pts" "dev"; do + if ! umount --lazy "overlay/mount/${directory}"; then + log_error "Unable to bind unmount directory: ${directory}" + return 1 + fi done } From c03750a2f317152979252708f80104e8392efccc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:34:35 +0100 Subject: [PATCH 377/702] cr,cru --- shell/mount.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shell/mount.sh b/shell/mount.sh index 0211131..7e715cf 100644 --- a/shell/mount.sh +++ b/shell/mount.sh @@ -82,16 +82,16 @@ mr() { done } -alias cr="\ -chroot \ -\"overlay/mount\" \ -" +cr() { + chroot \ + "overlay/mount" "${@}" +} -alias cru="\ -chroot \ ---userspec \"1000:1000\" \ -\"overlay/mount\" \ -" +cru() { + chroot \ + --userspec "1000:1000" \ + "overlay/mount" "${@}" +} ur() { local directory From 9d4c32e34ae0c609cde354759b67c19e01f9527f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:45:44 +0100 Subject: [PATCH 378/702] . --- shell/alias/bash.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/alias/bash.sh b/shell/alias/bash.sh index aaa10ca..9c9e8e7 100644 --- a/shell/alias/bash.sh +++ b/shell/alias/bash.sh @@ -23,7 +23,7 @@ cd \ # import source file alias src="\ -source \ +. \ " # exit terminal From 1e6a8d5c2a5dd8f47efbbb54ba02a77e37374a66 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 04:46:38 +0100 Subject: [PATCH 379/702] todo/() --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 9a0b6d3..f303f1f 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,7 @@ ## ToDo +* [ ] convert alias to () * [ ] log * [ ] ovh * [ ] clean apt cache after each install/upgrade step From cafe6ab80b9f3ad762e7d5833eb21722715bd16e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:10:31 +0100 Subject: [PATCH 380/702] ${*} --- shell/rescue/hetzner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index d5ec527..05e12d5 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -12,7 +12,7 @@ rescue_wipe_0_init_hetzner_8_8() { passphrase="$(read_passphrase)" # lsblk - echo -n "WIPE" "${@}" "/?\\ OR CANCEL /!\\" + printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r # number=0 From 213f6ae1f15b19e11880429f122ffcb238dd3fc9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:22:55 +0100 Subject: [PATCH 381/702] warn_wipe --- shell/rescue/hetzner.sh | 6 ++---- shell/rescue/ovh.sh | 4 +--- shell/util.sh | 8 ++++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index 05e12d5..b14d5c7 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -10,10 +10,8 @@ rescue_wipe_0_init_hetzner_8_8() { local passphrase # read passphrase passphrase="$(read_passphrase)" - # - lsblk - printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" - read -r + # warn + warn_wipe "${@}" # number=0 for device in "${@}"; do diff --git a/shell/rescue/ovh.sh b/shell/rescue/ovh.sh index ed225d1..b12c50b 100644 --- a/shell/rescue/ovh.sh +++ b/shell/rescue/ovh.sh @@ -4,9 +4,7 @@ rescue_wipe_0_init_ovh_vle2() { # read passphrase passphrase="$(read_passphrase)" # warn - lsblk - printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\" - read -r + warn_wipe "${device}" # parted --script "${device}" \ mktable gpt \ diff --git a/shell/util.sh b/shell/util.sh index 8a345ba..7d333ae 100644 --- a/shell/util.sh +++ b/shell/util.sh @@ -21,3 +21,11 @@ read_secret() { echo "${secret}" unset secret } + +warn_wipe() { + local tmp + lsblk --noempty + printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" + read -r tmp + log_trace "${tmp}" +} From 014ac219ac0ad9ef4a4bce4d01d5205aefe4ffa5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:25:02 +0100 Subject: [PATCH 382/702] list_block_devices --- shell/util.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell/util.sh b/shell/util.sh index 7d333ae..4dcd59a 100644 --- a/shell/util.sh +++ b/shell/util.sh @@ -1,3 +1,9 @@ +list_block_devices() { + lsblk \ + --noempty \ + --output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS" +} + not() { case "${1}" in "false") echo "true" ;; @@ -24,7 +30,7 @@ read_secret() { warn_wipe() { local tmp - lsblk --noempty + list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r tmp log_trace "${tmp}" From 0c6f8d6dd7f49a11208ebed3414eb8fb439785d9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:31:52 +0100 Subject: [PATCH 383/702] members --- shell/rescue/hetzner.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index b14d5c7..48ea37e 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -61,12 +61,12 @@ rescue_wipe_0_init_hetzner_8_8() { fs_wipe "${device}2" "1G" 1 done # - members=() + members="" for device in "${@}"; do - members+=("${device}2") + members="${members} ${device}2" done fs_raid_create \ - "boot" "00000000:00000000:00000000:00000002" "${members[@]}" + "boot" "00000000:00000000:00000000:00000002" ${members} # fs_make_btrfs "/dev/md/boot" "boot" \ "00000000-0000-0000-0000-00000000000b" @@ -85,12 +85,12 @@ rescue_wipe_0_init_hetzner_8_8() { fs_wipe "${device}1" "1G" 1 done # - members=() + members="" for device in "${@}"; do - members+=("${device}1") + members="${members} ${device}1" done fs_raid_create \ - "crypt" "00000000:00000000:00000000:00000001" "${members[@]}" + "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt luks_format "${passphrase}" "/dev/md/crypt" # open From 3522a8a2f414324998c4018d4c92b5cc7ab4ea81 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:33:53 +0100 Subject: [PATCH 384/702] on purpose --- shell/rescue/hetzner.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index 48ea37e..c312fce 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -65,6 +65,7 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}2" done + # shellcheck disable=SC2086 fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # @@ -89,6 +90,7 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}1" done + # shellcheck disable=SC2086 fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt From 9d8772d716aecb8125b183c674a2c56741c2e56e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:34:39 +0100 Subject: [PATCH 385/702] =?UTF-8?q?=E2=88=92exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/rescue/hetzner.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/shell/rescue/hetzner.sh b/shell/rescue/hetzner.sh index c312fce..80d901b 100644 --- a/shell/rescue/hetzner.sh +++ b/shell/rescue/hetzner.sh @@ -1,5 +1,3 @@ -[ "$(cat /proc/$$/comm)" = "bash" ] || return - rescue_wipe_0_init_hetzner_8_8() { local device set \ From e43429a6838a1bd6cb55c3a8a67ec5a7977dbbb0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:53:18 +0100 Subject: [PATCH 386/702] tree --- shell/alias/tree.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/alias/tree.sh b/shell/alias/tree.sh index 2252fc1..dbea341 100644 --- a/shell/alias/tree.sh +++ b/shell/alias/tree.sh @@ -1,8 +1,8 @@ -alias t="\ -tree \ -" +t() { + tree +} -alias ta="\ -tree \ --a \ -" +ta() { + tree \ + -a +} From c7d3d72e62fb3acc337e1ca2ccc3c0f04eb84a52 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 13:55:07 +0100 Subject: [PATCH 387/702] tree/@ --- shell/alias/tree.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/alias/tree.sh b/shell/alias/tree.sh index dbea341..c96738c 100644 --- a/shell/alias/tree.sh +++ b/shell/alias/tree.sh @@ -1,8 +1,10 @@ t() { - tree + tree \ + "${@}" } ta() { tree \ - -a + -a \ + "${@}" } From 895c169599af6f224fc625905d1e341c81063179 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:00:55 +0100 Subject: [PATCH 388/702] batcat --- shell/alias/batcat.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/alias/batcat.sh b/shell/alias/batcat.sh index e62f4ac..352cff1 100644 --- a/shell/alias/batcat.sh +++ b/shell/alias/batcat.sh @@ -1,3 +1,4 @@ -alias bat="\ -batcat \ -" +bat() { + batcat \ + "${@}" +} From 97389ceef759fa3d6499742dcbad9b0a5a0bef85 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:03:13 +0100 Subject: [PATCH 389/702] cmd,cmf --- shell/alias/chmod.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shell/alias/chmod.sh b/shell/alias/chmod.sh index 4df1df3..c523a11 100644 --- a/shell/alias/chmod.sh +++ b/shell/alias/chmod.sh @@ -1,11 +1,13 @@ # change mode as directory -alias cmd="\ -chmod \ -\"755\" \ -" +cmd() { + chmod \ + "755" \ + "${@}" +} # change mode as file -alias cmf="\ -chmod \ -\"644\" \ -" +cmf() { + chmod \ + "644" \ + "${@}" +} From 524ddb8968cf8167166de154e36e811b3b7bb582 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:04:50 +0100 Subject: [PATCH 390/702] cor,cou --- shell/alias/chmod.sh | 4 ++-- shell/alias/chown.sh | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/shell/alias/chmod.sh b/shell/alias/chmod.sh index c523a11..89b8bd7 100644 --- a/shell/alias/chmod.sh +++ b/shell/alias/chmod.sh @@ -1,11 +1,11 @@ -# change mode as directory +# change mode to directory cmd() { chmod \ "755" \ "${@}" } -# change mode as file +# change mode to file cmf() { chmod \ "644" \ diff --git a/shell/alias/chown.sh b/shell/alias/chown.sh index 5a51942..f7bbef9 100644 --- a/shell/alias/chown.sh +++ b/shell/alias/chown.sh @@ -1,11 +1,13 @@ -# change owner as root -alias cor="\ -chown \ -\"0:0\" \ -" +# change owner to root +cor() { + chown \ + "0:0" \ + "${@}" +} -# change owner as user -alias cou="\ -chown \ -\"1000:1000\" \ -" +# change owner to user +cou() { + chown \ + "1000:1000" \ + "${@}" +} From a5a9beff265218b48437e571b10c2a305b68f9f5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:06:00 +0100 Subject: [PATCH 391/702] clear --- shell/alias/clear.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/alias/clear.sh b/shell/alias/clear.sh index afa9bb0..6a69638 100644 --- a/shell/alias/clear.sh +++ b/shell/alias/clear.sh @@ -1,4 +1,5 @@ # clear terminal -alias c="\ -clear \ -" +c() { + clear \ + "${@}" +} From 3c737f19285a86cb5018d26c954f067d948a5ace Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:40:28 +0100 Subject: [PATCH 392/702] =?UTF-8?q?cpi,=C2=B5,mvi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/cp.sh | 9 +++++---- shell/alias/micro.sh | 7 ++++--- shell/alias/mv.sh | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/shell/alias/cp.sh b/shell/alias/cp.sh index 946182f..5db0082 100644 --- a/shell/alias/cp.sh +++ b/shell/alias/cp.sh @@ -1,5 +1,6 @@ # copy interactively -alias cpi="\ -cp \ ---interactive \ -" +cpi() { + cp \ + --interactive \ + "${@}" +} diff --git a/shell/alias/micro.sh b/shell/alias/micro.sh index 05102a2..b0aa4be 100644 --- a/shell/alias/micro.sh +++ b/shell/alias/micro.sh @@ -1,3 +1,4 @@ -alias µ="\ -micro \ -" +µ() { + micro \ + "${@}" +} diff --git a/shell/alias/mv.sh b/shell/alias/mv.sh index dff7f63..89d6efd 100644 --- a/shell/alias/mv.sh +++ b/shell/alias/mv.sh @@ -1,5 +1,6 @@ # move interactively -alias mvi="\ -mv \ ---interactive \ -" +mvi() { + mv \ + --interactive \ + "${@}" +} From e73163d2d3fdc561cde7175d0bab87d63a89c9c0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:41:35 +0100 Subject: [PATCH 393/702] shell --- shell/alias/{bash.sh => shell.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename shell/alias/{bash.sh => shell.sh} (100%) diff --git a/shell/alias/bash.sh b/shell/alias/shell.sh similarity index 100% rename from shell/alias/bash.sh rename to shell/alias/shell.sh From 95f52f32eb1b2b9e05c528b67eb123ffa4d33b17 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:58:58 +0100 Subject: [PATCH 394/702] a,sd,x,..,... --- shell/alias/shell.sh | 49 ++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/shell/alias/shell.sh b/shell/alias/shell.sh index 9c9e8e7..d6aa697 100644 --- a/shell/alias/shell.sh +++ b/shell/alias/shell.sh @@ -1,32 +1,27 @@ -# change current directory to its parent -alias ..="\ -cd \ -.. \ -" - -# change current directory to its parent’s parent -alias ...="\ -cd \ -../.. \ -" - # shorten alias -alias a="\ -alias \ -" +a() { + alias \ + "${@}" +} # swap directory (current ↔ previous) -alias sd="\ -cd \ -- \ -" - -# import source file -alias src="\ -. \ -" +sd() { + cd - || return +} # exit terminal -alias x="\ -exit \ -" +x() { + exit \ + "${@}" +} + +# back + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} From adddd9af3bf1aabd66874bc387a19f762cc76369 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:59:54 +0100 Subject: [PATCH 395/702] =?UTF-8?q?=E2=88=92otpclient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/otpclient-cli.sh | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 shell/alias/otpclient-cli.sh diff --git a/shell/alias/otpclient-cli.sh b/shell/alias/otpclient-cli.sh deleted file mode 100644 index 4fbe9cd..0000000 --- a/shell/alias/otpclient-cli.sh +++ /dev/null @@ -1,12 +0,0 @@ -# list otp accounts -alias otpl="\ -otpclient-cli \ -list \ -" - -# display otp code -alias otps="\ -otpclient-cli \ -show \ --a \ -" From 6df0543e89202206b8f911b172504ba5a406d941 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:02:40 +0100 Subject: [PATCH 396/702] newsboat --- shell/alias/newsboat.sh | 7 ++++--- shell/alias/shell.sh | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/shell/alias/newsboat.sh b/shell/alias/newsboat.sh index 971ad9d..c877906 100644 --- a/shell/alias/newsboat.sh +++ b/shell/alias/newsboat.sh @@ -1,3 +1,4 @@ -alias nb="\ -newsboat \ -" +nb() { + newsboat \ + "${@}" +} diff --git a/shell/alias/shell.sh b/shell/alias/shell.sh index d6aa697..d38c3cb 100644 --- a/shell/alias/shell.sh +++ b/shell/alias/shell.sh @@ -6,7 +6,9 @@ a() { # swap directory (current ↔ previous) sd() { - cd - || return + cd \ + - || + return } # exit terminal From 03450c9ac79e08638149d357d26561de60d70427 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:04:04 +0100 Subject: [PATCH 397/702] evince --- shell/alias/evince.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/alias/evince.sh b/shell/alias/evince.sh index 0d36d89..01ec950 100644 --- a/shell/alias/evince.sh +++ b/shell/alias/evince.sh @@ -1,3 +1,4 @@ -alias ev="\ -evince \ -" +ev() { + evince \ + "${@}" +} From c1f5176e25c6fdf91543e46fc3149e27ed61785a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:07:23 +0100 Subject: [PATCH 398/702] em,g --- shell/alias/emacs.sh | 8 ++++---- shell/alias/grep.sh | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/shell/alias/emacs.sh b/shell/alias/emacs.sh index 7984a4a..8bd77fc 100644 --- a/shell/alias/emacs.sh +++ b/shell/alias/emacs.sh @@ -1,4 +1,4 @@ -# short -alias em="\ -emacs \ -" +em() { + emacs \ + "${@}" +} diff --git a/shell/alias/grep.sh b/shell/alias/grep.sh index 73179dd..ab8e396 100644 --- a/shell/alias/grep.sh +++ b/shell/alias/grep.sh @@ -1,7 +1,8 @@ # grep from current directory with regex -alias g="\ -grep \ ---directories \"recurse\" \ ---line-number \ ---regexp \ -" +g() { + grep \ + --directories "recurse" \ + --line-number \ + --regexp \ + "${@}" +} From a2726f2f3b27e57407917c239e5feff2933865b8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:16:45 +0100 Subject: [PATCH 399/702] byobu --- shell/alias/byobu.sh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/shell/alias/byobu.sh b/shell/alias/byobu.sh index df37d6f..d645cb1 100644 --- a/shell/alias/byobu.sh +++ b/shell/alias/byobu.sh @@ -1,19 +1,23 @@ -alias bb="\ -byobu \ -" +bb() { + byobu \ + "${@}" +} -alias bba="\ -byobu \ -attach-session \ -" +bba() { + byobu \ + attach-session \ + "${@}" +} -alias bbl="\ -byobu \ -ls \ -" +bbl() { + byobu \ + ls \ + "${@}" +} -alias bbn="\ -byobu \ -new-session \ --d \ -" +bbnd() { + byobu \ + new-session \ + -d \ + "${@}" +} From e2a59923af9aec7014635235018c1e01a8f98f1e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:17:36 +0100 Subject: [PATCH 400/702] tm --- shell/alias/tmux.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 shell/alias/tmux.sh diff --git a/shell/alias/tmux.sh b/shell/alias/tmux.sh new file mode 100644 index 0000000..fa96b6a --- /dev/null +++ b/shell/alias/tmux.sh @@ -0,0 +1,4 @@ +tm() { + tmux \ + "${@}" +} From 449f1dadd819b730076abbc8c79fe75321ba1127 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:18:41 +0100 Subject: [PATCH 401/702] nn --- shell/alias/nano.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/alias/nano.sh b/shell/alias/nano.sh index 37bd342..2718583 100644 --- a/shell/alias/nano.sh +++ b/shell/alias/nano.sh @@ -1,3 +1,4 @@ -alias n="\ -nano \ -" +nn() { + nano \ + "${@}" +} From db65dea9dd6a3f74eb6dfd0d73706a8bb2e52cbe Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:20:14 +0100 Subject: [PATCH 402/702] p,pc --- shell/alias/pass.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/shell/alias/pass.sh b/shell/alias/pass.sh index 1f48255..ddcfa48 100644 --- a/shell/alias/pass.sh +++ b/shell/alias/pass.sh @@ -1,10 +1,12 @@ # display pass entry’s content -alias p="\ -pass \ -" +p() { + pass \ + "${@}" +} # copy passphrase into clipboard -alias pc="\ -pass \ ---clip \ -" +pc() { + pass \ + --clip \ + "${@}" +} From 11fc443c8f4be82dd33228927f911def2ffa9e59 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:22:14 +0100 Subject: [PATCH 403/702] rmi --- shell/alias/rm.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 shell/alias/rm.sh diff --git a/shell/alias/rm.sh b/shell/alias/rm.sh new file mode 100644 index 0000000..0d42f42 --- /dev/null +++ b/shell/alias/rm.sh @@ -0,0 +1,6 @@ +# remove interactively +rmi() { + rm \ + --interactive \ + "${@}" +} From 259dbd11d1a02420a24f3cdbbc05d1cfb429a2ea Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:26:30 +0100 Subject: [PATCH 404/702] pwg,pwgs --- shell/alias/pwgen.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/shell/alias/pwgen.sh b/shell/alias/pwgen.sh index c462028..4052d61 100644 --- a/shell/alias/pwgen.sh +++ b/shell/alias/pwgen.sh @@ -1,16 +1,15 @@ # generate passwords -alias pwg="\ -pwgen \ --1 \ ---num-passwords 1048576 \ ---secure \ -" +pwg() { + pwgen \ + -1 \ + --num-passwords 1048576 \ + --secure \ + "${@}" +} # generate passwords with symbols -alias pwgs="\ -pwgen \ --1 \ ---num-passwords 1048576 \ ---secure \ ---symbols \ -" +pwgs() { + pwg \ + --symbols \ + "${@}" +} From ccf058440c527b1150d167e691ee67d790864fca Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:29:05 +0100 Subject: [PATCH 405/702] pg --- shell/alias/ps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/alias/ps.sh b/shell/alias/ps.sh index 0e643ae..bbb93de 100644 --- a/shell/alias/ps.sh +++ b/shell/alias/ps.sh @@ -1,7 +1,7 @@ # look for a string in processes names -alias pg="\ -ps \ --A \ -| \ -grep \ -" +pg() { + ps \ + -A | + grep \ + "${@}" +} From 8df4abafcad8ceee58018ab1743785e94b9cd59d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:37:38 +0100 Subject: [PATCH 406/702] tc,tl,tv,tx --- shell/alias/tar.sh | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/shell/alias/tar.sh b/shell/alias/tar.sh index 74b5020..bfbf7be 100644 --- a/shell/alias/tar.sh +++ b/shell/alias/tar.sh @@ -1,21 +1,27 @@ -alias tc="\ -tar \ ---verbose \ ---create \ ---auto-compress \ ---file \ -" +tc() { + tv \ + --create \ + --auto-compress \ + --file \ + "${@}" +} -alias tl="\ -tar \ ---verbose \ ---list \ ---file \ -" +tl() { + tv \ + --list \ + --file \ + "${@}" +} -alias tx="\ -tar \ ---verbose \ ---extract \ ---file \ -" +tv() { + tar \ + --verbose \ + "${@}" +} + +tx() { + tv \ + --extract \ + --file \ + "${@}" +} From 7ae9eb739a5a4f78d2479701ca4f92e541694481 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:40:17 +0100 Subject: [PATCH 407/702] k,kf --- shell/alias/kill.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/shell/alias/kill.sh b/shell/alias/kill.sh index 970352d..a6e105c 100644 --- a/shell/alias/kill.sh +++ b/shell/alias/kill.sh @@ -1,10 +1,12 @@ # kill a process by id -alias k="\ -kill \ -" +k() { + kill \ + "${@}" +} # force kill a process by id -alias kf="\ -kill \ --9 \ -" +kf() { + kill \ + -9 \ + "${@}" +} From 5af5181aa49bbd3efb9d34df72bd28a28f8fb585 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:42:21 +0100 Subject: [PATCH 408/702] ka,kaf --- shell/alias/killall.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/shell/alias/killall.sh b/shell/alias/killall.sh index 43c4cbe..2fbb157 100644 --- a/shell/alias/killall.sh +++ b/shell/alias/killall.sh @@ -1,10 +1,12 @@ # kill all instances of a process by name -alias ka="\ -killall \ -" +ka() { + killall \ + "${@}" +} # force kill all instances of a process by name -alias kaf="\ -killall \ --9 \ -" +kaf() { + killall \ + -9 \ + "${@}" +} From ca0399d4f35bf2e40858ffb2db8e96755f2ea7cf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:53:58 +0100 Subject: [PATCH 409/702] lb,lbc,lbo --- shell/alias/lsblk.sh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/shell/alias/lsblk.sh b/shell/alias/lsblk.sh index 4d63193..fb50d87 100644 --- a/shell/alias/lsblk.sh +++ b/shell/alias/lsblk.sh @@ -1,12 +1,27 @@ # list block devices -alias lb="\ -lsblk \ ---output \"NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS\" \ ---noempty \ -" +lb() { + lbo \ + "SIZE" \ + "TYPE" \ + "FSTYPE" \ + "LABEL" \ + "MOUNTPOINTS" +} -# list block devices (old) -alias lbo="\ -lsblk \ ---output \"NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINT\" \ -" +# common arguments +lbc() { + lsblk \ + --noempty \ + "${@}" +} + +# output arguments +lbo() { + local argument + local arguments="NAME" + for argument in "${@}"; do + arguments="${arguments},${argument}" + done + lbc \ + --output "${arguments}" +} From ea5bd6cfb2b9dda7ccf22e6544db3f451bdb184f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:59:29 +0100 Subject: [PATCH 410/702] gak,gau --- shell/alias/gpg.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shell/alias/gpg.sh b/shell/alias/gpg.sh index 549c34e..4c1d4e5 100644 --- a/shell/alias/gpg.sh +++ b/shell/alias/gpg.sh @@ -1,12 +1,12 @@ # turn gpg agent off -alias gak="\ -gpgconf \ ---kill \"gpg-agent\" \ -" +gak() { + gpgconf \ + --kill "gpg-agent" +} # bind gpg agent to current tty -alias gau="\ -gpg-connect-agent \ -updatestartuptty \ -/bye \ -" +gau() { + gpg-connect-agent \ + updatestartuptty \ + /bye +} From 8d6b4884a10ff06267e63a056a4f1d174ea8a97e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 15:59:57 +0100 Subject: [PATCH 411/702] fix --- shell/alias/killall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/alias/killall.sh b/shell/alias/killall.sh index 2fbb157..a4d083e 100644 --- a/shell/alias/killall.sh +++ b/shell/alias/killall.sh @@ -7,6 +7,6 @@ ka() { # force kill all instances of a process by name kaf() { killall \ - -9 \ + -9 \ "${@}" } From a31401bd773d8f4363198f107b37fc8d4b160978 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:02:25 +0100 Subject: [PATCH 412/702] md,mdp --- shell/alias/mkdir.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/shell/alias/mkdir.sh b/shell/alias/mkdir.sh index 52745dd..961e14b 100644 --- a/shell/alias/mkdir.sh +++ b/shell/alias/mkdir.sh @@ -1,10 +1,12 @@ # make a directory -alias md="\ -mkdir \ -" +md() { + mkdir \ + "${@}" +} # make a directory after making its parents -alias mdp="\ -mkdir \ ---parents \ -" +mdp() { + mkdir \ + --parents \ + "${@}" +} From ecb4005b0edb6eb991b2c2f09af343f7c2980eb7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:07:47 +0100 Subject: [PATCH 413/702] bases --- shell/alias/lsblk.sh | 6 +++--- shell/alias/rsync.sh | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/shell/alias/lsblk.sh b/shell/alias/lsblk.sh index fb50d87..398bc42 100644 --- a/shell/alias/lsblk.sh +++ b/shell/alias/lsblk.sh @@ -8,8 +8,8 @@ lb() { "MOUNTPOINTS" } -# common arguments -lbc() { +# base arguments +lbb() { lsblk \ --noempty \ "${@}" @@ -22,6 +22,6 @@ lbo() { for argument in "${@}"; do arguments="${arguments},${argument}" done - lbc \ + lbb \ --output "${arguments}" } diff --git a/shell/alias/rsync.sh b/shell/alias/rsync.sh index 7c08c91..d7c66b6 100644 --- a/shell/alias/rsync.sh +++ b/shell/alias/rsync.sh @@ -1,12 +1,19 @@ # synchronize -alias rs="\ -rsync \ ---archive \ ---partial \ ---progress \ ---verbose \ ---no-inc-recursive \ -" +rs() { + rsb \ + "${@}" +} + +# base arguments +rsb() { + rsync \ + --archive \ + --no-inc-recursive \ + --partial \ + --progress \ + --verbose \ + "${@}" +} # synchronize and delete after alias rsda="\ From dd801e188e6e6123db576002d3374188cdfd0506 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:10:16 +0100 Subject: [PATCH 414/702] rsda,rsdb --- shell/alias/rsync.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/shell/alias/rsync.sh b/shell/alias/rsync.sh index d7c66b6..a5efc09 100644 --- a/shell/alias/rsync.sh +++ b/shell/alias/rsync.sh @@ -16,21 +16,15 @@ rsb() { } # synchronize and delete after -alias rsda="\ -rsync \ ---archive \ ---partial \ ---progress \ ---verbose \ ---delete-after \ -" +rsda() { + rsb \ + --delete-after \ + "${@}" +} # synchronize and delete before -alias rsdb="\ -rsync \ ---archive \ ---partial \ ---progress \ ---verbose \ ---delete-before \ -" +rsdb() { + rsb \ + --delete-before \ + "${@}" +} From 6a49f4981ac7d346b9775947316551c0e05ce524 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:24:18 +0100 Subject: [PATCH 415/702] =?UTF-8?q?=E2=88=92=C2=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/micro.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 shell/alias/micro.sh diff --git a/shell/alias/micro.sh b/shell/alias/micro.sh deleted file mode 100644 index b0aa4be..0000000 --- a/shell/alias/micro.sh +++ /dev/null @@ -1,4 +0,0 @@ -µ() { - micro \ - "${@}" -} From c68598931b8e5104233a5467791d5feef214db52 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:37:04 +0100 Subject: [PATCH 416/702] sh --- shell/alias/shell.sh | 3 +++ shell/main.sh | 3 +++ shell/shell.sh | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/shell/alias/shell.sh b/shell/alias/shell.sh index d38c3cb..531b4b0 100644 --- a/shell/alias/shell.sh +++ b/shell/alias/shell.sh @@ -17,6 +17,9 @@ x() { "${@}" } +# shellcheck disable=SC2154 +[ "${SH}" = "bash" ] || return + # back # shellcheck disable=SC3033 diff --git a/shell/main.sh b/shell/main.sh index 0ccf86b..226062c 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,5 +1,8 @@ [ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" +SH="$(cat /proc/$$/comm)" +export SH + main_source_directory() { local path="${1}" if [ -d "${path}" ]; then diff --git a/shell/shell.sh b/shell/shell.sh index b50964e..edddde6 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,10 +1,10 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " -SH="$(cat /proc/$$/comm)" shell_color() { local code="${1}" + # shellcheck disable=SC2154 case "${SH}" in "bash") printf "\e[0" From bd4fe3656e7449db063baf38f528f281b1f5102c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:45:07 +0100 Subject: [PATCH 417/702] m,remount --- shell/alias/mount.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/shell/alias/mount.sh b/shell/alias/mount.sh index ca11b0e..d6329c3 100644 --- a/shell/alias/mount.sh +++ b/shell/alias/mount.sh @@ -1,10 +1,11 @@ -alias m="\ -mount \ -" +m() { + mount \ + "${@}" +} # remount read-only medium in read-write -alias remount="\ -mount \ --o \"remount,rw\" \ -\"/usr/lib/live/mount/medium\" \ -" +remount() { + mount \ + -o "remount,rw" \ + "/usr/lib/live/mount/medium" +} From 2acb0be68a43c54d714c69fa48c15da0721eb8be Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:48:48 +0100 Subject: [PATCH 418/702] bfdf,bfdu --- shell/alias/btrfs.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/shell/alias/btrfs.sh b/shell/alias/btrfs.sh index 6b4392c..c72346d 100644 --- a/shell/alias/btrfs.sh +++ b/shell/alias/btrfs.sh @@ -1,15 +1,17 @@ -alias bfdf="\ -btrfs \ -filesystem \ -df \ -" +bfdf() { + btrfs \ + filesystem \ + df \ + "${@}" +} -alias bfdu="\ -btrfs \ -filesystem \ -du \ ---summarize \ -" +bfdu() { + btrfs \ + filesystem \ + du \ + --summarize \ + "${@}" +} alias bfu="\ btrfs \ From 9312698f43e5cd3c78f0d46cb2e1e024ce94756b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:49:41 +0100 Subject: [PATCH 419/702] bfu --- shell/alias/btrfs.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/shell/alias/btrfs.sh b/shell/alias/btrfs.sh index c72346d..6e8e0f2 100644 --- a/shell/alias/btrfs.sh +++ b/shell/alias/btrfs.sh @@ -13,11 +13,12 @@ bfdu() { "${@}" } -alias bfu="\ -btrfs \ -filesystem \ -usage \ -" +bfu() { + btrfs \ + filesystem \ + usage \ + "${@}" +} alias bpg="\ btrfs \ From 01b0224eee7ebe31028294ecdeb0736a742a156d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:53:19 +0100 Subject: [PATCH 420/702] bsc,bsd,bss,bssr --- shell/alias/btrfs.sh | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/shell/alias/btrfs.sh b/shell/alias/btrfs.sh index 6e8e0f2..defbf1a 100644 --- a/shell/alias/btrfs.sh +++ b/shell/alias/btrfs.sh @@ -26,26 +26,30 @@ property \ get \ " -alias bsc="\ -btrfs \ -subvolume \ -create \ -" +bsc() { + btrfs \ + subvolume \ + create \ + "${@}" +} -alias bsd="\ -btrfs \ -subvolume \ -delete \ -" +bsd() { + btrfs \ + subvolume \ + delete \ + "${@}" +} -alias bss="\ -btrfs \ -subvolume \ -snapshot \ -" +bss() { + btrfs \ + subvolume \ + snapshot \ + "${@}" +} -alias bssr="\ -btrfs \ -subvolume \ -snapshot -r \ -" +bssr() { + btrfs \ + subvolume \ + snapshot -r \ + "${@}" +} From db596ce969b63f1e29bd8bc1f34c381e6f34c6dc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:55:31 +0100 Subject: [PATCH 421/702] bpg --- shell/alias/btrfs.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/shell/alias/btrfs.sh b/shell/alias/btrfs.sh index defbf1a..061d373 100644 --- a/shell/alias/btrfs.sh +++ b/shell/alias/btrfs.sh @@ -20,11 +20,12 @@ bfu() { "${@}" } -alias bpg="\ -btrfs \ -property \ -get \ -" +bpg() { + btrfs \ + property \ + get \ + "${@}" +} bsc() { btrfs \ From 3360a7983dca85189112679b1d7aebe1f8136d2b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 16:59:23 +0100 Subject: [PATCH 422/702] ga,gaa --- shell/alias/git.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index a639a75..fdcbffc 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -1,15 +1,17 @@ # add to index -alias ga="\ -git \ -add \ -" +ga() { + git \ + add \ + "${@}" +} # add all to index -alias gaa="\ -git \ -add \ ---all \ -" +gaa() { + git \ + add \ + --all \ + "${@}" +} # add parts to index alias gap="\ From ecb6a686f2e2d30340dfd7ad4e9fa4cc57f8a8ac Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 17:01:12 +0100 Subject: [PATCH 423/702] gaap,gap --- shell/alias/git.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index fdcbffc..88188c2 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -13,12 +13,22 @@ gaa() { "${@}" } +# add parts of all to index +gaap() { + git \ + add \ + --all \ + --patch \ + "${@}" +} + # add parts to index -alias gap="\ -git \ -add \ ---patch \ -" +gap() { + git \ + add \ + --patch \ + "${@}" +} # create a branch alias gb="\ From 1ddba597596a31b6335c0a10616b61dc01ee280f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 18:43:09 +0100 Subject: [PATCH 424/702] gb,gbd,gbdf,gbl,gbs --- shell/alias/git.sh | 61 +++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 88188c2..ce073a0 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -31,42 +31,47 @@ gap() { } # create a branch -alias gb="\ -git \ -branch \ -" +gb() { + git \ + branch \ + "${@}" +} # delete a branch -alias gbd="\ -git \ -branch \ ---delete \ -" +gbd() { + git \ + branch \ + --delete \ + "${@}" +} # force a branch deletion -alias gbdf="\ -git \ -branch \ ---delete \ ---force \ -" +gbdf() { + git \ + branch \ + --delete \ + --force \ + "${@}" +} # list branches -alias gbl="\ -git \ -branch \ ---all \ ---list \ ---verbose \ ---verbose \ -" +gbl() { + git \ + branch \ + --all \ + --list \ + --verbose \ + --verbose \ + "${@}" +} # set the link to a remote branch from a local branch -alias gbsu="\ -git \ -branch \ ---set-upstream-to \ -" +gbs() { + git \ + branch \ + --set-upstream-to \ + "${@}" +} # clone a remote repository alias gc="\ From a92770848e336e08f8c04752e49ff48439c38410 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 18:48:01 +0100 Subject: [PATCH 425/702] gcf --- shell/alias/git.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index ce073a0..5bec3a2 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -73,19 +73,14 @@ gbs() { "${@}" } -# clone a remote repository -alias gc="\ -git \ -clone \ -" - # clean untracked files -alias gcf="\ -git \ -clean \ --d \ ---force \ -" +gcf() { + git \ + clean \ + -d \ + --force \ + "${@}" +} # commit the index alias gcm="\ From 3554f0b90536fccd1b670b283b5c3c584d291abd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 18:51:33 +0100 Subject: [PATCH 426/702] gco,gcoo,gcp,gcpa,gcpc --- shell/alias/git.sh | 51 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 5bec3a2..b1ebb60 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -115,37 +115,42 @@ commit \ " # switch to a branch or checkout file(s) from a commit -alias gco="\ -git \ -checkout \ -" +gco() { + git \ + checkout \ + "${@}" +} # checkout an orphan branch -alias gcoo="\ -git \ -checkout \ ---orphan \ -" +gcoo() { + git \ + checkout \ + --orphan \ + "${@}" +} # pick a commit -alias gcp="\ -git \ -cherry-pick \ -" +gcp() { + git \ + cherry-pick \ + "${@}" +} # abort the commit pick -alias gcpa="\ -git \ -cherry-pick \ ---abort \ -" +gcpa() { + git \ + cherry-pick \ + --abort \ + "${@}" +} # continue the commit pick -alias gcpc="\ -git \ -cherry-pick \ ---continue \ -" +gcpc() { + git \ + cherry-pick \ + --continue \ + "${@}" +} # configure the user name alias gcun="\ From c5185768b0c71b18e5c26c7aa34c01702d2d85b7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 18:54:56 +0100 Subject: [PATCH 427/702] gcue,gcun --- shell/alias/git.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index b1ebb60..5ce5859 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -152,19 +152,21 @@ gcpc() { "${@}" } -# configure the user name -alias gcun="\ -git \ -config \ -user.name \ -" - # configure the user email -alias gcue="\ -git \ -config \ -user.email \ -" +gcue() { + git \ + config \ + "user.email" \ + "${@}" +} + +# configure the user name +gcun() { + git \ + config \ + "user.name" \ + "${@}" +} # differences from last or between commits alias gd="\ From 5539baa3402946e85b68f3fc55f2ad857389bdaa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:01:27 +0100 Subject: [PATCH 428/702] gd,gdc,gdcw,gdt,gdw --- shell/alias/git.sh | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 5ce5859..a93bcb5 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -169,39 +169,44 @@ gcun() { } # differences from last or between commits -alias gd="\ -git \ -diff \ -" +gd() { + git \ + diff \ + "${@}" +} # display what is indexed in cache -alias gdc="\ -git \ -diff \ ---cached \ -" +gdc() { + git \ + diff \ + --cached \ + "${@}" +} # indexed character-level differences -alias gdcw="\ -git \ -diff \ ---cached \ ---word-diff-regex=. \ -" +gdcw() { + git \ + diff \ + --cached \ + --word-diff-regex "." \ + "${@}" +} # differences via external tool -alias gdt="\ -git \ -difftool \ ---dir-diff \ -" +gdt() { + git \ + difftool \ + --dir-diff \ + "${@}" +} # character-level differences -alias gdw="\ -git \ -diff \ ---word-diff-regex=. \ -" +gdw() { + git \ + diff \ + --word-diff-regex "." \ + "${@}" +} # fetch from the remote repository alias gf="\ From 7f814102e06b748d1939d54787c833a57d57f54c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:02:56 +0100 Subject: [PATCH 429/702] gf,gfp --- shell/alias/git.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index a93bcb5..4044fa8 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -209,21 +209,20 @@ gdw() { } # fetch from the remote repository -alias gf="\ -git \ -fetch \ ---verbose \ ---tags \ -" +gf() { + git \ + fetch \ + --tags \ + --verbose \ + "${@}" +} # fetch from remote repository and prune local orphan branches -alias gfp="\ -git \ -fetch \ ---verbose \ ---tags \ ---prune \ -" +gfp() { + gf \ + --prune \ + "${@}" +} # garbage collect all orphan commits alias ggc="\ From beb479ba7ce4931b004fba3e0fc3a09b815dd993 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:07:11 +0100 Subject: [PATCH 430/702] ggc --- shell/alias/git.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 4044fa8..801df15 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -225,18 +225,17 @@ gfp() { } # garbage collect all orphan commits -alias ggc="\ -git \ -reflog \ -expire \ ---all \ ---expire \"all\" \ -; \ -git \ -gc \ ---aggressive \ ---prune=\"now\" \ -" +ggc() { + git \ + reflog \ + expire \ + --all \ + --expire "all" && + git \ + gc \ + --aggressive \ + --prune="now" +} # initialize a new repository alias gi="\ From d8de9913ce6c20ec99e62c4adb0aff8820e565e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:08:27 +0100 Subject: [PATCH 431/702] gi,gib --- shell/alias/git.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 801df15..977b3e0 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -238,17 +238,19 @@ ggc() { } # initialize a new repository -alias gi="\ -git \ -init \ -" +gi() { + git \ + init \ + "${@}" +} # initialize a new bare repository -alias gib="\ -git \ -init \ ---bare \ -" +gib() { + git \ + init \ + --bare \ + "${@}" +} # log commits history alias gl="\ From 7a1320e10828675512df3404a0012f23a90135f6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:17:36 +0100 Subject: [PATCH 432/702] gla,glb --- shell/alias/git.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 977b3e0..60d84d9 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -252,14 +252,21 @@ gib() { "${@}" } -# log commits history -alias gl="\ -git \ -log \ ---all \ ---graph \ ---format=\"%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B\" \ -" +# log all history +gla() { + glb \ + --all \ + "${@}" +} + +# log branch history +glb() { + git \ + log \ + --graph \ + --format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" \ + "${@}" +} # log medium information alias glm="\ From c2ce37595c33a222abe0b81a380b2b4ff3807e71 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 19:18:00 +0100 Subject: [PATCH 433/702] =?UTF-8?q?=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 60d84d9..2b79893 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -263,8 +263,8 @@ gla() { glb() { git \ log \ - --graph \ --format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" \ + --graph \ "${@}" } From 58578f952322c87886e15afe0cba62bddc29bfdc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 20:27:36 +0100 Subject: [PATCH 434/702] gl,gla,glap,glp --- shell/alias/git.sh | 61 +++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 2b79893..cd81130 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -252,41 +252,46 @@ gib() { "${@}" } -# log all history -gla() { - glb \ - --all \ - "${@}" -} - -# log branch history -glb() { +# log history +gl() { + local format="\ +%C(auto)%h%d +S %C(red)%GS +A %C(green)%ai + %C(green)%an %ae +C %C(blue)%ci + %C(blue)%cn %ce +%B" git \ log \ - --format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" \ + --abbrev=8 \ + --abbrev-commit \ + --format="${format}" \ --graph \ "${@}" } -# log medium information -alias glm="\ -git \ -log \ ---all \ ---decorate \ ---graph \ ---pretty=medium \ -" +# log all history +gla() { + gl \ + --all \ + "${@}" +} -# log commits history with patches -alias glp="\ -git \ -log \ ---all \ ---graph \ ---format=\"%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B\" \ ---patch \ -" +# log all history with patches +glap() { + gl \ + --all \ + --patch \ + "${@}" +} + +# log history with patches +glp() { + gl \ + --patch \ + "${@}" +} # abort the current merge commit alias gma="\ From 232f583be3fae64e3a8de0002d39b0ea3dbfa18f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 21:49:50 +0100 Subject: [PATCH 435/702] =?UTF-8?q?=E2=88=92sign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index cd81130..61188ed 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -308,15 +308,6 @@ merge \ --message \ " -# do a signed merge commit -alias gmcs="\ -git \ -merge \ ---no-ff \ ---gpg-sign \ --m \ -" - # fast-forward to remote branch alias gmf="\ git \ @@ -468,10 +459,3 @@ git \ tag \ --delete \ " - -# tag a commit and sign -alias gts="\ -git \ -tag \ ---sign \ -" From 19b95e6061798dd9e55b2860d5d3657bb90894f0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 01:31:06 +0100 Subject: [PATCH 436/702] \n --- shell/shell.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index edddde6..7d32424 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -76,13 +76,11 @@ shell_prompt() { fi fi # new - view="${view} -" + view="${view}\\n" # path view="${view}${SH_CYAN}${path}" # new - view="${view} -" + view="${view}\\n" # frame view="${view}${SH_DEFAULT}┌ " # user @@ -96,8 +94,7 @@ shell_prompt() { view="${view}${SH_DEFAULT} @ " view="${view}${SH_BROWN}${host}" # new - view="${view} -" + view="${view}\\n" # prompt view="${view}${SH_DEFAULT}${PS2}" # print From 5e9ae45748bc01bbfef30e287ebd902898bc346f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 01:32:34 +0100 Subject: [PATCH 437/702] %b --- shell/shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/shell.sh b/shell/shell.sh index 7d32424..189fd1b 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -98,7 +98,7 @@ shell_prompt() { # prompt view="${view}${SH_DEFAULT}${PS2}" # print - printf "%s" "${view}" + printf "%b" "${view}" } shell_setup() { From 0eea7d052eaf7e4a5bf204f3edb412bc16589dd6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:05:07 +0100 Subject: [PATCH 438/702] fix --- shell/shell.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 189fd1b..c25ab55 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -7,10 +7,11 @@ shell_color() { # shellcheck disable=SC2154 case "${SH}" in "bash") - printf "\e[0" + printf "\x01\e[0" if [ -n "${code}" ]; then printf "%s" ";${code}" fi + printf "m\x02" ;; *) printf "\033[" @@ -19,9 +20,9 @@ shell_color() { else printf "0" fi + printf "m" ;; esac - printf "m" } SH_BROWN="$(shell_color 33)" SH_CYAN="$(shell_color 36)" From 235202a64dd8cebc39ab05f5ae8fefea6517be50 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:26:32 +0100 Subject: [PATCH 439/702] gma,gmc,gmf,gms,gmt --- shell/alias/git.sh | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 61188ed..57c897c 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -294,39 +294,44 @@ glp() { } # abort the current merge commit -alias gma="\ -git \ -merge \ ---abort \ -" +gma() { + git \ + merge \ + --abort \ + "${@}" +} # do a merge commit -alias gmc="\ -git \ -merge \ ---no-ff \ ---message \ -" +gmc() { + git \ + merge \ + --no-ff \ + --message \ + "${@}" +} # fast-forward to remote branch -alias gmf="\ -git \ -merge \ ---ff-only \ -" +gmf() { + git \ + merge \ + --ff-only \ + "${@}" +} # squash a branch and index its modifications -alias gms="\ -git \ -merge \ ---squash \ -" +gms() { + git \ + merge \ + --squash \ + "${@}" +} # merge via external tool -alias gmt="\ -git \ -mergetool \ -" +gmt() { + git \ + mergetool \ + "${@}" +} # push to the remote repository alias gp="\ From 5780c0ed185b4ec98501a3607a8883874070c0b6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:31:52 +0100 Subject: [PATCH 440/702] gp,gpd,gpf --- shell/alias/git.sh | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 57c897c..9956b23 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -334,29 +334,28 @@ gmt() { } # push to the remote repository -alias gp="\ -git \ -push \ ---verbose \ ---tags \ -" +gp() { + git \ + push \ + --tags \ + --verbose \ + "${@}" +} # delete from the remote repository -alias gpd="\ -git \ -push \ ---verbose \ ---delete \ -" +gpd() { + git \ + push \ + --delete \ + "${@}" +} # force the push to the remote repository -alias gpf="\ -git \ -push \ ---verbose \ ---tags \ ---force \ -" +gpf() { + gp \ + --force \ + "${@}" +} # rebase current branch onto another alias grb="\ From af70985d82224125cde15c3ec1f4f6decb80a0ab Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:45:45 +0100 Subject: [PATCH 441/702] rebase,rm --- shell/alias/git.sh | 62 +++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 9956b23..3517ea0 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -358,44 +358,50 @@ gpf() { } # rebase current branch onto another -alias grb="\ -git \ -rebase \ -" +grb() { + git \ + rebase \ + "${@}" +} # abort current rebase -alias grba="\ -git \ -rebase \ ---abort \ -" +grba() { + git \ + rebase \ + --abort \ + "${@}" +} # continue current rebase -alias grbc="\ -git \ -rebase \ ---continue \ -" +grbc() { + git \ + rebase \ + --continue \ + "${@}" +} # force rebase without fast-forward -alias grbf="\ -git \ -rebase \ ---force-rebase \ -" +grbf() { + git \ + rebase \ + --force-rebase \ + "${@}" +} # rebase interactively -alias grbi="\ -git \ -rebase \ ---interactive \ -" +grbi() { + git \ + rebase \ + --interactive \ + "${@}" +} # remove and add removal to index -alias grm="\ -git \ -rm \ -" +grm() { + git \ + rm \ + "${@}" +} # add a new remote repository alias grma="\ From 79b5c724e4ebadfdc8ce09e27340debab65bf10c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:53:03 +0100 Subject: [PATCH 442/702] remote --- shell/alias/git.sh | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 3517ea0..87a4978 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -404,32 +404,28 @@ grm() { } # add a new remote repository -alias grma="\ -git \ -remote \ -add \ -" +grma() { + git \ + remote \ + add \ + "${@}" +} # list remote repositories -alias grml="\ -git \ -remote \ ---verbose \ -" - -# show a connection to a repository -alias grms="\ -git \ -remote \ -show \ -" +grml() { + git \ + remote \ + --verbose \ + "${@}" +} # set the location of the remote repository -alias grmsu="\ -git \ -remote \ -set-url \ -" +grms() { + git \ + remote \ + set-url \ + "${@}" +} # remove file(s) from index or move current branch pointer alias grs="\ From e5c43ae6769fc8d1daf93e3d6bc9ff0cccf59d62 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:54:03 +0100 Subject: [PATCH 443/702] reset --- shell/alias/git.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 87a4978..7a74031 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -428,17 +428,19 @@ grms() { } # remove file(s) from index or move current branch pointer -alias grs="\ -git \ -reset \ -" +grs() { + git \ + reset \ + "${@}" +} # wipe modifications or reset current branch to another commit -alias grsh="\ -git \ -reset \ ---hard \ -" +grsh() { + git \ + reset \ + --hard \ + "${@}" +} # current state of repository alias gs="\ From 5f23aadfe598504f1e8a13fe2bcda72ba862260b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:55:45 +0100 Subject: [PATCH 444/702] tag --- shell/alias/git.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 7a74031..00bc731 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -456,14 +456,16 @@ show \ " # tag a commit -alias gt="\ -git \ -tag \ -" +gt() { + git \ + tag \ + "${@}" +} # delete a tag -alias gtd="\ -git \ -tag \ ---delete \ -" +gtd() { + git \ + tag \ + --delete \ + "${@}" +} From 033999e9f6243165c45e2bbbb803db81fc660756 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 02:58:43 +0100 Subject: [PATCH 445/702] gs,gsc --- shell/alias/git.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 00bc731..a95c7f5 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -443,17 +443,19 @@ grsh() { } # current state of repository -alias gs="\ -git \ -status \ ---untracked-files=all \ -" +gs() { + git \ + status \ + --untracked-files="all" \ + "${@}" +} # show a commit -alias gsc="\ -git \ -show \ -" +gsc() { + git \ + show \ + "${@}" +} # tag a commit gt() { From 7e788e5940c7bc91862538864f4b2a89084f7f05 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:07:23 +0100 Subject: [PATCH 446/702] commit --- shell/alias/git.sh | 47 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index a95c7f5..bb7301e 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -83,36 +83,31 @@ gcf() { } # commit the index -alias gcm="\ -git \ -commit \ ---message \ -" +gcm() { + git \ + commit \ + --message \ + "${@}" +} # redo the last commit with a different message -alias gcma="\ -git \ -commit \ ---amend \ ---message \ -" +gcma() { + git \ + commit \ + --amend \ + --message \ + "${@}" +} # make a root commit -alias gcme="\ -git \ -commit \ ---allow-empty \ ---allow-empty-message \ ---message \"\" \ -" - -# commit the index and sign -alias gcms="\ -git \ -commit \ ---gpg-sign \ ---message \ -" +gcme() { + git \ + commit \ + --allow-empty \ + --allow-empty-message \ + --message \ + "${@}" +} # switch to a branch or checkout file(s) from a commit gco() { From cd4d7d3fcb01980eb4a1230bcaf0d1ecccb4a257 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:09:36 +0100 Subject: [PATCH 447/702] gcam,gcem --- shell/alias/git.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index bb7301e..6dd641e 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -73,6 +73,25 @@ gbs() { "${@}" } +# redo the last commit with a different message +gcam() { + git \ + commit \ + --amend \ + --message \ + "${@}" +} + +# make a root commit +gcem() { + git \ + commit \ + --allow-empty \ + --allow-empty-message \ + --message \ + "${@}" +} + # clean untracked files gcf() { git \ @@ -90,25 +109,6 @@ gcm() { "${@}" } -# redo the last commit with a different message -gcma() { - git \ - commit \ - --amend \ - --message \ - "${@}" -} - -# make a root commit -gcme() { - git \ - commit \ - --allow-empty \ - --allow-empty-message \ - --message \ - "${@}" -} - # switch to a branch or checkout file(s) from a commit gco() { git \ From dde88afb21956c016b3395f7aff7b1c39e279560 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:16:32 +0100 Subject: [PATCH 448/702] agud,agug --- shell/alias/apt.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index c4a0a7a..b01e62d 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -59,13 +59,15 @@ remove \ " # update packages catalog -alias agud="\ -apt-get \ -update \ -" +agud() { + apt-get \ + update \ + "${@}" +} # upgrade forbidding package installation or removal -alias agug="\ -apt-get \ -upgrade \ -" +agug() { + apt-get \ + upgrade \ + "${@}" +} From a2efc157076fefbf8ee1e2b5b8c86fa6920b7051 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:18:15 +0100 Subject: [PATCH 449/702] agp,agr --- shell/alias/apt.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index b01e62d..de8ddfa 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -47,16 +47,18 @@ install \ " # -alias agp="\ -apt-get \ -purge \ -" +agp() { + apt-get \ + purge \ + "${@}" +} # -alias agr="\ -apt-get \ -remove \ -" +agr() { + apt-get \ + remove \ + "${@}" +} # update packages catalog agud() { From 34b6b915f48e6c2de388bf567378250f6ad8bacb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:20:31 +0100 Subject: [PATCH 450/702] agi --- shell/alias/apt.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index de8ddfa..a4d38b0 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -41,10 +41,11 @@ dist-upgrade \ " # install packages -alias agi="\ -apt-get \ -install \ -" +agi() { + apt-get \ + install \ + "${@}" +} # agp() { From f8ed45ad959e6693303300d4baa59e56316a105c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:25:02 +0100 Subject: [PATCH 451/702] agap,agar --- shell/alias/apt.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index a4d38b0..f3c7624 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -17,16 +17,18 @@ search \ " # -alias agap="\ -apt-get \ -autopurge \ -" +agap() { + apt-get \ + autopurge \ + "${@}" +} # -alias agar="\ -apt-get \ -autoremove \ -" +agar() { + apt-get \ + autoremove \ + "${@}" +} # clean packages cache alias agc="\ From d34c06899024bfe95aa3cd56e3e4fc1701a929aa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:32:01 +0100 Subject: [PATCH 452/702] acl,acp,acs --- shell/alias/apt.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index f3c7624..afc1dbd 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -1,20 +1,23 @@ # show package information -alias ac="\ -apt-cache \ -show \ -" +acl() { + apt-cache \ + show \ + "${@}" +} # package versions policy -alias acp="\ -apt-cache \ -policy \ -" +acp() { + apt-cache \ + policy \ + "${@}" +} # search package -alias acs="\ -apt-cache \ -search \ -" +acs() { + apt-cache \ + search \ + "${@}" +} # agap() { From 29ac7232426bb20a991a6327294595893ef20bfd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:32:58 +0100 Subject: [PATCH 453/702] agc --- shell/alias/apt.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index afc1dbd..8ce8252 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -34,10 +34,11 @@ agar() { } # clean packages cache -alias agc="\ -apt-get \ -clean \ -" +agc() { + apt-get \ + clean \ + "${@}" +} # upgrade allowing package installation or removal alias agdu="\ From df71c07296b14cc4ad60e7d756c79a59b60e6ed7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:42:34 +0100 Subject: [PATCH 454/702] l --- shell/alias/ls.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/shell/alias/ls.sh b/shell/alias/ls.sh index b6d3204..75eb5a5 100644 --- a/shell/alias/ls.sh +++ b/shell/alias/ls.sh @@ -3,11 +3,12 @@ di=0;94\ " # list current directory’s entries -alias l="\ -ls \ ---all \ ---color \ --l \ --p \ ---time-style \"+%Y%m%d-%H%M%S%-:::z\" \ -" +l() { + ls \ + --all \ + --color \ + -l \ + -p \ + --time-style "+%Y%m%d-%H%M%S%-:::z" \ + "${@}" +} From 7918a3c33628d1e89d97b1770e132911b7c4461f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:47:24 +0100 Subject: [PATCH 455/702] lt,ltt --- shell/alias/ls.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell/alias/ls.sh b/shell/alias/ls.sh index 75eb5a5..8be2be0 100644 --- a/shell/alias/ls.sh +++ b/shell/alias/ls.sh @@ -9,6 +9,20 @@ l() { --color \ -l \ -p \ + "${@}" +} + +# list timestamps +lt() { + l \ --time-style "+%Y%m%d-%H%M%S%-:::z" \ "${@}" } + +# list timestamps recent last +ltt() { + l \ + --reverse \ + -t \ + "${@}" +} From bb90ce401be2ea7f3096785dd941916f6ca8e7a3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:50:00 +0100 Subject: [PATCH 456/702] fixes --- shell/alias/ls.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/alias/ls.sh b/shell/alias/ls.sh index 8be2be0..da0d1bc 100644 --- a/shell/alias/ls.sh +++ b/shell/alias/ls.sh @@ -9,6 +9,7 @@ l() { --color \ -l \ -p \ + --time-style "+" \ "${@}" } @@ -21,7 +22,7 @@ lt() { # list timestamps recent last ltt() { - l \ + lt \ --reverse \ -t \ "${@}" From a38610d0e9ada3883d4deef067812d730f426faa Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:55:05 +0100 Subject: [PATCH 457/702] agfu --- shell/alias/apt.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/alias/apt.sh b/shell/alias/apt.sh index 8ce8252..aba5844 100644 --- a/shell/alias/apt.sh +++ b/shell/alias/apt.sh @@ -41,10 +41,11 @@ agc() { } # upgrade allowing package installation or removal -alias agdu="\ -apt-get \ -dist-upgrade \ -" +agfu() { + apt-get \ + full-upgrade \ + "${@}" +} # install packages agi() { From ae0807bf54e84a4a72f02cd33f07be7ac30fe4f8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 03:59:26 +0100 Subject: [PATCH 458/702] remote --- shell/alias/git.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 6dd641e..44d1d62 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -414,8 +414,16 @@ grml() { "${@}" } -# set the location of the remote repository +# show connection to a remote repository grms() { + git \ + remote \ + show \ + "${@}" +} + +# set the location of a remote repository +grmsu() { git \ remote \ set-url \ From a6e05017b7cb5c8cdaff3f6adc03586271a177d8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 13:23:38 +0100 Subject: [PATCH 459/702] gbsu --- shell/alias/git.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 44d1d62..7765adb 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -66,12 +66,13 @@ gbl() { } # set the link to a remote branch from a local branch -gbs() { +git_branch_set_upstream() { git \ branch \ --set-upstream-to \ "${@}" } +gbsu() { git_branch_set_upstream "${@}"; } # redo the last commit with a different message gcam() { From f4b9f4780cb8c8fadec53eeb1397dca2f5408b63 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 13:35:36 +0100 Subject: [PATCH 460/702] wip --- shell/alias/git.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 7765adb..802813e 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -75,16 +75,17 @@ git_branch_set_upstream() { gbsu() { git_branch_set_upstream "${@}"; } # redo the last commit with a different message -gcam() { +git_commit_amend_message() { git \ commit \ --amend \ --message \ "${@}" } +gcam() { git_commit_amend_message "${@}"; } # make a root commit -gcem() { +git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -92,61 +93,69 @@ gcem() { --message \ "${@}" } +gcem() { git_commit_empty_message "${@}"; } # clean untracked files -gcf() { +git_clean_force() { git \ clean \ -d \ --force \ "${@}" } +gcf() { git_clean_force "${@}"; } # commit the index -gcm() { +git_commit_message() { git \ commit \ --message \ "${@}" } +gcm() { git_commit_message "${@}"; } # switch to a branch or checkout file(s) from a commit -gco() { +git_checkout() { git \ checkout \ "${@}" } +gc() { git_checkout "${@}"; } # checkout an orphan branch -gcoo() { +git_checkout_orphan() { git \ checkout \ --orphan \ "${@}" } +gco() { git_checkout_orphan "${@}"; } # pick a commit -gcp() { +git_cherry_pick() { git \ cherry-pick \ "${@}" } +gcp() { git_cherry_pick "${@}"; } # abort the commit pick -gcpa() { +git_cherry_pick_abort() { git \ cherry-pick \ --abort \ "${@}" } +gcpa() { git_cherry_pick_abort "${@}"; } # continue the commit pick -gcpc() { +git_cherry_pick_continue() { git \ cherry-pick \ --continue \ "${@}" } +gcpc() { git_cherry_pick_continue "${@}"; } # configure the user email gcue() { From 1bafe4d3852a2b26aa9f0745c5e09c73ac228a4d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 13:58:39 +0100 Subject: [PATCH 461/702] wip --- shell/alias/git.sh | 54 ++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 802813e..cff9961 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -158,79 +158,88 @@ git_cherry_pick_continue() { gcpc() { git_cherry_pick_continue "${@}"; } # configure the user email -gcue() { +git_config_user_email() { git \ config \ "user.email" \ "${@}" } +gcue() { git_config_user_email "${@}"; } # configure the user name -gcun() { +git_config_user_name() { git \ config \ "user.name" \ "${@}" } +gcun() { git_config_user_name "${@}"; } # differences from last or between commits -gd() { +git_diff() { git \ diff \ "${@}" } +gd() { git_diff "${@}"; } # display what is indexed in cache -gdc() { +git_diff_cached() { git \ diff \ --cached \ "${@}" } +gdc() { git_diff_cached "${@}"; } # indexed character-level differences -gdcw() { +git_diff_cached_word() { git \ diff \ --cached \ --word-diff-regex "." \ "${@}" } +gdcw() { git_diff_cached_word "${@}"; } # differences via external tool -gdt() { +git_diff_tool() { git \ difftool \ --dir-diff \ "${@}" } +gdt() { git_diff_tool "${@}"; } # character-level differences -gdw() { +git_diff_word() { git \ diff \ --word-diff-regex "." \ "${@}" } +gdw() { git_diff_word "${@}"; } # fetch from the remote repository -gf() { +git_fetch() { git \ fetch \ --tags \ --verbose \ "${@}" } +gf() { git_fetch "${@}"; } # fetch from remote repository and prune local orphan branches -gfp() { +git_fetch_prune() { gf \ --prune \ "${@}" } +gfp() { git_fetch_prune "${@}"; } # garbage collect all orphan commits -ggc() { +git_garbage_collect() { git \ reflog \ expire \ @@ -241,24 +250,27 @@ ggc() { --aggressive \ --prune="now" } +ggc() { git_garbage_collect "${@}"; } # initialize a new repository -gi() { +git_init() { git \ init \ "${@}" } +gi() { git_init "${@}"; } # initialize a new bare repository -gib() { +git_init_bare() { git \ init \ --bare \ "${@}" } +gib() { git_init_bare "${@}"; } # log history -gl() { +git_log() { local format="\ %C(auto)%h%d S %C(red)%GS @@ -275,45 +287,51 @@ C %C(blue)%ci --graph \ "${@}" } +gl() { git_log "${@}"; } # log all history -gla() { +git_log_all() { gl \ --all \ "${@}" } +gla() { git_log_all "${@}"; } # log all history with patches -glap() { +git_log_all_patch() { gl \ --all \ --patch \ "${@}" } +glap() { git_log_all_patch "${@}"; } # log history with patches -glp() { +git_log_patch() { gl \ --patch \ "${@}" } +glp() { git_log_patch "${@}"; } # abort the current merge commit -gma() { +git_merge_abort() { git \ merge \ --abort \ "${@}" } +gma() { git_merge_abort "${@}"; } # do a merge commit -gmc() { +git_merge_commit() { git \ merge \ --no-ff \ --message \ "${@}" } +gmc() { git_merge_commit "${@}"; } # fast-forward to remote branch gmf() { From 03d4f4289cd50be38e736df7e25e9a3262d07097 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 13:59:52 +0100 Subject: [PATCH 462/702] gm --- shell/alias/git.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index cff9961..f043683 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -314,6 +314,15 @@ git_log_patch() { } glp() { git_log_patch "${@}"; } +# fast-forward merge to remote branch +git_merge() { + git \ + merge \ + --ff-only \ + "${@}" +} +gm() { git_merge "${@}"; } + # abort the current merge commit git_merge_abort() { git \ @@ -333,14 +342,6 @@ git_merge_commit() { } gmc() { git_merge_commit "${@}"; } -# fast-forward to remote branch -gmf() { - git \ - merge \ - --ff-only \ - "${@}" -} - # squash a branch and index its modifications gms() { git \ From d24113e1b0ed45d451b5c5fb6419d6fc9b6d1a6a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 14:03:22 +0100 Subject: [PATCH 463/702] wip --- shell/alias/git.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index f043683..5bedf14 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -1,61 +1,68 @@ # add to index -ga() { +git_add() { git \ add \ "${@}" } +ga() { git_add "${@}"; } # add all to index -gaa() { +git_add_all() { git \ add \ --all \ "${@}" } +gaa() { git_add_all "${@}"; } # add parts of all to index -gaap() { +git_add_all_patch() { git \ add \ --all \ --patch \ "${@}" } +gaap() { git_add_all_patch "${@}"; } # add parts to index -gap() { +git_add_patch() { git \ add \ --patch \ "${@}" } +gap() { git_add_patch "${@}"; } # create a branch -gb() { +git_branch() { git \ branch \ "${@}" } +gb() { git_branch "${@}"; } # delete a branch -gbd() { +git_branch_delete() { git \ branch \ --delete \ "${@}" } +gbd() { git_branch_delete "${@}"; } # force a branch deletion -gbdf() { +git_branch_delete_force() { git \ branch \ --delete \ --force \ "${@}" } +gbdf() { git_branch_delete_force "${@}"; } # list branches -gbl() { +git_branch_list() { git \ branch \ --all \ @@ -64,6 +71,7 @@ gbl() { --verbose \ "${@}" } +gbl() { git_branch_list "${@}"; } # set the link to a remote branch from a local branch git_branch_set_upstream() { From 941adedabaa1c8f1aa0cd3b4a219f6baad1adcd6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 14:19:41 +0100 Subject: [PATCH 464/702] tasks --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index f303f1f..011ed62 100644 --- a/readme.md +++ b/readme.md @@ -3,6 +3,9 @@ ## ToDo * [ ] convert alias to () +* [ ] git switch signing commits & tags +* [ ] shellcheck & shfmt +* [ ] python tools * [ ] log * [ ] ovh * [ ] clean apt cache after each install/upgrade step From 33a638dbef0d1e1a7d135c0b63bc552d67c9739a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 14:20:55 +0100 Subject: [PATCH 465/702] git --- shell/alias/git.sh | 63 ++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 5bedf14..05609a9 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -351,163 +351,184 @@ git_merge_commit() { gmc() { git_merge_commit "${@}"; } # squash a branch and index its modifications -gms() { +git_merge_squash() { git \ merge \ --squash \ "${@}" } +gms() { git_merge_squash "${@}"; } # merge via external tool -gmt() { +git_merge_tool() { git \ mergetool \ "${@}" } +gmt() { git_merge_tool "${@}"; } # push to the remote repository -gp() { +git_push() { git \ push \ --tags \ --verbose \ "${@}" } +gp() { git_push "${@}"; } # delete from the remote repository -gpd() { +git_push_delete() { git \ push \ --delete \ "${@}" } +gpd() { git_push_delete "${@}"; } # force the push to the remote repository -gpf() { +git_push_force() { gp \ --force \ "${@}" } +gpf() { git_push_force "${@}"; } # rebase current branch onto another -grb() { +git_re_base() { git \ rebase \ "${@}" } +grb() { git_re_base "${@}"; } # abort current rebase -grba() { +git_re_base_abort() { git \ rebase \ --abort \ "${@}" } +grba() { git_re_base_abort "${@}"; } # continue current rebase -grbc() { +git_re_base_continue() { git \ rebase \ --continue \ "${@}" } +grbc() { git_re_base_continue "${@}"; } # force rebase without fast-forward -grbf() { +git_re_base_force() { git \ rebase \ --force-rebase \ "${@}" } +grbf() { git_re_base_force "${@}"; } # rebase interactively -grbi() { +git_re_base_interactive() { git \ rebase \ --interactive \ "${@}" } +grbi() { git_re_base_interactive "${@}"; } # remove and add removal to index -grm() { +git_re_move() { git \ rm \ "${@}" } +grm() { git_re_move "${@}"; } # add a new remote repository -grma() { +git_re_mote_add() { git \ remote \ add \ "${@}" } +grma() { git_re_mote_add "${@}"; } # list remote repositories -grml() { +git_re_mote_list() { git \ remote \ --verbose \ "${@}" } +grml() { git_re_mote_list "${@}"; } # show connection to a remote repository -grms() { +git_re_mote_show() { git \ remote \ show \ "${@}" } +grms() { git_re_mote_show "${@}"; } # set the location of a remote repository -grmsu() { +git_re_mote_set_upstream() { git \ remote \ set-url \ "${@}" } +grmsu() { git_re_mote_set_upstream "${@}"; } # remove file(s) from index or move current branch pointer -grs() { +git_re_set() { git \ reset \ "${@}" } +grs() { git_re_set "${@}"; } # wipe modifications or reset current branch to another commit -grsh() { +git_re_set_hard() { git \ reset \ --hard \ "${@}" } +grsh() { git_re_set_hard "${@}"; } # current state of repository -gs() { +git_status() { git \ status \ --untracked-files="all" \ "${@}" } +gs() { git_status "${@}"; } # show a commit -gsc() { +git_show_commit() { git \ show \ "${@}" } +gsc() { git_show_commit "${@}"; } # tag a commit -gt() { +git_tag() { git \ tag \ "${@}" } +gt() { git_tag "${@}"; } # delete a tag -gtd() { +git_tag_delete() { git \ tag \ --delete \ "${@}" } +gtd() { git_tag_delete "${@}"; } From 797b5659402baf56cb15ed46853cd31ad46e2098 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 15:40:29 +0100 Subject: [PATCH 466/702] =?UTF-8?q?=E2=88=92~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index 226062c..327c956 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -46,4 +46,4 @@ main_source_file() { main_source_file "${ENV}" -main_source_directory ~/shell +main_source_directory "${HOME}/shell" From 237d34eef37c0b8bdba5fd775bdea4d62a4c7a90 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 16:59:22 +0100 Subject: [PATCH 467/702] =?UTF-8?q?=E2=86=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 116 ++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 05609a9..8310385 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -1,21 +1,22 @@ # add to index +ga() { git_add "${@}"; } git_add() { git \ add \ "${@}" } -ga() { git_add "${@}"; } # add all to index +gaa() { git_add_all "${@}"; } git_add_all() { git \ add \ --all \ "${@}" } -gaa() { git_add_all "${@}"; } # add parts of all to index +gaap() { git_add_all_patch "${@}"; } git_add_all_patch() { git \ add \ @@ -23,35 +24,35 @@ git_add_all_patch() { --patch \ "${@}" } -gaap() { git_add_all_patch "${@}"; } # add parts to index +gap() { git_add_patch "${@}"; } git_add_patch() { git \ add \ --patch \ "${@}" } -gap() { git_add_patch "${@}"; } # create a branch +gb() { git_branch "${@}"; } git_branch() { git \ branch \ "${@}" } -gb() { git_branch "${@}"; } # delete a branch +gbd() { git_branch_delete "${@}"; } git_branch_delete() { git \ branch \ --delete \ "${@}" } -gbd() { git_branch_delete "${@}"; } # force a branch deletion +gbdf() { git_branch_delete_force "${@}"; } git_branch_delete_force() { git \ branch \ @@ -59,9 +60,9 @@ git_branch_delete_force() { --force \ "${@}" } -gbdf() { git_branch_delete_force "${@}"; } # list branches +gbl() { git_branch_list "${@}"; } git_branch_list() { git \ branch \ @@ -71,18 +72,18 @@ git_branch_list() { --verbose \ "${@}" } -gbl() { git_branch_list "${@}"; } # set the link to a remote branch from a local branch +gbsu() { git_branch_set_upstream "${@}"; } git_branch_set_upstream() { git \ branch \ --set-upstream-to \ "${@}" } -gbsu() { git_branch_set_upstream "${@}"; } # redo the last commit with a different message +gcam() { git_commit_amend_message "${@}"; } git_commit_amend_message() { git \ commit \ @@ -90,9 +91,9 @@ git_commit_amend_message() { --message \ "${@}" } -gcam() { git_commit_amend_message "${@}"; } # make a root commit +gcem() { git_commit_empty_message "${@}"; } git_commit_empty_message() { git \ commit \ @@ -101,9 +102,9 @@ git_commit_empty_message() { --message \ "${@}" } -gcem() { git_commit_empty_message "${@}"; } # clean untracked files +gcf() { git_clean_force "${@}"; } git_clean_force() { git \ clean \ @@ -111,96 +112,96 @@ git_clean_force() { --force \ "${@}" } -gcf() { git_clean_force "${@}"; } # commit the index +gcm() { git_commit_message "${@}"; } git_commit_message() { git \ commit \ --message \ "${@}" } -gcm() { git_commit_message "${@}"; } # switch to a branch or checkout file(s) from a commit +gc() { git_checkout "${@}"; } git_checkout() { git \ checkout \ "${@}" } -gc() { git_checkout "${@}"; } # checkout an orphan branch +gco() { git_checkout_orphan "${@}"; } git_checkout_orphan() { git \ checkout \ --orphan \ "${@}" } -gco() { git_checkout_orphan "${@}"; } # pick a commit +gcp() { git_cherry_pick "${@}"; } git_cherry_pick() { git \ cherry-pick \ "${@}" } -gcp() { git_cherry_pick "${@}"; } # abort the commit pick +gcpa() { git_cherry_pick_abort "${@}"; } git_cherry_pick_abort() { git \ cherry-pick \ --abort \ "${@}" } -gcpa() { git_cherry_pick_abort "${@}"; } # continue the commit pick +gcpc() { git_cherry_pick_continue "${@}"; } git_cherry_pick_continue() { git \ cherry-pick \ --continue \ "${@}" } -gcpc() { git_cherry_pick_continue "${@}"; } # configure the user email +gcue() { git_config_user_email "${@}"; } git_config_user_email() { git \ config \ "user.email" \ "${@}" } -gcue() { git_config_user_email "${@}"; } # configure the user name +gcun() { git_config_user_name "${@}"; } git_config_user_name() { git \ config \ "user.name" \ "${@}" } -gcun() { git_config_user_name "${@}"; } # differences from last or between commits +gd() { git_diff "${@}"; } git_diff() { git \ diff \ "${@}" } -gd() { git_diff "${@}"; } # display what is indexed in cache +gdc() { git_diff_cached "${@}"; } git_diff_cached() { git \ diff \ --cached \ "${@}" } -gdc() { git_diff_cached "${@}"; } # indexed character-level differences +gdcw() { git_diff_cached_word "${@}"; } git_diff_cached_word() { git \ diff \ @@ -208,27 +209,27 @@ git_diff_cached_word() { --word-diff-regex "." \ "${@}" } -gdcw() { git_diff_cached_word "${@}"; } # differences via external tool +gdt() { git_diff_tool "${@}"; } git_diff_tool() { git \ difftool \ --dir-diff \ "${@}" } -gdt() { git_diff_tool "${@}"; } # character-level differences +gdw() { git_diff_word "${@}"; } git_diff_word() { git \ diff \ --word-diff-regex "." \ "${@}" } -gdw() { git_diff_word "${@}"; } # fetch from the remote repository +gf() { git_fetch "${@}"; } git_fetch() { git \ fetch \ @@ -236,17 +237,17 @@ git_fetch() { --verbose \ "${@}" } -gf() { git_fetch "${@}"; } # fetch from remote repository and prune local orphan branches +gfp() { git_fetch_prune "${@}"; } git_fetch_prune() { gf \ --prune \ "${@}" } -gfp() { git_fetch_prune "${@}"; } # garbage collect all orphan commits +ggc() { git_garbage_collect "${@}"; } git_garbage_collect() { git \ reflog \ @@ -258,26 +259,26 @@ git_garbage_collect() { --aggressive \ --prune="now" } -ggc() { git_garbage_collect "${@}"; } # initialize a new repository +gi() { git_init "${@}"; } git_init() { git \ init \ "${@}" } -gi() { git_init "${@}"; } # initialize a new bare repository +gib() { git_init_bare "${@}"; } git_init_bare() { git \ init \ --bare \ "${@}" } -gib() { git_init_bare "${@}"; } # log history +gl() { git_log "${@}"; } git_log() { local format="\ %C(auto)%h%d @@ -295,52 +296,52 @@ C %C(blue)%ci --graph \ "${@}" } -gl() { git_log "${@}"; } # log all history +gla() { git_log_all "${@}"; } git_log_all() { gl \ --all \ "${@}" } -gla() { git_log_all "${@}"; } # log all history with patches +glap() { git_log_all_patch "${@}"; } git_log_all_patch() { gl \ --all \ --patch \ "${@}" } -glap() { git_log_all_patch "${@}"; } # log history with patches +glp() { git_log_patch "${@}"; } git_log_patch() { gl \ --patch \ "${@}" } -glp() { git_log_patch "${@}"; } # fast-forward merge to remote branch +gm() { git_merge "${@}"; } git_merge() { git \ merge \ --ff-only \ "${@}" } -gm() { git_merge "${@}"; } # abort the current merge commit +gma() { git_merge_abort "${@}"; } git_merge_abort() { git \ merge \ --abort \ "${@}" } -gma() { git_merge_abort "${@}"; } # do a merge commit +gmc() { git_merge_commit "${@}"; } git_merge_commit() { git \ merge \ @@ -348,26 +349,26 @@ git_merge_commit() { --message \ "${@}" } -gmc() { git_merge_commit "${@}"; } # squash a branch and index its modifications +gms() { git_merge_squash "${@}"; } git_merge_squash() { git \ merge \ --squash \ "${@}" } -gms() { git_merge_squash "${@}"; } # merge via external tool +gmt() { git_merge_tool "${@}"; } git_merge_tool() { git \ mergetool \ "${@}" } -gmt() { git_merge_tool "${@}"; } # push to the remote repository +gp() { git_push "${@}"; } git_push() { git \ push \ @@ -375,160 +376,159 @@ git_push() { --verbose \ "${@}" } -gp() { git_push "${@}"; } # delete from the remote repository +gpd() { git_push_delete "${@}"; } git_push_delete() { git \ push \ --delete \ "${@}" } -gpd() { git_push_delete "${@}"; } # force the push to the remote repository +gpf() { git_push_force "${@}"; } git_push_force() { gp \ --force \ "${@}" } -gpf() { git_push_force "${@}"; } # rebase current branch onto another +grb() { git_re_base "${@}"; } git_re_base() { git \ rebase \ "${@}" } -grb() { git_re_base "${@}"; } # abort current rebase +grba() { git_re_base_abort "${@}"; } git_re_base_abort() { git \ rebase \ --abort \ "${@}" } -grba() { git_re_base_abort "${@}"; } # continue current rebase +grbc() { git_re_base_continue "${@}"; } git_re_base_continue() { git \ rebase \ --continue \ "${@}" } -grbc() { git_re_base_continue "${@}"; } # force rebase without fast-forward +grbf() { git_re_base_force "${@}"; } git_re_base_force() { git \ rebase \ --force-rebase \ "${@}" } -grbf() { git_re_base_force "${@}"; } # rebase interactively +grbi() { git_re_base_interactive "${@}"; } git_re_base_interactive() { git \ rebase \ --interactive \ "${@}" } -grbi() { git_re_base_interactive "${@}"; } # remove and add removal to index +grm() { git_re_move "${@}"; } git_re_move() { git \ rm \ "${@}" } -grm() { git_re_move "${@}"; } # add a new remote repository +grma() { git_re_mote_add "${@}"; } git_re_mote_add() { git \ remote \ add \ "${@}" } -grma() { git_re_mote_add "${@}"; } # list remote repositories +grml() { git_re_mote_list "${@}"; } git_re_mote_list() { git \ remote \ --verbose \ "${@}" } -grml() { git_re_mote_list "${@}"; } # show connection to a remote repository +grms() { git_re_mote_show "${@}"; } git_re_mote_show() { git \ remote \ show \ "${@}" } -grms() { git_re_mote_show "${@}"; } # set the location of a remote repository +grmsu() { git_re_mote_set_upstream "${@}"; } git_re_mote_set_upstream() { git \ remote \ set-url \ "${@}" } -grmsu() { git_re_mote_set_upstream "${@}"; } # remove file(s) from index or move current branch pointer +grs() { git_re_set "${@}"; } git_re_set() { git \ reset \ "${@}" } -grs() { git_re_set "${@}"; } # wipe modifications or reset current branch to another commit +grsh() { git_re_set_hard "${@}"; } git_re_set_hard() { git \ reset \ --hard \ "${@}" } -grsh() { git_re_set_hard "${@}"; } # current state of repository +gs() { git_status "${@}"; } git_status() { git \ status \ --untracked-files="all" \ "${@}" } -gs() { git_status "${@}"; } # show a commit +gsc() { git_show_commit "${@}"; } git_show_commit() { git \ show \ "${@}" } -gsc() { git_show_commit "${@}"; } # tag a commit +gt() { git_tag "${@}"; } git_tag() { git \ tag \ "${@}" } -gt() { git_tag "${@}"; } # delete a tag +gtd() { git_tag_delete "${@}"; } git_tag_delete() { git \ tag \ --delete \ "${@}" } -gtd() { git_tag_delete "${@}"; } From a9fa61d7a85785b500b9d14a4b36999e11fea60e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:02:03 +0100 Subject: [PATCH 468/702] clean --- shell/alias/git.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 8310385..04719c1 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -82,6 +82,16 @@ git_branch_set_upstream() { "${@}" } +# clean untracked files +gcf() { git_clean_force "${@}"; } +git_clean_force() { + git \ + clean \ + -d \ + --force \ + "${@}" +} + # redo the last commit with a different message gcam() { git_commit_amend_message "${@}"; } git_commit_amend_message() { @@ -103,16 +113,6 @@ git_commit_empty_message() { "${@}" } -# clean untracked files -gcf() { git_clean_force "${@}"; } -git_clean_force() { - git \ - clean \ - -d \ - --force \ - "${@}" -} - # commit the index gcm() { git_commit_message "${@}"; } git_commit_message() { From cfd529a5d8f8dab3cf1490ae270300b021f27e53 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:03:30 +0100 Subject: [PATCH 469/702] rm --- shell/alias/git.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 04719c1..9a423ac 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -438,14 +438,6 @@ git_re_base_interactive() { "${@}" } -# remove and add removal to index -grm() { git_re_move "${@}"; } -git_re_move() { - git \ - rm \ - "${@}" -} - # add a new remote repository grma() { git_re_mote_add "${@}"; } git_re_mote_add() { @@ -482,6 +474,14 @@ git_re_mote_set_upstream() { "${@}" } +# remove and add removal to index +grm() { git_re_move "${@}"; } +git_re_move() { + git \ + rm \ + "${@}" +} + # remove file(s) from index or move current branch pointer grs() { git_re_set "${@}"; } git_re_set() { From 975382a359a68676dbb7611692c0daa9e836ef43 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:05:44 +0100 Subject: [PATCH 470/702] =?UTF-8?q?=E2=86=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 80 +++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 9a423ac..df627b8 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -82,46 +82,6 @@ git_branch_set_upstream() { "${@}" } -# clean untracked files -gcf() { git_clean_force "${@}"; } -git_clean_force() { - git \ - clean \ - -d \ - --force \ - "${@}" -} - -# redo the last commit with a different message -gcam() { git_commit_amend_message "${@}"; } -git_commit_amend_message() { - git \ - commit \ - --amend \ - --message \ - "${@}" -} - -# make a root commit -gcem() { git_commit_empty_message "${@}"; } -git_commit_empty_message() { - git \ - commit \ - --allow-empty \ - --allow-empty-message \ - --message \ - "${@}" -} - -# commit the index -gcm() { git_commit_message "${@}"; } -git_commit_message() { - git \ - commit \ - --message \ - "${@}" -} - # switch to a branch or checkout file(s) from a commit gc() { git_checkout "${@}"; } git_checkout() { @@ -165,6 +125,46 @@ git_cherry_pick_continue() { "${@}" } +# clean untracked files +gcf() { git_clean_force "${@}"; } +git_clean_force() { + git \ + clean \ + -d \ + --force \ + "${@}" +} + +# redo the last commit with a different message +gcam() { git_commit_amend_message "${@}"; } +git_commit_amend_message() { + git \ + commit \ + --amend \ + --message \ + "${@}" +} + +# make a root commit +gcem() { git_commit_empty_message "${@}"; } +git_commit_empty_message() { + git \ + commit \ + --allow-empty \ + --allow-empty-message \ + --message \ + "${@}" +} + +# commit the index +gcm() { git_commit_message "${@}"; } +git_commit_message() { + git \ + commit \ + --message \ + "${@}" +} + # configure the user email gcue() { git_config_user_email "${@}"; } git_config_user_email() { From dcef6d2d626f94d9e03278ff17b03081b4ca440f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:08:46 +0100 Subject: [PATCH 471/702] =?UTF-8?q?=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index df627b8..eaa83a6 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -456,15 +456,6 @@ git_re_mote_list() { "${@}" } -# show connection to a remote repository -grms() { git_re_mote_show "${@}"; } -git_re_mote_show() { - git \ - remote \ - show \ - "${@}" -} - # set the location of a remote repository grmsu() { git_re_mote_set_upstream "${@}"; } git_re_mote_set_upstream() { @@ -474,6 +465,15 @@ git_re_mote_set_upstream() { "${@}" } +# show connection to a remote repository +grms() { git_re_mote_show "${@}"; } +git_re_mote_show() { + git \ + remote \ + show \ + "${@}" +} + # remove and add removal to index grm() { git_re_move "${@}"; } git_re_move() { @@ -499,6 +499,14 @@ git_re_set_hard() { "${@}" } +# show a commit +gsc() { git_show_commit "${@}"; } +git_show_commit() { + git \ + show \ + "${@}" +} + # current state of repository gs() { git_status "${@}"; } git_status() { @@ -508,14 +516,6 @@ git_status() { "${@}" } -# show a commit -gsc() { git_show_commit "${@}"; } -git_show_commit() { - git \ - show \ - "${@}" -} - # tag a commit gt() { git_tag "${@}"; } git_tag() { From bbff4013f357c6aef0cbfda5755872217eedfbcc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:14:15 +0100 Subject: [PATCH 472/702] functions --- shell/alias/git.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index eaa83a6..628799a 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -241,7 +241,7 @@ git_fetch() { # fetch from remote repository and prune local orphan branches gfp() { git_fetch_prune "${@}"; } git_fetch_prune() { - gf \ + git_fetch \ --prune \ "${@}" } @@ -300,7 +300,7 @@ C %C(blue)%ci # log all history gla() { git_log_all "${@}"; } git_log_all() { - gl \ + git_log \ --all \ "${@}" } @@ -308,7 +308,7 @@ git_log_all() { # log all history with patches glap() { git_log_all_patch "${@}"; } git_log_all_patch() { - gl \ + git_log \ --all \ --patch \ "${@}" @@ -317,7 +317,7 @@ git_log_all_patch() { # log history with patches glp() { git_log_patch "${@}"; } git_log_patch() { - gl \ + git_log \ --patch \ "${@}" } @@ -389,7 +389,7 @@ git_push_delete() { # force the push to the remote repository gpf() { git_push_force "${@}"; } git_push_force() { - gp \ + git_push \ --force \ "${@}" } From 18e2154931cda64cf6f3ed7added01b2fbcd1c0b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:15:47 +0100 Subject: [PATCH 473/702] format --- shell/alias/git.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index 628799a..eb72938 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -1,3 +1,12 @@ +GIT_LOG_FORMAT="\ +%C(auto)%h%d +S %C(red)%GS +A %C(green)%ai + %C(green)%an %ae +C %C(blue)%ci + %C(blue)%cn %ce +%B" + # add to index ga() { git_add "${@}"; } git_add() { @@ -280,19 +289,11 @@ git_init_bare() { # log history gl() { git_log "${@}"; } git_log() { - local format="\ -%C(auto)%h%d -S %C(red)%GS -A %C(green)%ai - %C(green)%an %ae -C %C(blue)%ci - %C(blue)%cn %ce -%B" git \ log \ --abbrev=8 \ --abbrev-commit \ - --format="${format}" \ + --format="${GIT_LOG_FORMAT}" \ --graph \ "${@}" } From 7363e51f4ee2b69592d1997fabe380c6bfa4eda7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:18:36 +0100 Subject: [PATCH 474/702] gpg --- shell/alias/gpg.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/alias/gpg.sh b/shell/alias/gpg.sh index 4c1d4e5..d971cab 100644 --- a/shell/alias/gpg.sh +++ b/shell/alias/gpg.sh @@ -1,11 +1,13 @@ # turn gpg agent off -gak() { +gak() { gpg_agent_kill "${@}"; } +gpg_agent_kill() { gpgconf \ --kill "gpg-agent" } # bind gpg agent to current tty -gau() { +gau() { gpg_agent_update "${@}"; } +gpg_agent_update() { gpg-connect-agent \ updatestartuptty \ /bye From cb3c7de6415ac7d92a08c0bd08964521d3e0e725 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:24:17 +0100 Subject: [PATCH 475/702] =?UTF-8?q?=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/alias/git.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/alias/git.sh b/shell/alias/git.sh index eb72938..9e84251 100644 --- a/shell/alias/git.sh +++ b/shell/alias/git.sh @@ -1,10 +1,10 @@ GIT_LOG_FORMAT="\ %C(auto)%h%d S %C(red)%GS -A %C(green)%ai - %C(green)%an %ae -C %C(blue)%ci - %C(blue)%cn %ce +A %C(green)%an %ae + %C(green)%ai +C %C(blue)%cn %ce + %C(blue)%ci %B" # add to index From 93a9ed20d50e1d11e6047a1eee71f7bec39211f0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:28:52 +0100 Subject: [PATCH 476/702] gpg --- shell/alias/gpg.sh | 14 -------------- shell/gpg.sh | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 shell/alias/gpg.sh diff --git a/shell/alias/gpg.sh b/shell/alias/gpg.sh deleted file mode 100644 index d971cab..0000000 --- a/shell/alias/gpg.sh +++ /dev/null @@ -1,14 +0,0 @@ -# turn gpg agent off -gak() { gpg_agent_kill "${@}"; } -gpg_agent_kill() { - gpgconf \ - --kill "gpg-agent" -} - -# bind gpg agent to current tty -gau() { gpg_agent_update "${@}"; } -gpg_agent_update() { - gpg-connect-agent \ - updatestartuptty \ - /bye -} diff --git a/shell/gpg.sh b/shell/gpg.sh index f9d6ef6..e4ebb38 100644 --- a/shell/gpg.sh +++ b/shell/gpg.sh @@ -1,3 +1,18 @@ +# turn gpg agent off +gak() { gpg_agent_kill "${@}"; } +gpg_agent_kill() { + gpgconf \ + --kill "gpg-agent" +} + +# bind gpg agent to current tty +gau() { gpg_agent_update "${@}"; } +gpg_agent_update() { + gpg-connect-agent \ + updatestartuptty \ + /bye +} + gpg_ssh() { local user_id user_id=$(id --user) From 049eaaff6ff8051be1423e8fd3997ad9904ddb34 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:29:15 +0100 Subject: [PATCH 477/702] git --- shell/{alias => }/git.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename shell/{alias => }/git.sh (100%) diff --git a/shell/alias/git.sh b/shell/git.sh similarity index 100% rename from shell/alias/git.sh rename to shell/git.sh From 9b05b663da73d6801a1d201743c50d41cad4fb49 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:36:25 +0100 Subject: [PATCH 478/702] shell --- shell/alias/shell.sh | 32 -------------------------------- shell/shell.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 32 deletions(-) delete mode 100644 shell/alias/shell.sh diff --git a/shell/alias/shell.sh b/shell/alias/shell.sh deleted file mode 100644 index 531b4b0..0000000 --- a/shell/alias/shell.sh +++ /dev/null @@ -1,32 +0,0 @@ -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} - -# shellcheck disable=SC2154 -[ "${SH}" = "bash" ] || return - -# back - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -} diff --git a/shell/shell.sh b/shell/shell.sh index c25ab55..bfb6b98 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -110,3 +110,34 @@ shell_setup() { rm --force --recursive "${file}" ln --symbolic "${ENV}" "${file}" } + +# shorten alias +a() { + alias \ + "${@}" +} + +# swap directory (current ↔ previous) +sd() { + cd \ + - || + return +} + +# exit terminal +x() { + exit \ + "${@}" +} + +# shellcheck disable=SC2154 +[ "${SH}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} From 3d5e4f5a68c404823abe95fa1c5100ca58a71af3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 17:40:02 +0100 Subject: [PATCH 479/702] sh --- shell/main.sh | 3 --- shell/shell.sh | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index 327c956..85888e7 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,8 +1,5 @@ [ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" -SH="$(cat /proc/$$/comm)" -export SH - main_source_directory() { local path="${1}" if [ -d "${path}" ]; then diff --git a/shell/shell.sh b/shell/shell.sh index bfb6b98..00174fc 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,10 +1,10 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " +SH="$(cat /proc/$$/comm)" shell_color() { local code="${1}" - # shellcheck disable=SC2154 case "${SH}" in "bash") printf "\x01\e[0" @@ -130,7 +130,6 @@ x() { "${@}" } -# shellcheck disable=SC2154 [ "${SH}" = "bash" ] || return # shellcheck disable=SC3033 From dcde6ddbc9e7722e3edcf7e6b694e7dfbde206a1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 18:11:25 +0100 Subject: [PATCH 480/702] commands --- shell/main.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index 85888e7..e41bdf9 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,9 +1,15 @@ [ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" +main_commands() { + local file="${1}" + grep "{\$" "${file}" | + cut --delimiter "(" --fields 1 +} + main_source_directory() { local path="${1}" if [ -d "${path}" ]; then - local count ifs module modules + local cmd count ifs module modules modules="$(find "${path}" \ -type "f" \ -name "*.sh" \ @@ -22,9 +28,14 @@ main_source_directory() { module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then . "${module}" + cmd="$(main_commands "${module}")" + [ -n "${cmd}" ] && CMD="${CMD} +${cmd}" fi done IFS="${ifs}" + log_info + log_info "${CMD}" else echo "Not a directory: ${path}" return 1 From 8262f7c5d0b50ef8d9cba1a65df1ed824ad56efb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 18:17:06 +0100 Subject: [PATCH 481/702] cmd --- shell/main.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/main.sh b/shell/main.sh index e41bdf9..37dfdfc 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -29,8 +29,11 @@ main_source_directory() { if [ "${module}" != "${ENV}" ]; then . "${module}" cmd="$(main_commands "${module}")" - [ -n "${cmd}" ] && CMD="${CMD} -${cmd}" + if [ -n "${cmd}" ]; then + [ -n "${CMD}" ] && CMD="${CMD} +" + CMD="${CMD}${cmd}" + fi fi done IFS="${ifs}" From 20f4af36d0cda8a54323fb62119aff624d1740f2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 18:49:04 +0100 Subject: [PATCH 482/702] completions/git --- shell/shell.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 00174fc..0813560 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -35,10 +35,14 @@ shell_configure() { case "${SH}" in "bash") # completion - local file="/usr/share/bash-completion/bash_completion" - if [ -f "${file}" ]; then - . "${file}" - fi + local root="/usr/share/bash-completion" + local file path + for file in "bash_completion" "completions/git"; do + path="${root}/${file}" + if [ -f "${path}" ]; then + . "${path}" + fi + done # history HISTCONTROL="ignorespace" HISTSIZE=-1 From 982a81adbe2536cb9d80d2d6cab77f3d13881b47 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 19:10:18 +0100 Subject: [PATCH 483/702] 1line --- shell/shell.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 0813560..cb4557c 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -39,9 +39,7 @@ shell_configure() { local file path for file in "bash_completion" "completions/git"; do path="${root}/${file}" - if [ -f "${path}" ]; then - . "${path}" - fi + [ -f "${path}" ] && . "${path}" done # history HISTCONTROL="ignorespace" From 44c771534a35e9a8589045ba964c0108540985db Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 19:23:24 +0100 Subject: [PATCH 484/702] set --- shell/shell.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index cb4557c..5676d0d 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -36,11 +36,19 @@ shell_configure() { "bash") # completion local root="/usr/share/bash-completion" - local file path - for file in "bash_completion" "completions/git"; do - path="${root}/${file}" - [ -f "${path}" ] && . "${path}" - done + local file="bash_completion" + local path="${root}/${file}" + [ -f "${path}" ] && . "${path}" + root="${root}/completions" + if [ -d "${root}" ]; then + set \ + "git" \ + "tar" + for file in "${@}"; do + path="${root}/${file}" + [ -f "${path}" ] && . "${path}" + done + fi # history HISTCONTROL="ignorespace" HISTSIZE=-1 From 808d0dc0642c0cc73e180d800f07d16a8590d785 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 19:34:08 +0100 Subject: [PATCH 485/702] nb --- shell/alias/newsboat.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/alias/newsboat.sh b/shell/alias/newsboat.sh index c877906..adbfd37 100644 --- a/shell/alias/newsboat.sh +++ b/shell/alias/newsboat.sh @@ -1,4 +1,5 @@ -nb() { +nb() { news_boat "${@}"; } +news_boat() { newsboat \ "${@}" } From 0d3d0bc21136de394a89becdb09e37bfcb729be4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 21:46:01 +0100 Subject: [PATCH 486/702] () --- shell/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index 37dfdfc..5fe13d8 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -2,7 +2,7 @@ main_commands() { local file="${1}" - grep "{\$" "${file}" | + grep "()" "${file}" | cut --delimiter "(" --fields 1 } From 12515e62844e864154b2dd19f973a0ad310ddd40 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 22:04:36 +0100 Subject: [PATCH 487/702] rsdb --- shell/alias/rsync.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/alias/rsync.sh b/shell/alias/rsync.sh index a5efc09..7a94aac 100644 --- a/shell/alias/rsync.sh +++ b/shell/alias/rsync.sh @@ -23,7 +23,8 @@ rsda() { } # synchronize and delete before -rsdb() { +rsdb() { r_sync_delete_before "${@}"; } +r_sync_delete_before() { rsb \ --delete-before \ "${@}" From 1084edee23a234eabcf97e90eb3be49ebcafd673 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 22:27:05 +0100 Subject: [PATCH 488/702] env --- shell/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/main.sh b/shell/main.sh index 5fe13d8..902c7f8 100644 --- a/shell/main.sh +++ b/shell/main.sh @@ -1,4 +1,4 @@ -[ -n "${ENV}" ] || export ENV="/etc/shell/main.sh" +[ -n "${ENV}" ] || export ENV="/etc/sh/main.sh" main_commands() { local file="${1}" From 02a743fc1bbc5e7adbaaf09807eab7f8fd318280 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 22:27:38 +0100 Subject: [PATCH 489/702] sh --- {shell => sh}/.shellcheckrc | 0 {shell => sh}/alias/apt.sh | 0 {shell => sh}/alias/batcat.sh | 0 {shell => sh}/alias/btrfs.sh | 0 {shell => sh}/alias/byobu.sh | 0 {shell => sh}/alias/chmod.sh | 0 {shell => sh}/alias/chown.sh | 0 {shell => sh}/alias/clear.sh | 0 {shell => sh}/alias/cp.sh | 0 {shell => sh}/alias/emacs.sh | 0 {shell => sh}/alias/evince.sh | 0 {shell => sh}/alias/grep.sh | 0 {shell => sh}/alias/kill.sh | 0 {shell => sh}/alias/killall.sh | 0 {shell => sh}/alias/ls.sh | 0 {shell => sh}/alias/lsblk.sh | 0 {shell => sh}/alias/mkdir.sh | 0 {shell => sh}/alias/mount.sh | 0 {shell => sh}/alias/mv.sh | 0 {shell => sh}/alias/nano.sh | 0 {shell => sh}/alias/newsboat.sh | 0 {shell => sh}/alias/pass.sh | 0 {shell => sh}/alias/ps.sh | 0 {shell => sh}/alias/pwgen.sh | 0 {shell => sh}/alias/rm.sh | 0 {shell => sh}/alias/rsync.sh | 0 {shell => sh}/alias/tar.sh | 0 {shell => sh}/alias/tmux.sh | 0 {shell => sh}/alias/tree.sh | 0 {shell => sh}/btrfs.sh | 0 {shell => sh}/debian.sh | 0 {shell => sh}/fs.sh | 0 {shell => sh}/git.sh | 0 {shell => sh}/gpg.sh | 0 {shell => sh}/gsettings.sh | 0 {shell => sh}/log.sh | 0 {shell => sh}/main.sh | 0 {shell => sh}/mount-lxc.sh | 0 {shell => sh}/mount.sh | 0 {shell => sh}/proxy.sh | 0 {shell => sh}/rescue/common.sh | 0 {shell => sh}/rescue/hetzner.sh | 0 {shell => sh}/rescue/ovh.sh | 0 {shell => sh}/shell.sh | 0 {shell => sh}/util.sh | 0 45 files changed, 0 insertions(+), 0 deletions(-) rename {shell => sh}/.shellcheckrc (100%) rename {shell => sh}/alias/apt.sh (100%) rename {shell => sh}/alias/batcat.sh (100%) rename {shell => sh}/alias/btrfs.sh (100%) rename {shell => sh}/alias/byobu.sh (100%) rename {shell => sh}/alias/chmod.sh (100%) rename {shell => sh}/alias/chown.sh (100%) rename {shell => sh}/alias/clear.sh (100%) rename {shell => sh}/alias/cp.sh (100%) rename {shell => sh}/alias/emacs.sh (100%) rename {shell => sh}/alias/evince.sh (100%) rename {shell => sh}/alias/grep.sh (100%) rename {shell => sh}/alias/kill.sh (100%) rename {shell => sh}/alias/killall.sh (100%) rename {shell => sh}/alias/ls.sh (100%) rename {shell => sh}/alias/lsblk.sh (100%) rename {shell => sh}/alias/mkdir.sh (100%) rename {shell => sh}/alias/mount.sh (100%) rename {shell => sh}/alias/mv.sh (100%) rename {shell => sh}/alias/nano.sh (100%) rename {shell => sh}/alias/newsboat.sh (100%) rename {shell => sh}/alias/pass.sh (100%) rename {shell => sh}/alias/ps.sh (100%) rename {shell => sh}/alias/pwgen.sh (100%) rename {shell => sh}/alias/rm.sh (100%) rename {shell => sh}/alias/rsync.sh (100%) rename {shell => sh}/alias/tar.sh (100%) rename {shell => sh}/alias/tmux.sh (100%) rename {shell => sh}/alias/tree.sh (100%) rename {shell => sh}/btrfs.sh (100%) rename {shell => sh}/debian.sh (100%) rename {shell => sh}/fs.sh (100%) rename {shell => sh}/git.sh (100%) rename {shell => sh}/gpg.sh (100%) rename {shell => sh}/gsettings.sh (100%) rename {shell => sh}/log.sh (100%) rename {shell => sh}/main.sh (100%) rename {shell => sh}/mount-lxc.sh (100%) rename {shell => sh}/mount.sh (100%) rename {shell => sh}/proxy.sh (100%) rename {shell => sh}/rescue/common.sh (100%) rename {shell => sh}/rescue/hetzner.sh (100%) rename {shell => sh}/rescue/ovh.sh (100%) rename {shell => sh}/shell.sh (100%) rename {shell => sh}/util.sh (100%) diff --git a/shell/.shellcheckrc b/sh/.shellcheckrc similarity index 100% rename from shell/.shellcheckrc rename to sh/.shellcheckrc diff --git a/shell/alias/apt.sh b/sh/alias/apt.sh similarity index 100% rename from shell/alias/apt.sh rename to sh/alias/apt.sh diff --git a/shell/alias/batcat.sh b/sh/alias/batcat.sh similarity index 100% rename from shell/alias/batcat.sh rename to sh/alias/batcat.sh diff --git a/shell/alias/btrfs.sh b/sh/alias/btrfs.sh similarity index 100% rename from shell/alias/btrfs.sh rename to sh/alias/btrfs.sh diff --git a/shell/alias/byobu.sh b/sh/alias/byobu.sh similarity index 100% rename from shell/alias/byobu.sh rename to sh/alias/byobu.sh diff --git a/shell/alias/chmod.sh b/sh/alias/chmod.sh similarity index 100% rename from shell/alias/chmod.sh rename to sh/alias/chmod.sh diff --git a/shell/alias/chown.sh b/sh/alias/chown.sh similarity index 100% rename from shell/alias/chown.sh rename to sh/alias/chown.sh diff --git a/shell/alias/clear.sh b/sh/alias/clear.sh similarity index 100% rename from shell/alias/clear.sh rename to sh/alias/clear.sh diff --git a/shell/alias/cp.sh b/sh/alias/cp.sh similarity index 100% rename from shell/alias/cp.sh rename to sh/alias/cp.sh diff --git a/shell/alias/emacs.sh b/sh/alias/emacs.sh similarity index 100% rename from shell/alias/emacs.sh rename to sh/alias/emacs.sh diff --git a/shell/alias/evince.sh b/sh/alias/evince.sh similarity index 100% rename from shell/alias/evince.sh rename to sh/alias/evince.sh diff --git a/shell/alias/grep.sh b/sh/alias/grep.sh similarity index 100% rename from shell/alias/grep.sh rename to sh/alias/grep.sh diff --git a/shell/alias/kill.sh b/sh/alias/kill.sh similarity index 100% rename from shell/alias/kill.sh rename to sh/alias/kill.sh diff --git a/shell/alias/killall.sh b/sh/alias/killall.sh similarity index 100% rename from shell/alias/killall.sh rename to sh/alias/killall.sh diff --git a/shell/alias/ls.sh b/sh/alias/ls.sh similarity index 100% rename from shell/alias/ls.sh rename to sh/alias/ls.sh diff --git a/shell/alias/lsblk.sh b/sh/alias/lsblk.sh similarity index 100% rename from shell/alias/lsblk.sh rename to sh/alias/lsblk.sh diff --git a/shell/alias/mkdir.sh b/sh/alias/mkdir.sh similarity index 100% rename from shell/alias/mkdir.sh rename to sh/alias/mkdir.sh diff --git a/shell/alias/mount.sh b/sh/alias/mount.sh similarity index 100% rename from shell/alias/mount.sh rename to sh/alias/mount.sh diff --git a/shell/alias/mv.sh b/sh/alias/mv.sh similarity index 100% rename from shell/alias/mv.sh rename to sh/alias/mv.sh diff --git a/shell/alias/nano.sh b/sh/alias/nano.sh similarity index 100% rename from shell/alias/nano.sh rename to sh/alias/nano.sh diff --git a/shell/alias/newsboat.sh b/sh/alias/newsboat.sh similarity index 100% rename from shell/alias/newsboat.sh rename to sh/alias/newsboat.sh diff --git a/shell/alias/pass.sh b/sh/alias/pass.sh similarity index 100% rename from shell/alias/pass.sh rename to sh/alias/pass.sh diff --git a/shell/alias/ps.sh b/sh/alias/ps.sh similarity index 100% rename from shell/alias/ps.sh rename to sh/alias/ps.sh diff --git a/shell/alias/pwgen.sh b/sh/alias/pwgen.sh similarity index 100% rename from shell/alias/pwgen.sh rename to sh/alias/pwgen.sh diff --git a/shell/alias/rm.sh b/sh/alias/rm.sh similarity index 100% rename from shell/alias/rm.sh rename to sh/alias/rm.sh diff --git a/shell/alias/rsync.sh b/sh/alias/rsync.sh similarity index 100% rename from shell/alias/rsync.sh rename to sh/alias/rsync.sh diff --git a/shell/alias/tar.sh b/sh/alias/tar.sh similarity index 100% rename from shell/alias/tar.sh rename to sh/alias/tar.sh diff --git a/shell/alias/tmux.sh b/sh/alias/tmux.sh similarity index 100% rename from shell/alias/tmux.sh rename to sh/alias/tmux.sh diff --git a/shell/alias/tree.sh b/sh/alias/tree.sh similarity index 100% rename from shell/alias/tree.sh rename to sh/alias/tree.sh diff --git a/shell/btrfs.sh b/sh/btrfs.sh similarity index 100% rename from shell/btrfs.sh rename to sh/btrfs.sh diff --git a/shell/debian.sh b/sh/debian.sh similarity index 100% rename from shell/debian.sh rename to sh/debian.sh diff --git a/shell/fs.sh b/sh/fs.sh similarity index 100% rename from shell/fs.sh rename to sh/fs.sh diff --git a/shell/git.sh b/sh/git.sh similarity index 100% rename from shell/git.sh rename to sh/git.sh diff --git a/shell/gpg.sh b/sh/gpg.sh similarity index 100% rename from shell/gpg.sh rename to sh/gpg.sh diff --git a/shell/gsettings.sh b/sh/gsettings.sh similarity index 100% rename from shell/gsettings.sh rename to sh/gsettings.sh diff --git a/shell/log.sh b/sh/log.sh similarity index 100% rename from shell/log.sh rename to sh/log.sh diff --git a/shell/main.sh b/sh/main.sh similarity index 100% rename from shell/main.sh rename to sh/main.sh diff --git a/shell/mount-lxc.sh b/sh/mount-lxc.sh similarity index 100% rename from shell/mount-lxc.sh rename to sh/mount-lxc.sh diff --git a/shell/mount.sh b/sh/mount.sh similarity index 100% rename from shell/mount.sh rename to sh/mount.sh diff --git a/shell/proxy.sh b/sh/proxy.sh similarity index 100% rename from shell/proxy.sh rename to sh/proxy.sh diff --git a/shell/rescue/common.sh b/sh/rescue/common.sh similarity index 100% rename from shell/rescue/common.sh rename to sh/rescue/common.sh diff --git a/shell/rescue/hetzner.sh b/sh/rescue/hetzner.sh similarity index 100% rename from shell/rescue/hetzner.sh rename to sh/rescue/hetzner.sh diff --git a/shell/rescue/ovh.sh b/sh/rescue/ovh.sh similarity index 100% rename from shell/rescue/ovh.sh rename to sh/rescue/ovh.sh diff --git a/shell/shell.sh b/sh/shell.sh similarity index 100% rename from shell/shell.sh rename to sh/shell.sh diff --git a/shell/util.sh b/sh/util.sh similarity index 100% rename from shell/util.sh rename to sh/util.sh From 9910b4786b67b083e2936df79373ecd6de39e5b5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 22:28:07 +0100 Subject: [PATCH 490/702] sh.sh --- sh/{shell.sh => sh.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{shell.sh => sh.sh} (100%) diff --git a/sh/shell.sh b/sh/sh.sh similarity index 100% rename from sh/shell.sh rename to sh/sh.sh From 7376790a309c928a5a94c9834d5f4761b6c11762 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 17 Nov 2024 22:31:13 +0100 Subject: [PATCH 491/702] sh --- sh/main.sh | 2 +- sh/sh.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 902c7f8..a4ef43b 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -57,4 +57,4 @@ main_source_file() { main_source_file "${ENV}" -main_source_directory "${HOME}/shell" +main_source_directory "${HOME}/sh" diff --git a/sh/sh.sh b/sh/sh.sh index 5676d0d..6fab8a6 100644 --- a/sh/sh.sh +++ b/sh/sh.sh @@ -114,7 +114,7 @@ shell_prompt() { shell_setup() { # shell - echo "export ENV=\"${ENV}\"" >"/etc/profile.d/shell.sh" + echo "export ENV=\"${ENV}\"" >"/etc/profile.d/sh.sh" # bash local file="/etc/bash.bashrc" rm --force --recursive "${file}" From 4931f47fe2a088eaf3ece2def2dfbb42c547f50c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 11:41:12 +0100 Subject: [PATCH 492/702] constants --- sh/main.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index a4ef43b..8081179 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,4 +1,11 @@ -[ -n "${ENV}" ] || export ENV="/etc/sh/main.sh" +SH_NAME="sh" + +SH_ROOT="/etc/${SH_NAME}" +SH_USER="${HOME}/${SH_NAME}" + +SH_MAIN="${SH_ROOT}/main.sh" + +[ -n "${ENV}" ] || export ENV="${SH_MAIN}" main_commands() { local file="${1}" @@ -57,4 +64,4 @@ main_source_file() { main_source_file "${ENV}" -main_source_directory "${HOME}/sh" +main_source_directory "${SH_USER}" From b11bb1c60a1a006ea816d7717cbff96aef68c26d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 11:54:27 +0100 Subject: [PATCH 493/702] prefix --- sh/git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/git.sh b/sh/git.sh index 9e84251..38e1551 100644 --- a/sh/git.sh +++ b/sh/git.sh @@ -1,4 +1,4 @@ -GIT_LOG_FORMAT="\ +SH_GIT_LOG_FORMAT="\ %C(auto)%h%d S %C(red)%GS A %C(green)%an %ae @@ -293,7 +293,7 @@ git_log() { log \ --abbrev=8 \ --abbrev-commit \ - --format="${GIT_LOG_FORMAT}" \ + --format="${SH_GIT_LOG_FORMAT}" \ --graph \ "${@}" } From 4d8be7e2993ee9f02721298fd06563f307473741 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 11:58:32 +0100 Subject: [PATCH 494/702] prefixes --- sh/git.sh | 242 +++++++++++++++++++++++++++--------------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/sh/git.sh b/sh/git.sh index 38e1551..e8b210e 100644 --- a/sh/git.sh +++ b/sh/git.sh @@ -8,16 +8,16 @@ C %C(blue)%cn %ce %B" # add to index -ga() { git_add "${@}"; } -git_add() { +ga() { sh_git_add "${@}"; } +sh_git_add() { git \ add \ "${@}" } # add all to index -gaa() { git_add_all "${@}"; } -git_add_all() { +gaa() { sh_git_add_all "${@}"; } +sh_git_add_all() { git \ add \ --all \ @@ -25,8 +25,8 @@ git_add_all() { } # add parts of all to index -gaap() { git_add_all_patch "${@}"; } -git_add_all_patch() { +gaap() { sh_git_add_all_patch "${@}"; } +sh_git_add_all_patch() { git \ add \ --all \ @@ -35,8 +35,8 @@ git_add_all_patch() { } # add parts to index -gap() { git_add_patch "${@}"; } -git_add_patch() { +gap() { sh_git_add_patch "${@}"; } +sh_git_add_patch() { git \ add \ --patch \ @@ -44,16 +44,16 @@ git_add_patch() { } # create a branch -gb() { git_branch "${@}"; } -git_branch() { +gb() { sh_git_branch "${@}"; } +sh_git_branch() { git \ branch \ "${@}" } # delete a branch -gbd() { git_branch_delete "${@}"; } -git_branch_delete() { +gbd() { sh_git_branch_delete "${@}"; } +sh_git_branch_delete() { git \ branch \ --delete \ @@ -61,8 +61,8 @@ git_branch_delete() { } # force a branch deletion -gbdf() { git_branch_delete_force "${@}"; } -git_branch_delete_force() { +gbdf() { sh_git_branch_delete_force "${@}"; } +sh_git_branch_delete_force() { git \ branch \ --delete \ @@ -71,8 +71,8 @@ git_branch_delete_force() { } # list branches -gbl() { git_branch_list "${@}"; } -git_branch_list() { +gbl() { sh_git_branch_list "${@}"; } +sh_git_branch_list() { git \ branch \ --all \ @@ -83,8 +83,8 @@ git_branch_list() { } # set the link to a remote branch from a local branch -gbsu() { git_branch_set_upstream "${@}"; } -git_branch_set_upstream() { +gbsu() { sh_git_branch_set_upstream "${@}"; } +sh_git_branch_set_upstream() { git \ branch \ --set-upstream-to \ @@ -92,16 +92,16 @@ git_branch_set_upstream() { } # switch to a branch or checkout file(s) from a commit -gc() { git_checkout "${@}"; } -git_checkout() { +gc() { sh_git_checkout "${@}"; } +sh_git_checkout() { git \ checkout \ "${@}" } # checkout an orphan branch -gco() { git_checkout_orphan "${@}"; } -git_checkout_orphan() { +gco() { sh_git_checkout_orphan "${@}"; } +sh_git_checkout_orphan() { git \ checkout \ --orphan \ @@ -109,16 +109,16 @@ git_checkout_orphan() { } # pick a commit -gcp() { git_cherry_pick "${@}"; } -git_cherry_pick() { +gcp() { sh_git_cherry_pick "${@}"; } +sh_git_cherry_pick() { git \ cherry-pick \ "${@}" } # abort the commit pick -gcpa() { git_cherry_pick_abort "${@}"; } -git_cherry_pick_abort() { +gcpa() { sh_git_cherry_pick_abort "${@}"; } +sh_git_cherry_pick_abort() { git \ cherry-pick \ --abort \ @@ -126,8 +126,8 @@ git_cherry_pick_abort() { } # continue the commit pick -gcpc() { git_cherry_pick_continue "${@}"; } -git_cherry_pick_continue() { +gcpc() { sh_git_cherry_pick_continue "${@}"; } +sh_git_cherry_pick_continue() { git \ cherry-pick \ --continue \ @@ -135,8 +135,8 @@ git_cherry_pick_continue() { } # clean untracked files -gcf() { git_clean_force "${@}"; } -git_clean_force() { +gcf() { sh_git_clean_force "${@}"; } +sh_git_clean_force() { git \ clean \ -d \ @@ -145,8 +145,8 @@ git_clean_force() { } # redo the last commit with a different message -gcam() { git_commit_amend_message "${@}"; } -git_commit_amend_message() { +gcam() { sh_git_commit_amend_message "${@}"; } +sh_git_commit_amend_message() { git \ commit \ --amend \ @@ -155,8 +155,8 @@ git_commit_amend_message() { } # make a root commit -gcem() { git_commit_empty_message "${@}"; } -git_commit_empty_message() { +gcem() { sh_git_commit_empty_message "${@}"; } +sh_git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -166,8 +166,8 @@ git_commit_empty_message() { } # commit the index -gcm() { git_commit_message "${@}"; } -git_commit_message() { +gcm() { sh_git_commit_message "${@}"; } +sh_git_commit_message() { git \ commit \ --message \ @@ -175,8 +175,8 @@ git_commit_message() { } # configure the user email -gcue() { git_config_user_email "${@}"; } -git_config_user_email() { +gcue() { sh_git_config_user_email "${@}"; } +sh_git_config_user_email() { git \ config \ "user.email" \ @@ -184,8 +184,8 @@ git_config_user_email() { } # configure the user name -gcun() { git_config_user_name "${@}"; } -git_config_user_name() { +gcun() { sh_git_config_user_name "${@}"; } +sh_git_config_user_name() { git \ config \ "user.name" \ @@ -193,16 +193,16 @@ git_config_user_name() { } # differences from last or between commits -gd() { git_diff "${@}"; } -git_diff() { +gd() { sh_git_diff "${@}"; } +sh_git_diff() { git \ diff \ "${@}" } # display what is indexed in cache -gdc() { git_diff_cached "${@}"; } -git_diff_cached() { +gdc() { sh_git_diff_cached "${@}"; } +sh_git_diff_cached() { git \ diff \ --cached \ @@ -210,8 +210,8 @@ git_diff_cached() { } # indexed character-level differences -gdcw() { git_diff_cached_word "${@}"; } -git_diff_cached_word() { +gdcw() { sh_git_diff_cached_word "${@}"; } +sh_git_diff_cached_word() { git \ diff \ --cached \ @@ -220,8 +220,8 @@ git_diff_cached_word() { } # differences via external tool -gdt() { git_diff_tool "${@}"; } -git_diff_tool() { +gdt() { sh_git_diff_tool "${@}"; } +sh_git_diff_tool() { git \ difftool \ --dir-diff \ @@ -229,8 +229,8 @@ git_diff_tool() { } # character-level differences -gdw() { git_diff_word "${@}"; } -git_diff_word() { +gdw() { sh_git_diff_word "${@}"; } +sh_git_diff_word() { git \ diff \ --word-diff-regex "." \ @@ -238,8 +238,8 @@ git_diff_word() { } # fetch from the remote repository -gf() { git_fetch "${@}"; } -git_fetch() { +gf() { sh_git_fetch "${@}"; } +sh_git_fetch() { git \ fetch \ --tags \ @@ -248,16 +248,16 @@ git_fetch() { } # fetch from remote repository and prune local orphan branches -gfp() { git_fetch_prune "${@}"; } -git_fetch_prune() { - git_fetch \ +gfp() { sh_git_fetch_prune "${@}"; } +sh_git_fetch_prune() { + sh_git_fetch \ --prune \ "${@}" } # garbage collect all orphan commits -ggc() { git_garbage_collect "${@}"; } -git_garbage_collect() { +ggc() { sh_git_garbage_collect "${@}"; } +sh_git_garbage_collect() { git \ reflog \ expire \ @@ -270,16 +270,16 @@ git_garbage_collect() { } # initialize a new repository -gi() { git_init "${@}"; } -git_init() { +gi() { sh_git_init "${@}"; } +sh_git_init() { git \ init \ "${@}" } # initialize a new bare repository -gib() { git_init_bare "${@}"; } -git_init_bare() { +gib() { sh_git_init_bare "${@}"; } +sh_git_init_bare() { git \ init \ --bare \ @@ -287,8 +287,8 @@ git_init_bare() { } # log history -gl() { git_log "${@}"; } -git_log() { +gl() { sh_git_log "${@}"; } +sh_git_log() { git \ log \ --abbrev=8 \ @@ -299,33 +299,33 @@ git_log() { } # log all history -gla() { git_log_all "${@}"; } -git_log_all() { - git_log \ +gla() { sh_git_log_all "${@}"; } +sh_git_log_all() { + sh_git_log \ --all \ "${@}" } # log all history with patches -glap() { git_log_all_patch "${@}"; } -git_log_all_patch() { - git_log \ +glap() { sh_git_log_all_patch "${@}"; } +sh_git_log_all_patch() { + sh_git_log \ --all \ --patch \ "${@}" } # log history with patches -glp() { git_log_patch "${@}"; } -git_log_patch() { - git_log \ +glp() { sh_git_log_patch "${@}"; } +sh_git_log_patch() { + sh_git_log \ --patch \ "${@}" } # fast-forward merge to remote branch -gm() { git_merge "${@}"; } -git_merge() { +gm() { sh_git_merge "${@}"; } +sh_git_merge() { git \ merge \ --ff-only \ @@ -333,8 +333,8 @@ git_merge() { } # abort the current merge commit -gma() { git_merge_abort "${@}"; } -git_merge_abort() { +gma() { sh_git_merge_abort "${@}"; } +sh_git_merge_abort() { git \ merge \ --abort \ @@ -342,8 +342,8 @@ git_merge_abort() { } # do a merge commit -gmc() { git_merge_commit "${@}"; } -git_merge_commit() { +gmc() { sh_git_merge_commit "${@}"; } +sh_git_merge_commit() { git \ merge \ --no-ff \ @@ -352,8 +352,8 @@ git_merge_commit() { } # squash a branch and index its modifications -gms() { git_merge_squash "${@}"; } -git_merge_squash() { +gms() { sh_git_merge_squash "${@}"; } +sh_git_merge_squash() { git \ merge \ --squash \ @@ -361,16 +361,16 @@ git_merge_squash() { } # merge via external tool -gmt() { git_merge_tool "${@}"; } -git_merge_tool() { +gmt() { sh_git_merge_tool "${@}"; } +sh_git_merge_tool() { git \ mergetool \ "${@}" } # push to the remote repository -gp() { git_push "${@}"; } -git_push() { +gp() { sh_git_push "${@}"; } +sh_git_push() { git \ push \ --tags \ @@ -379,8 +379,8 @@ git_push() { } # delete from the remote repository -gpd() { git_push_delete "${@}"; } -git_push_delete() { +gpd() { sh_git_push_delete "${@}"; } +sh_git_push_delete() { git \ push \ --delete \ @@ -388,24 +388,24 @@ git_push_delete() { } # force the push to the remote repository -gpf() { git_push_force "${@}"; } -git_push_force() { - git_push \ +gpf() { sh_git_push_force "${@}"; } +sh_git_push_force() { + sh_git_push \ --force \ "${@}" } # rebase current branch onto another -grb() { git_re_base "${@}"; } -git_re_base() { +grb() { sh_git_re_base "${@}"; } +sh_git_re_base() { git \ rebase \ "${@}" } # abort current rebase -grba() { git_re_base_abort "${@}"; } -git_re_base_abort() { +grba() { sh_git_re_base_abort "${@}"; } +sh_git_re_base_abort() { git \ rebase \ --abort \ @@ -413,8 +413,8 @@ git_re_base_abort() { } # continue current rebase -grbc() { git_re_base_continue "${@}"; } -git_re_base_continue() { +grbc() { sh_git_re_base_continue "${@}"; } +sh_git_re_base_continue() { git \ rebase \ --continue \ @@ -422,8 +422,8 @@ git_re_base_continue() { } # force rebase without fast-forward -grbf() { git_re_base_force "${@}"; } -git_re_base_force() { +grbf() { sh_git_re_base_force "${@}"; } +sh_git_re_base_force() { git \ rebase \ --force-rebase \ @@ -431,8 +431,8 @@ git_re_base_force() { } # rebase interactively -grbi() { git_re_base_interactive "${@}"; } -git_re_base_interactive() { +grbi() { sh_git_re_base_interactive "${@}"; } +sh_git_re_base_interactive() { git \ rebase \ --interactive \ @@ -440,8 +440,8 @@ git_re_base_interactive() { } # add a new remote repository -grma() { git_re_mote_add "${@}"; } -git_re_mote_add() { +grma() { sh_git_re_mote_add "${@}"; } +sh_git_re_mote_add() { git \ remote \ add \ @@ -449,8 +449,8 @@ git_re_mote_add() { } # list remote repositories -grml() { git_re_mote_list "${@}"; } -git_re_mote_list() { +grml() { sh_git_re_mote_list "${@}"; } +sh_git_re_mote_list() { git \ remote \ --verbose \ @@ -458,8 +458,8 @@ git_re_mote_list() { } # set the location of a remote repository -grmsu() { git_re_mote_set_upstream "${@}"; } -git_re_mote_set_upstream() { +grmsu() { sh_git_re_mote_set_upstream "${@}"; } +sh_git_re_mote_set_upstream() { git \ remote \ set-url \ @@ -467,8 +467,8 @@ git_re_mote_set_upstream() { } # show connection to a remote repository -grms() { git_re_mote_show "${@}"; } -git_re_mote_show() { +grms() { sh_git_re_mote_show "${@}"; } +sh_git_re_mote_show() { git \ remote \ show \ @@ -476,24 +476,24 @@ git_re_mote_show() { } # remove and add removal to index -grm() { git_re_move "${@}"; } -git_re_move() { +grm() { sh_git_re_move "${@}"; } +sh_git_re_move() { git \ rm \ "${@}" } # remove file(s) from index or move current branch pointer -grs() { git_re_set "${@}"; } -git_re_set() { +grs() { sh_git_re_set "${@}"; } +sh_git_re_set() { git \ reset \ "${@}" } # wipe modifications or reset current branch to another commit -grsh() { git_re_set_hard "${@}"; } -git_re_set_hard() { +grsh() { sh_git_re_set_hard "${@}"; } +sh_git_re_set_hard() { git \ reset \ --hard \ @@ -501,16 +501,16 @@ git_re_set_hard() { } # show a commit -gsc() { git_show_commit "${@}"; } -git_show_commit() { +gsc() { sh_git_show_commit "${@}"; } +sh_git_show_commit() { git \ show \ "${@}" } # current state of repository -gs() { git_status "${@}"; } -git_status() { +gs() { sh_git_status "${@}"; } +sh_git_status() { git \ status \ --untracked-files="all" \ @@ -518,16 +518,16 @@ git_status() { } # tag a commit -gt() { git_tag "${@}"; } -git_tag() { +gt() { sh_git_tag "${@}"; } +sh_git_tag() { git \ tag \ "${@}" } # delete a tag -gtd() { git_tag_delete "${@}"; } -git_tag_delete() { +gtd() { sh_git_tag_delete "${@}"; } +sh_git_tag_delete() { git \ tag \ --delete \ From 9a83206f3c84954efe219a2e64a09ad503e7da65 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:03:15 +0100 Subject: [PATCH 495/702] gpg --- sh/gpg.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sh/gpg.sh b/sh/gpg.sh index e4ebb38..ffa4f63 100644 --- a/sh/gpg.sh +++ b/sh/gpg.sh @@ -1,19 +1,19 @@ # turn gpg agent off gak() { gpg_agent_kill "${@}"; } -gpg_agent_kill() { +sh_gpg_agent_kill() { gpgconf \ --kill "gpg-agent" } # bind gpg agent to current tty gau() { gpg_agent_update "${@}"; } -gpg_agent_update() { +sh_gpg_agent_update() { gpg-connect-agent \ updatestartuptty \ /bye } -gpg_ssh() { +sh_gpg_ssh() { local user_id user_id=$(id --user) if [ "${user_id}" -ne 0 ]; then @@ -24,4 +24,4 @@ gpg_ssh() { fi } -gpg_ssh +sh_gpg_ssh From 3b0f3c14c1db016cb35fc293297e4612be29f2c7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:05:20 +0100 Subject: [PATCH 496/702] primary --- sh/gsettings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/gsettings.sh b/sh/gsettings.sh index 8916766..0f32226 100644 --- a/sh/gsettings.sh +++ b/sh/gsettings.sh @@ -1,4 +1,4 @@ -ws() { +sh_gnome_workspaces_primary() { local bool local group="org.gnome.mutter" local name="workspaces-only-on-primary" From b68d4746e6af385b6fbc02c4f2d852a032c3140b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:07:42 +0100 Subject: [PATCH 497/702] log/constants --- sh/log.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index 1891609..040bf28 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -1,44 +1,44 @@ -LOG_LEVEL_FATAL=0 -LOG_LEVEL_ERROR=1 -LOG_LEVEL_WARN=2 -LOG_LEVEL_INFO=3 -LOG_LEVEL_DEBUG=4 -LOG_LEVEL_TRACE=5 +SH_LOG_LEVEL_FATAL=0 +SH_LOG_LEVEL_ERROR=1 +SH_LOG_LEVEL_WARN=2 +SH_LOG_LEVEL_INFO=3 +SH_LOG_LEVEL_DEBUG=4 +SH_LOG_LEVEL_TRACE=5 -LOG_LEVEL=${LOG_LEVEL_INFO} +SH_LOG_LEVEL=${SH_LOG_LEVEL_INFO} log_debug() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_DEBUG}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then echo "[DEBUG]" "${@}" fi } log_error() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_ERROR}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then echo "[ERROR]" "${@}" fi } log_fatal() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_FATAL}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then echo "[FATAL]" "${@}" fi } log_info() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_INFO}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_INFO}" ]; then echo "${@}" fi } log_trace() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_TRACE}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_TRACE}" ]; then echo "[TRACE]" "${@}" fi } log_warn() { - if [ "${LOG_LEVEL}" -ge "${LOG_LEVEL_WARN}" ]; then + if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_WARN}" ]; then echo " [WARN]" "${@}" fi } From 69dac56a26f451380bd935d98518acf26864b071 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:15:29 +0100 Subject: [PATCH 498/702] log --- sh/debian.sh | 4 ++-- sh/gsettings.sh | 6 +++--- sh/log.sh | 12 ++++++------ sh/main.sh | 4 ++-- sh/mount.sh | 30 +++++++++++++++--------------- sh/util.sh | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index f806ba6..db37cae 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -35,8 +35,8 @@ apt_install_target() { shift local package for package in "${@}"; do - log_info - log_info "${package} ← ${target}" + sh_log_info + sh_log_info "${package} ← ${target}" apt-get \ install \ --assume-yes \ diff --git a/sh/gsettings.sh b/sh/gsettings.sh index 0f32226..4aa6746 100644 --- a/sh/gsettings.sh +++ b/sh/gsettings.sh @@ -5,11 +5,11 @@ sh_gnome_workspaces_primary() { local var="${group}/${name}" # get bool="$(gsettings get "${group}" "${name}")" - log_debug "${var}: ${bool}" + sh_log_debug "${var}: ${bool}" # not bool="$(not "${bool}")" - log_debug "bool: ${bool}" + sh_log_debug "bool: ${bool}" # set gsettings set "${group}" "${name}" "${bool}" - log_info "${var}: ${bool}" + sh_log_info "${var}: ${bool}" } diff --git a/sh/log.sh b/sh/log.sh index 040bf28..19f7c1b 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -7,37 +7,37 @@ SH_LOG_LEVEL_TRACE=5 SH_LOG_LEVEL=${SH_LOG_LEVEL_INFO} -log_debug() { +sh_log_debug() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then echo "[DEBUG]" "${@}" fi } -log_error() { +sh_log_error() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then echo "[ERROR]" "${@}" fi } -log_fatal() { +sh_log_fatal() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then echo "[FATAL]" "${@}" fi } -log_info() { +sh_log_info() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_INFO}" ]; then echo "${@}" fi } -log_trace() { +sh_log_trace() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_TRACE}" ]; then echo "[TRACE]" "${@}" fi } -log_warn() { +sh_log_warn() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_WARN}" ]; then echo " [WARN]" "${@}" fi diff --git a/sh/main.sh b/sh/main.sh index 8081179..f04cf71 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -44,8 +44,8 @@ main_source_directory() { fi done IFS="${ifs}" - log_info - log_info "${CMD}" + sh_log_info + sh_log_info "${CMD}" else echo "Not a directory: ${path}" return 1 diff --git a/sh/mount.sh b/sh/mount.sh index 7e715cf..b2bd77f 100644 --- a/sh/mount.sh +++ b/sh/mount.sh @@ -1,36 +1,36 @@ mo() { local root="${1}" if [ -z "${root}" ]; then - log_error "No root target directory" + sh_log_error "No root target directory" return 1 fi root="$(realpath "${root}")" if ! mkdir "overlay"; then - log_error "Unable to make overlay directory" + sh_log_error "Unable to make overlay directory" return 2 fi ( if ! cd "overlay"; then - log_error "Unable to move into overlay directory" + sh_log_error "Unable to move into overlay directory" return 3 fi local directory for directory in "lower" "upper" "work" "mount"; do if ! mkdir --parents "${directory}"; then - log_error "Unable to make directory: ${directory}" + sh_log_error "Unable to make directory: ${directory}" return 4 fi done local file="${root}/filesystem.squashfs" if ! mount "${file}" "lower"; then - log_error "Unable to lower mount: ${file}" + sh_log_error "Unable to lower mount: ${file}" return 5 fi if ! mount \ -o "lowerdir=lower,upperdir=upper,workdir=work" \ -t "overlay" \ "overlay" "mount"; then - log_error "Unable to overlay mount" + sh_log_error "Unable to overlay mount" return 6 fi ) @@ -39,35 +39,35 @@ mo() { uo() { ( if ! cd "overlay"; then - log_error "Unable to move into overlay directory" + sh_log_error "Unable to move into overlay directory" return 1 fi if ! umount "mount"; then - log_error "Unable to unmount mount directory" + sh_log_error "Unable to unmount mount directory" return 2 fi if ! rmdir "mount"; then - log_error "Unable to remove mount directory" + sh_log_error "Unable to remove mount directory" return 3 fi local directory for directory in "upper" "work"; do if ! rm --force --recursive "${directory}"; then - log_error "Unable to remove directory: ${directory}" + sh_log_error "Unable to remove directory: ${directory}" return 4 fi done if ! umount "lower"; then - log_error "Unable to unmount lower directory" + sh_log_error "Unable to unmount lower directory" return 5 fi if ! rmdir "lower"; then - log_error "Unable to remove lower directory" + sh_log_error "Unable to remove lower directory" return 6 fi ) if ! rmdir "overlay"; then - log_error "Unable to remove overlay directory" + sh_log_error "Unable to remove overlay directory" return 7 fi } @@ -76,7 +76,7 @@ mr() { local directory for directory in "dev" "dev/pts" "proc" "sys"; do if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then - log_error "Unable to bind mount directory: ${directory}" + sh_log_error "Unable to bind mount directory: ${directory}" return 1 fi done @@ -97,7 +97,7 @@ ur() { local directory for directory in "sys" "proc" "dev/pts" "dev"; do if ! umount --lazy "overlay/mount/${directory}"; then - log_error "Unable to bind unmount directory: ${directory}" + sh_log_error "Unable to bind unmount directory: ${directory}" return 1 fi done diff --git a/sh/util.sh b/sh/util.sh index 4dcd59a..2f2b400 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -33,5 +33,5 @@ warn_wipe() { list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r tmp - log_trace "${tmp}" + sh_log_trace "${tmp}" } From eaaa9662cdc24d7d24715b8711b8519527cddd23 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:17:47 +0100 Subject: [PATCH 499/702] sh_log --- sh/log.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh/log.sh b/sh/log.sh index 19f7c1b..c938663 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -7,6 +7,8 @@ SH_LOG_LEVEL_TRACE=5 SH_LOG_LEVEL=${SH_LOG_LEVEL_INFO} +sh_log() { sh_log_info "${@}"; } + sh_log_debug() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then echo "[DEBUG]" "${@}" From b9804edd7a74905e09815d71b90ba9d1d5879b99 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:19:19 +0100 Subject: [PATCH 500/702] gnome --- sh/{gsettings.sh => gnome.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{gsettings.sh => gnome.sh} (100%) diff --git a/sh/gsettings.sh b/sh/gnome.sh similarity index 100% rename from sh/gsettings.sh rename to sh/gnome.sh From aae50d9bef5bb6364f9614e265362f38c3fddf47 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:22:08 +0100 Subject: [PATCH 501/702] btrfs --- sh/btrfs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/btrfs.sh b/sh/btrfs.sh index 1172d2d..253be28 100644 --- a/sh/btrfs.sh +++ b/sh/btrfs.sh @@ -1,4 +1,5 @@ -bsl() { +bsl() { sh_btrfs_subvolume_list "${@}"; } +sh_btrfs_subvolume_list() { if [ -n "${1}" ]; then btrfs subvolume list "${1}" | cut --delimiter " " --fields 9 | From 0cce49e919e115a89010c0fba22fe4895f72be93 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:32:57 +0100 Subject: [PATCH 502/702] btrfs --- sh/alias/btrfs.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sh/alias/btrfs.sh b/sh/alias/btrfs.sh index 061d373..4ec3ff6 100644 --- a/sh/alias/btrfs.sh +++ b/sh/alias/btrfs.sh @@ -1,11 +1,13 @@ -bfdf() { +bfdf() { sh_btrfs_filesystem_d_f "${@}"; } +sh_btrfs_filesystem_d_f() { btrfs \ filesystem \ df \ "${@}" } -bfdu() { +bfdu() { sh_btrfs_filesystem_d_u "${@}"; } +sh_btrfs_filesystem_d_u() { btrfs \ filesystem \ du \ @@ -13,42 +15,48 @@ bfdu() { "${@}" } -bfu() { +bfu() { sh_btrfs_filesystem_usage "${@}"; } +sh_btrfs_filesystem_usage() { btrfs \ filesystem \ usage \ "${@}" } -bpg() { +bpg() { sh_btrfs_property_get "${@}"; } +sh_btrfs_property_get() { btrfs \ property \ get \ "${@}" } -bsc() { +bsc() { sh_btrfs_subvolume_create "${@}"; } +sh_btrfs_subvolume_create() { btrfs \ subvolume \ create \ "${@}" } -bsd() { +bsd() { sh_btrfs_subvolume_delete "${@}"; } +sh_btrfs_subvolume_delete() { btrfs \ subvolume \ delete \ "${@}" } -bss() { +bss() { sh_btrfs_subvolume_snapshot "${@}"; } +sh_btrfs_subvolume_snapshot() { btrfs \ subvolume \ snapshot \ "${@}" } -bssr() { +bssr() { sh_btrfs_subvolume_snapshot_r "${@}"; } +sh_btrfs_subvolume_snapshot_r() { btrfs \ subvolume \ snapshot -r \ From d82805ff38a945a04ed3d8f8a013eaf6841769f2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:38:15 +0100 Subject: [PATCH 503/702] cmd --- sh/{alias => cmd}/apt.sh | 0 sh/{alias => cmd}/batcat.sh | 0 sh/{alias => cmd}/btrfs.sh | 0 sh/{alias => cmd}/byobu.sh | 0 sh/{alias => cmd}/chmod.sh | 0 sh/{alias => cmd}/chown.sh | 0 sh/{alias => cmd}/clear.sh | 0 sh/{alias => cmd}/cp.sh | 0 sh/{alias => cmd}/emacs.sh | 0 sh/{alias => cmd}/evince.sh | 0 sh/{alias => cmd}/grep.sh | 0 sh/{alias => cmd}/kill.sh | 0 sh/{alias => cmd}/killall.sh | 0 sh/{alias => cmd}/ls.sh | 0 sh/{alias => cmd}/lsblk.sh | 0 sh/{alias => cmd}/mkdir.sh | 0 sh/{alias => cmd}/mount.sh | 0 sh/{alias => cmd}/mv.sh | 0 sh/{alias => cmd}/nano.sh | 0 sh/{alias => cmd}/newsboat.sh | 0 sh/{alias => cmd}/pass.sh | 0 sh/{alias => cmd}/ps.sh | 0 sh/{alias => cmd}/pwgen.sh | 0 sh/{alias => cmd}/rm.sh | 0 sh/{alias => cmd}/rsync.sh | 0 sh/{alias => cmd}/tar.sh | 0 sh/{alias => cmd}/tmux.sh | 0 sh/{alias => cmd}/tree.sh | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename sh/{alias => cmd}/apt.sh (100%) rename sh/{alias => cmd}/batcat.sh (100%) rename sh/{alias => cmd}/btrfs.sh (100%) rename sh/{alias => cmd}/byobu.sh (100%) rename sh/{alias => cmd}/chmod.sh (100%) rename sh/{alias => cmd}/chown.sh (100%) rename sh/{alias => cmd}/clear.sh (100%) rename sh/{alias => cmd}/cp.sh (100%) rename sh/{alias => cmd}/emacs.sh (100%) rename sh/{alias => cmd}/evince.sh (100%) rename sh/{alias => cmd}/grep.sh (100%) rename sh/{alias => cmd}/kill.sh (100%) rename sh/{alias => cmd}/killall.sh (100%) rename sh/{alias => cmd}/ls.sh (100%) rename sh/{alias => cmd}/lsblk.sh (100%) rename sh/{alias => cmd}/mkdir.sh (100%) rename sh/{alias => cmd}/mount.sh (100%) rename sh/{alias => cmd}/mv.sh (100%) rename sh/{alias => cmd}/nano.sh (100%) rename sh/{alias => cmd}/newsboat.sh (100%) rename sh/{alias => cmd}/pass.sh (100%) rename sh/{alias => cmd}/ps.sh (100%) rename sh/{alias => cmd}/pwgen.sh (100%) rename sh/{alias => cmd}/rm.sh (100%) rename sh/{alias => cmd}/rsync.sh (100%) rename sh/{alias => cmd}/tar.sh (100%) rename sh/{alias => cmd}/tmux.sh (100%) rename sh/{alias => cmd}/tree.sh (100%) diff --git a/sh/alias/apt.sh b/sh/cmd/apt.sh similarity index 100% rename from sh/alias/apt.sh rename to sh/cmd/apt.sh diff --git a/sh/alias/batcat.sh b/sh/cmd/batcat.sh similarity index 100% rename from sh/alias/batcat.sh rename to sh/cmd/batcat.sh diff --git a/sh/alias/btrfs.sh b/sh/cmd/btrfs.sh similarity index 100% rename from sh/alias/btrfs.sh rename to sh/cmd/btrfs.sh diff --git a/sh/alias/byobu.sh b/sh/cmd/byobu.sh similarity index 100% rename from sh/alias/byobu.sh rename to sh/cmd/byobu.sh diff --git a/sh/alias/chmod.sh b/sh/cmd/chmod.sh similarity index 100% rename from sh/alias/chmod.sh rename to sh/cmd/chmod.sh diff --git a/sh/alias/chown.sh b/sh/cmd/chown.sh similarity index 100% rename from sh/alias/chown.sh rename to sh/cmd/chown.sh diff --git a/sh/alias/clear.sh b/sh/cmd/clear.sh similarity index 100% rename from sh/alias/clear.sh rename to sh/cmd/clear.sh diff --git a/sh/alias/cp.sh b/sh/cmd/cp.sh similarity index 100% rename from sh/alias/cp.sh rename to sh/cmd/cp.sh diff --git a/sh/alias/emacs.sh b/sh/cmd/emacs.sh similarity index 100% rename from sh/alias/emacs.sh rename to sh/cmd/emacs.sh diff --git a/sh/alias/evince.sh b/sh/cmd/evince.sh similarity index 100% rename from sh/alias/evince.sh rename to sh/cmd/evince.sh diff --git a/sh/alias/grep.sh b/sh/cmd/grep.sh similarity index 100% rename from sh/alias/grep.sh rename to sh/cmd/grep.sh diff --git a/sh/alias/kill.sh b/sh/cmd/kill.sh similarity index 100% rename from sh/alias/kill.sh rename to sh/cmd/kill.sh diff --git a/sh/alias/killall.sh b/sh/cmd/killall.sh similarity index 100% rename from sh/alias/killall.sh rename to sh/cmd/killall.sh diff --git a/sh/alias/ls.sh b/sh/cmd/ls.sh similarity index 100% rename from sh/alias/ls.sh rename to sh/cmd/ls.sh diff --git a/sh/alias/lsblk.sh b/sh/cmd/lsblk.sh similarity index 100% rename from sh/alias/lsblk.sh rename to sh/cmd/lsblk.sh diff --git a/sh/alias/mkdir.sh b/sh/cmd/mkdir.sh similarity index 100% rename from sh/alias/mkdir.sh rename to sh/cmd/mkdir.sh diff --git a/sh/alias/mount.sh b/sh/cmd/mount.sh similarity index 100% rename from sh/alias/mount.sh rename to sh/cmd/mount.sh diff --git a/sh/alias/mv.sh b/sh/cmd/mv.sh similarity index 100% rename from sh/alias/mv.sh rename to sh/cmd/mv.sh diff --git a/sh/alias/nano.sh b/sh/cmd/nano.sh similarity index 100% rename from sh/alias/nano.sh rename to sh/cmd/nano.sh diff --git a/sh/alias/newsboat.sh b/sh/cmd/newsboat.sh similarity index 100% rename from sh/alias/newsboat.sh rename to sh/cmd/newsboat.sh diff --git a/sh/alias/pass.sh b/sh/cmd/pass.sh similarity index 100% rename from sh/alias/pass.sh rename to sh/cmd/pass.sh diff --git a/sh/alias/ps.sh b/sh/cmd/ps.sh similarity index 100% rename from sh/alias/ps.sh rename to sh/cmd/ps.sh diff --git a/sh/alias/pwgen.sh b/sh/cmd/pwgen.sh similarity index 100% rename from sh/alias/pwgen.sh rename to sh/cmd/pwgen.sh diff --git a/sh/alias/rm.sh b/sh/cmd/rm.sh similarity index 100% rename from sh/alias/rm.sh rename to sh/cmd/rm.sh diff --git a/sh/alias/rsync.sh b/sh/cmd/rsync.sh similarity index 100% rename from sh/alias/rsync.sh rename to sh/cmd/rsync.sh diff --git a/sh/alias/tar.sh b/sh/cmd/tar.sh similarity index 100% rename from sh/alias/tar.sh rename to sh/cmd/tar.sh diff --git a/sh/alias/tmux.sh b/sh/cmd/tmux.sh similarity index 100% rename from sh/alias/tmux.sh rename to sh/cmd/tmux.sh diff --git a/sh/alias/tree.sh b/sh/cmd/tree.sh similarity index 100% rename from sh/alias/tree.sh rename to sh/cmd/tree.sh From b380b2c0b0232492cb41e85cd7a54dfcc132271a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:40:20 +0100 Subject: [PATCH 504/702] gnome/proxy --- sh/gnome.sh | 9 +++++++++ sh/proxy.sh | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 sh/proxy.sh diff --git a/sh/gnome.sh b/sh/gnome.sh index 4aa6746..c773ff8 100644 --- a/sh/gnome.sh +++ b/sh/gnome.sh @@ -1,3 +1,12 @@ +sh_gnome_proxy() { + local value + case "${1}" in + "on") value="manual" ;; + *) value="none" ;; + esac + gsettings set "org.gnome.system.proxy" "mode" "${value}" +} + sh_gnome_workspaces_primary() { local bool local group="org.gnome.mutter" diff --git a/sh/proxy.sh b/sh/proxy.sh deleted file mode 100644 index dd154a6..0000000 --- a/sh/proxy.sh +++ /dev/null @@ -1,8 +0,0 @@ -socks() { - local value - case "${1}" in - "on") value="manual" ;; - *) value="none" ;; - esac - gsettings set "org.gnome.system.proxy" "mode" "${value}" -} From 6ab26f51873cdb080fc40ec856690af8d4a8ac16 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 12:41:54 +0100 Subject: [PATCH 505/702] bsl --- sh/btrfs.sh | 8 -------- sh/cmd/btrfs.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 sh/btrfs.sh diff --git a/sh/btrfs.sh b/sh/btrfs.sh deleted file mode 100644 index 253be28..0000000 --- a/sh/btrfs.sh +++ /dev/null @@ -1,8 +0,0 @@ -bsl() { sh_btrfs_subvolume_list "${@}"; } -sh_btrfs_subvolume_list() { - if [ -n "${1}" ]; then - btrfs subvolume list "${1}" | - cut --delimiter " " --fields 9 | - sort - fi -} diff --git a/sh/cmd/btrfs.sh b/sh/cmd/btrfs.sh index 4ec3ff6..fd880c1 100644 --- a/sh/cmd/btrfs.sh +++ b/sh/cmd/btrfs.sh @@ -47,6 +47,15 @@ sh_btrfs_subvolume_delete() { "${@}" } +bsl() { sh_btrfs_subvolume_list "${@}"; } +sh_btrfs_subvolume_list() { + if [ -n "${1}" ]; then + btrfs subvolume list "${1}" | + cut --delimiter " " --fields 9 | + sort + fi +} + bss() { sh_btrfs_subvolume_snapshot "${@}"; } sh_btrfs_subvolume_snapshot() { btrfs \ From ffe24a4c91a471f4cefd73507f8436a6e29a4792 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 13:15:46 +0100 Subject: [PATCH 506/702] git --- sh/{ => cmd}/git.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{ => cmd}/git.sh (100%) diff --git a/sh/git.sh b/sh/cmd/git.sh similarity index 100% rename from sh/git.sh rename to sh/cmd/git.sh From ede62d14ef035e43fcc380808aabba59ef036f77 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 13:16:16 +0100 Subject: [PATCH 507/702] gnome --- sh/{ => cmd}/gnome.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{ => cmd}/gnome.sh (100%) diff --git a/sh/gnome.sh b/sh/cmd/gnome.sh similarity index 100% rename from sh/gnome.sh rename to sh/cmd/gnome.sh From c46896293bb799e1caefe2954cadcf61c5c23892 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:27:43 +0100 Subject: [PATCH 508/702] alias --- sh/{cmd => alias}/git.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/git.sh (100%) diff --git a/sh/cmd/git.sh b/sh/alias/git.sh similarity index 100% rename from sh/cmd/git.sh rename to sh/alias/git.sh From ee10bfe04c8c5729c36baedc43d9f5712221c88e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:31:15 +0100 Subject: [PATCH 509/702] git --- sh/alias/git.sh | 242 ++++++++++++++++++++++++------------------------ 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/sh/alias/git.sh b/sh/alias/git.sh index e8b210e..6cd4311 100644 --- a/sh/alias/git.sh +++ b/sh/alias/git.sh @@ -8,16 +8,16 @@ C %C(blue)%cn %ce %B" # add to index -ga() { sh_git_add "${@}"; } -sh_git_add() { +ga() { sh_alias__git_add "${@}"; } +sh_alias__git_add() { git \ add \ "${@}" } # add all to index -gaa() { sh_git_add_all "${@}"; } -sh_git_add_all() { +gaa() { sh_alias__git_add_all "${@}"; } +sh_alias__git_add_all() { git \ add \ --all \ @@ -25,8 +25,8 @@ sh_git_add_all() { } # add parts of all to index -gaap() { sh_git_add_all_patch "${@}"; } -sh_git_add_all_patch() { +gaap() { sh_alias__git_add_all_patch "${@}"; } +sh_alias__git_add_all_patch() { git \ add \ --all \ @@ -35,8 +35,8 @@ sh_git_add_all_patch() { } # add parts to index -gap() { sh_git_add_patch "${@}"; } -sh_git_add_patch() { +gap() { sh_alias__git_add_patch "${@}"; } +sh_alias__git_add_patch() { git \ add \ --patch \ @@ -44,16 +44,16 @@ sh_git_add_patch() { } # create a branch -gb() { sh_git_branch "${@}"; } -sh_git_branch() { +gb() { sh_alias__git_branch "${@}"; } +sh_alias__git_branch() { git \ branch \ "${@}" } # delete a branch -gbd() { sh_git_branch_delete "${@}"; } -sh_git_branch_delete() { +gbd() { sh_alias__git_branch_delete "${@}"; } +sh_alias__git_branch_delete() { git \ branch \ --delete \ @@ -61,8 +61,8 @@ sh_git_branch_delete() { } # force a branch deletion -gbdf() { sh_git_branch_delete_force "${@}"; } -sh_git_branch_delete_force() { +gbdf() { sh_alias__git_branch_delete_force "${@}"; } +sh_alias__git_branch_delete_force() { git \ branch \ --delete \ @@ -71,8 +71,8 @@ sh_git_branch_delete_force() { } # list branches -gbl() { sh_git_branch_list "${@}"; } -sh_git_branch_list() { +gbl() { sh_alias__git_branch_list "${@}"; } +sh_alias__git_branch_list() { git \ branch \ --all \ @@ -83,8 +83,8 @@ sh_git_branch_list() { } # set the link to a remote branch from a local branch -gbsu() { sh_git_branch_set_upstream "${@}"; } -sh_git_branch_set_upstream() { +gbsu() { sh_alias__git_branch_set_upstream "${@}"; } +sh_alias__git_branch_set_upstream() { git \ branch \ --set-upstream-to \ @@ -92,16 +92,16 @@ sh_git_branch_set_upstream() { } # switch to a branch or checkout file(s) from a commit -gc() { sh_git_checkout "${@}"; } -sh_git_checkout() { +gc() { sh_alias__git_checkout "${@}"; } +sh_alias__git_checkout() { git \ checkout \ "${@}" } # checkout an orphan branch -gco() { sh_git_checkout_orphan "${@}"; } -sh_git_checkout_orphan() { +gco() { sh_alias__git_checkout_orphan "${@}"; } +sh_alias__git_checkout_orphan() { git \ checkout \ --orphan \ @@ -109,16 +109,16 @@ sh_git_checkout_orphan() { } # pick a commit -gcp() { sh_git_cherry_pick "${@}"; } -sh_git_cherry_pick() { +gcp() { sh_alias__git_cherry_pick "${@}"; } +sh_alias__git_cherry_pick() { git \ cherry-pick \ "${@}" } # abort the commit pick -gcpa() { sh_git_cherry_pick_abort "${@}"; } -sh_git_cherry_pick_abort() { +gcpa() { sh_alias__git_cherry_pick_abort "${@}"; } +sh_alias__git_cherry_pick_abort() { git \ cherry-pick \ --abort \ @@ -126,8 +126,8 @@ sh_git_cherry_pick_abort() { } # continue the commit pick -gcpc() { sh_git_cherry_pick_continue "${@}"; } -sh_git_cherry_pick_continue() { +gcpc() { sh_alias__git_cherry_pick_continue "${@}"; } +sh_alias__git_cherry_pick_continue() { git \ cherry-pick \ --continue \ @@ -135,8 +135,8 @@ sh_git_cherry_pick_continue() { } # clean untracked files -gcf() { sh_git_clean_force "${@}"; } -sh_git_clean_force() { +gcf() { sh_alias__git_clean_force "${@}"; } +sh_alias__git_clean_force() { git \ clean \ -d \ @@ -145,8 +145,8 @@ sh_git_clean_force() { } # redo the last commit with a different message -gcam() { sh_git_commit_amend_message "${@}"; } -sh_git_commit_amend_message() { +gcam() { sh_alias__git_commit_amend_message "${@}"; } +sh_alias__git_commit_amend_message() { git \ commit \ --amend \ @@ -155,8 +155,8 @@ sh_git_commit_amend_message() { } # make a root commit -gcem() { sh_git_commit_empty_message "${@}"; } -sh_git_commit_empty_message() { +gcem() { sh_alias__git_commit_empty_message "${@}"; } +sh_alias__git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -166,8 +166,8 @@ sh_git_commit_empty_message() { } # commit the index -gcm() { sh_git_commit_message "${@}"; } -sh_git_commit_message() { +gcm() { sh_alias__git_commit_message "${@}"; } +sh_alias__git_commit_message() { git \ commit \ --message \ @@ -175,8 +175,8 @@ sh_git_commit_message() { } # configure the user email -gcue() { sh_git_config_user_email "${@}"; } -sh_git_config_user_email() { +gcue() { sh_alias__git_config_user_email "${@}"; } +sh_alias__git_config_user_email() { git \ config \ "user.email" \ @@ -184,8 +184,8 @@ sh_git_config_user_email() { } # configure the user name -gcun() { sh_git_config_user_name "${@}"; } -sh_git_config_user_name() { +gcun() { sh_alias__git_config_user_name "${@}"; } +sh_alias__git_config_user_name() { git \ config \ "user.name" \ @@ -193,16 +193,16 @@ sh_git_config_user_name() { } # differences from last or between commits -gd() { sh_git_diff "${@}"; } -sh_git_diff() { +gd() { sh_alias__git_diff "${@}"; } +sh_alias__git_diff() { git \ diff \ "${@}" } # display what is indexed in cache -gdc() { sh_git_diff_cached "${@}"; } -sh_git_diff_cached() { +gdc() { sh_alias__git_diff_cached "${@}"; } +sh_alias__git_diff_cached() { git \ diff \ --cached \ @@ -210,8 +210,8 @@ sh_git_diff_cached() { } # indexed character-level differences -gdcw() { sh_git_diff_cached_word "${@}"; } -sh_git_diff_cached_word() { +gdcw() { sh_alias__git_diff_cached_word "${@}"; } +sh_alias__git_diff_cached_word() { git \ diff \ --cached \ @@ -220,8 +220,8 @@ sh_git_diff_cached_word() { } # differences via external tool -gdt() { sh_git_diff_tool "${@}"; } -sh_git_diff_tool() { +gdt() { sh_alias__git_diff_tool "${@}"; } +sh_alias__git_diff_tool() { git \ difftool \ --dir-diff \ @@ -229,8 +229,8 @@ sh_git_diff_tool() { } # character-level differences -gdw() { sh_git_diff_word "${@}"; } -sh_git_diff_word() { +gdw() { sh_alias__git_diff_word "${@}"; } +sh_alias__git_diff_word() { git \ diff \ --word-diff-regex "." \ @@ -238,8 +238,8 @@ sh_git_diff_word() { } # fetch from the remote repository -gf() { sh_git_fetch "${@}"; } -sh_git_fetch() { +gf() { sh_alias__git_fetch "${@}"; } +sh_alias__git_fetch() { git \ fetch \ --tags \ @@ -248,16 +248,16 @@ sh_git_fetch() { } # fetch from remote repository and prune local orphan branches -gfp() { sh_git_fetch_prune "${@}"; } -sh_git_fetch_prune() { - sh_git_fetch \ +gfp() { sh_alias__git_fetch_prune "${@}"; } +sh_alias__git_fetch_prune() { + sh_alias__git_fetch \ --prune \ "${@}" } # garbage collect all orphan commits -ggc() { sh_git_garbage_collect "${@}"; } -sh_git_garbage_collect() { +ggc() { sh_alias__git_garbage_collect "${@}"; } +sh_alias__git_garbage_collect() { git \ reflog \ expire \ @@ -270,16 +270,16 @@ sh_git_garbage_collect() { } # initialize a new repository -gi() { sh_git_init "${@}"; } -sh_git_init() { +gi() { sh_alias__git_init "${@}"; } +sh_alias__git_init() { git \ init \ "${@}" } # initialize a new bare repository -gib() { sh_git_init_bare "${@}"; } -sh_git_init_bare() { +gib() { sh_alias__git_init_bare "${@}"; } +sh_alias__git_init_bare() { git \ init \ --bare \ @@ -287,8 +287,8 @@ sh_git_init_bare() { } # log history -gl() { sh_git_log "${@}"; } -sh_git_log() { +gl() { sh_alias__git_log "${@}"; } +sh_alias__git_log() { git \ log \ --abbrev=8 \ @@ -299,33 +299,33 @@ sh_git_log() { } # log all history -gla() { sh_git_log_all "${@}"; } -sh_git_log_all() { - sh_git_log \ +gla() { sh_alias__git_log_all "${@}"; } +sh_alias__git_log_all() { + sh_alias__git_log \ --all \ "${@}" } # log all history with patches -glap() { sh_git_log_all_patch "${@}"; } -sh_git_log_all_patch() { - sh_git_log \ +glap() { sh_alias__git_log_all_patch "${@}"; } +sh_alias__git_log_all_patch() { + sh_alias__git_log \ --all \ --patch \ "${@}" } # log history with patches -glp() { sh_git_log_patch "${@}"; } -sh_git_log_patch() { - sh_git_log \ +glp() { sh_alias__git_log_patch "${@}"; } +sh_alias__git_log_patch() { + sh_alias__git_log \ --patch \ "${@}" } # fast-forward merge to remote branch -gm() { sh_git_merge "${@}"; } -sh_git_merge() { +gm() { sh_alias__git_merge "${@}"; } +sh_alias__git_merge() { git \ merge \ --ff-only \ @@ -333,8 +333,8 @@ sh_git_merge() { } # abort the current merge commit -gma() { sh_git_merge_abort "${@}"; } -sh_git_merge_abort() { +gma() { sh_alias__git_merge_abort "${@}"; } +sh_alias__git_merge_abort() { git \ merge \ --abort \ @@ -342,8 +342,8 @@ sh_git_merge_abort() { } # do a merge commit -gmc() { sh_git_merge_commit "${@}"; } -sh_git_merge_commit() { +gmc() { sh_alias__git_merge_commit "${@}"; } +sh_alias__git_merge_commit() { git \ merge \ --no-ff \ @@ -352,8 +352,8 @@ sh_git_merge_commit() { } # squash a branch and index its modifications -gms() { sh_git_merge_squash "${@}"; } -sh_git_merge_squash() { +gms() { sh_alias__git_merge_squash "${@}"; } +sh_alias__git_merge_squash() { git \ merge \ --squash \ @@ -361,16 +361,16 @@ sh_git_merge_squash() { } # merge via external tool -gmt() { sh_git_merge_tool "${@}"; } -sh_git_merge_tool() { +gmt() { sh_alias__git_merge_tool "${@}"; } +sh_alias__git_merge_tool() { git \ mergetool \ "${@}" } # push to the remote repository -gp() { sh_git_push "${@}"; } -sh_git_push() { +gp() { sh_alias__git_push "${@}"; } +sh_alias__git_push() { git \ push \ --tags \ @@ -379,8 +379,8 @@ sh_git_push() { } # delete from the remote repository -gpd() { sh_git_push_delete "${@}"; } -sh_git_push_delete() { +gpd() { sh_alias__git_push_delete "${@}"; } +sh_alias__git_push_delete() { git \ push \ --delete \ @@ -388,24 +388,24 @@ sh_git_push_delete() { } # force the push to the remote repository -gpf() { sh_git_push_force "${@}"; } -sh_git_push_force() { - sh_git_push \ +gpf() { sh_alias__git_push_force "${@}"; } +sh_alias__git_push_force() { + sh_alias__git_push \ --force \ "${@}" } # rebase current branch onto another -grb() { sh_git_re_base "${@}"; } -sh_git_re_base() { +grb() { sh_alias__git_re_base "${@}"; } +sh_alias__git_re_base() { git \ rebase \ "${@}" } # abort current rebase -grba() { sh_git_re_base_abort "${@}"; } -sh_git_re_base_abort() { +grba() { sh_alias__git_re_base_abort "${@}"; } +sh_alias__git_re_base_abort() { git \ rebase \ --abort \ @@ -413,8 +413,8 @@ sh_git_re_base_abort() { } # continue current rebase -grbc() { sh_git_re_base_continue "${@}"; } -sh_git_re_base_continue() { +grbc() { sh_alias__git_re_base_continue "${@}"; } +sh_alias__git_re_base_continue() { git \ rebase \ --continue \ @@ -422,8 +422,8 @@ sh_git_re_base_continue() { } # force rebase without fast-forward -grbf() { sh_git_re_base_force "${@}"; } -sh_git_re_base_force() { +grbf() { sh_alias__git_re_base_force "${@}"; } +sh_alias__git_re_base_force() { git \ rebase \ --force-rebase \ @@ -431,8 +431,8 @@ sh_git_re_base_force() { } # rebase interactively -grbi() { sh_git_re_base_interactive "${@}"; } -sh_git_re_base_interactive() { +grbi() { sh_alias__git_re_base_interactive "${@}"; } +sh_alias__git_re_base_interactive() { git \ rebase \ --interactive \ @@ -440,8 +440,8 @@ sh_git_re_base_interactive() { } # add a new remote repository -grma() { sh_git_re_mote_add "${@}"; } -sh_git_re_mote_add() { +grma() { sh_alias__git_re_mote_add "${@}"; } +sh_alias__git_re_mote_add() { git \ remote \ add \ @@ -449,8 +449,8 @@ sh_git_re_mote_add() { } # list remote repositories -grml() { sh_git_re_mote_list "${@}"; } -sh_git_re_mote_list() { +grml() { sh_alias__git_re_mote_list "${@}"; } +sh_alias__git_re_mote_list() { git \ remote \ --verbose \ @@ -458,8 +458,8 @@ sh_git_re_mote_list() { } # set the location of a remote repository -grmsu() { sh_git_re_mote_set_upstream "${@}"; } -sh_git_re_mote_set_upstream() { +grmsu() { sh_alias__git_re_mote_set_upstream "${@}"; } +sh_alias__git_re_mote_set_upstream() { git \ remote \ set-url \ @@ -467,8 +467,8 @@ sh_git_re_mote_set_upstream() { } # show connection to a remote repository -grms() { sh_git_re_mote_show "${@}"; } -sh_git_re_mote_show() { +grms() { sh_alias__git_re_mote_show "${@}"; } +sh_alias__git_re_mote_show() { git \ remote \ show \ @@ -476,24 +476,24 @@ sh_git_re_mote_show() { } # remove and add removal to index -grm() { sh_git_re_move "${@}"; } -sh_git_re_move() { +grm() { sh_alias__git_re_move "${@}"; } +sh_alias__git_re_move() { git \ rm \ "${@}" } # remove file(s) from index or move current branch pointer -grs() { sh_git_re_set "${@}"; } -sh_git_re_set() { +grs() { sh_alias__git_re_set "${@}"; } +sh_alias__git_re_set() { git \ reset \ "${@}" } # wipe modifications or reset current branch to another commit -grsh() { sh_git_re_set_hard "${@}"; } -sh_git_re_set_hard() { +grsh() { sh_alias__git_re_set_hard "${@}"; } +sh_alias__git_re_set_hard() { git \ reset \ --hard \ @@ -501,16 +501,16 @@ sh_git_re_set_hard() { } # show a commit -gsc() { sh_git_show_commit "${@}"; } -sh_git_show_commit() { +gsc() { sh_alias__git_show_commit "${@}"; } +sh_alias__git_show_commit() { git \ show \ "${@}" } # current state of repository -gs() { sh_git_status "${@}"; } -sh_git_status() { +gs() { sh_alias__git_status "${@}"; } +sh_alias__git_status() { git \ status \ --untracked-files="all" \ @@ -518,16 +518,16 @@ sh_git_status() { } # tag a commit -gt() { sh_git_tag "${@}"; } -sh_git_tag() { +gt() { sh_alias__git_tag "${@}"; } +sh_alias__git_tag() { git \ tag \ "${@}" } # delete a tag -gtd() { sh_git_tag_delete "${@}"; } -sh_git_tag_delete() { +gtd() { sh_alias__git_tag_delete "${@}"; } +sh_alias__git_tag_delete() { git \ tag \ --delete \ From f96bcd9a9fbcad4da14017a92a5765be0361b531 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:33:59 +0100 Subject: [PATCH 510/702] mv --- sh/{cmd => alias}/btrfs.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/btrfs.sh (100%) diff --git a/sh/cmd/btrfs.sh b/sh/alias/btrfs.sh similarity index 100% rename from sh/cmd/btrfs.sh rename to sh/alias/btrfs.sh From aceca1fc69329d43ea6414f5556e5fee53f82b6e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:35:14 +0100 Subject: [PATCH 511/702] btrfs --- sh/alias/btrfs.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sh/alias/btrfs.sh b/sh/alias/btrfs.sh index fd880c1..3ec74fb 100644 --- a/sh/alias/btrfs.sh +++ b/sh/alias/btrfs.sh @@ -1,13 +1,13 @@ -bfdf() { sh_btrfs_filesystem_d_f "${@}"; } -sh_btrfs_filesystem_d_f() { +bfdf() { sh_a__btrfs_filesystem_d_f "${@}"; } +sh_a__btrfs_filesystem_d_f() { btrfs \ filesystem \ df \ "${@}" } -bfdu() { sh_btrfs_filesystem_d_u "${@}"; } -sh_btrfs_filesystem_d_u() { +bfdu() { sh_a__btrfs_filesystem_d_u "${@}"; } +sh_a__btrfs_filesystem_d_u() { btrfs \ filesystem \ du \ @@ -15,40 +15,40 @@ sh_btrfs_filesystem_d_u() { "${@}" } -bfu() { sh_btrfs_filesystem_usage "${@}"; } -sh_btrfs_filesystem_usage() { +bfu() { sh_a__btrfs_filesystem_usage "${@}"; } +sh_a__btrfs_filesystem_usage() { btrfs \ filesystem \ usage \ "${@}" } -bpg() { sh_btrfs_property_get "${@}"; } -sh_btrfs_property_get() { +bpg() { sh_a__btrfs_property_get "${@}"; } +sh_a__btrfs_property_get() { btrfs \ property \ get \ "${@}" } -bsc() { sh_btrfs_subvolume_create "${@}"; } -sh_btrfs_subvolume_create() { +bsc() { sh_a__btrfs_subvolume_create "${@}"; } +sh_a__btrfs_subvolume_create() { btrfs \ subvolume \ create \ "${@}" } -bsd() { sh_btrfs_subvolume_delete "${@}"; } -sh_btrfs_subvolume_delete() { +bsd() { sh_a__btrfs_subvolume_delete "${@}"; } +sh_a__btrfs_subvolume_delete() { btrfs \ subvolume \ delete \ "${@}" } -bsl() { sh_btrfs_subvolume_list "${@}"; } -sh_btrfs_subvolume_list() { +bsl() { sh_a__btrfs_subvolume_list "${@}"; } +sh_a__btrfs_subvolume_list() { if [ -n "${1}" ]; then btrfs subvolume list "${1}" | cut --delimiter " " --fields 9 | @@ -56,16 +56,16 @@ sh_btrfs_subvolume_list() { fi } -bss() { sh_btrfs_subvolume_snapshot "${@}"; } -sh_btrfs_subvolume_snapshot() { +bss() { sh_a__btrfs_subvolume_snapshot "${@}"; } +sh_a__btrfs_subvolume_snapshot() { btrfs \ subvolume \ snapshot \ "${@}" } -bssr() { sh_btrfs_subvolume_snapshot_r "${@}"; } -sh_btrfs_subvolume_snapshot_r() { +bssr() { sh_a__btrfs_subvolume_snapshot_r "${@}"; } +sh_a__btrfs_subvolume_snapshot_r() { btrfs \ subvolume \ snapshot -r \ From 92010392aed8e8b9d00e25c94d63ce7a54eeae0a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:39:06 +0100 Subject: [PATCH 512/702] git --- sh/alias/git.sh | 242 ++++++++++++++++++++++++------------------------ 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/sh/alias/git.sh b/sh/alias/git.sh index 6cd4311..864620b 100644 --- a/sh/alias/git.sh +++ b/sh/alias/git.sh @@ -8,16 +8,16 @@ C %C(blue)%cn %ce %B" # add to index -ga() { sh_alias__git_add "${@}"; } -sh_alias__git_add() { +ga() { sh_a__git_add "${@}"; } +sh_a__git_add() { git \ add \ "${@}" } # add all to index -gaa() { sh_alias__git_add_all "${@}"; } -sh_alias__git_add_all() { +gaa() { sh_a__git_add_all "${@}"; } +sh_a__git_add_all() { git \ add \ --all \ @@ -25,8 +25,8 @@ sh_alias__git_add_all() { } # add parts of all to index -gaap() { sh_alias__git_add_all_patch "${@}"; } -sh_alias__git_add_all_patch() { +gaap() { sh_a__git_add_all_patch "${@}"; } +sh_a__git_add_all_patch() { git \ add \ --all \ @@ -35,8 +35,8 @@ sh_alias__git_add_all_patch() { } # add parts to index -gap() { sh_alias__git_add_patch "${@}"; } -sh_alias__git_add_patch() { +gap() { sh_a__git_add_patch "${@}"; } +sh_a__git_add_patch() { git \ add \ --patch \ @@ -44,16 +44,16 @@ sh_alias__git_add_patch() { } # create a branch -gb() { sh_alias__git_branch "${@}"; } -sh_alias__git_branch() { +gb() { sh_a__git_branch "${@}"; } +sh_a__git_branch() { git \ branch \ "${@}" } # delete a branch -gbd() { sh_alias__git_branch_delete "${@}"; } -sh_alias__git_branch_delete() { +gbd() { sh_a__git_branch_delete "${@}"; } +sh_a__git_branch_delete() { git \ branch \ --delete \ @@ -61,8 +61,8 @@ sh_alias__git_branch_delete() { } # force a branch deletion -gbdf() { sh_alias__git_branch_delete_force "${@}"; } -sh_alias__git_branch_delete_force() { +gbdf() { sh_a__git_branch_delete_force "${@}"; } +sh_a__git_branch_delete_force() { git \ branch \ --delete \ @@ -71,8 +71,8 @@ sh_alias__git_branch_delete_force() { } # list branches -gbl() { sh_alias__git_branch_list "${@}"; } -sh_alias__git_branch_list() { +gbl() { sh_a__git_branch_list "${@}"; } +sh_a__git_branch_list() { git \ branch \ --all \ @@ -83,8 +83,8 @@ sh_alias__git_branch_list() { } # set the link to a remote branch from a local branch -gbsu() { sh_alias__git_branch_set_upstream "${@}"; } -sh_alias__git_branch_set_upstream() { +gbsu() { sh_a__git_branch_set_upstream "${@}"; } +sh_a__git_branch_set_upstream() { git \ branch \ --set-upstream-to \ @@ -92,16 +92,16 @@ sh_alias__git_branch_set_upstream() { } # switch to a branch or checkout file(s) from a commit -gc() { sh_alias__git_checkout "${@}"; } -sh_alias__git_checkout() { +gc() { sh_a__git_checkout "${@}"; } +sh_a__git_checkout() { git \ checkout \ "${@}" } # checkout an orphan branch -gco() { sh_alias__git_checkout_orphan "${@}"; } -sh_alias__git_checkout_orphan() { +gco() { sh_a__git_checkout_orphan "${@}"; } +sh_a__git_checkout_orphan() { git \ checkout \ --orphan \ @@ -109,16 +109,16 @@ sh_alias__git_checkout_orphan() { } # pick a commit -gcp() { sh_alias__git_cherry_pick "${@}"; } -sh_alias__git_cherry_pick() { +gcp() { sh_a__git_cherry_pick "${@}"; } +sh_a__git_cherry_pick() { git \ cherry-pick \ "${@}" } # abort the commit pick -gcpa() { sh_alias__git_cherry_pick_abort "${@}"; } -sh_alias__git_cherry_pick_abort() { +gcpa() { sh_a__git_cherry_pick_abort "${@}"; } +sh_a__git_cherry_pick_abort() { git \ cherry-pick \ --abort \ @@ -126,8 +126,8 @@ sh_alias__git_cherry_pick_abort() { } # continue the commit pick -gcpc() { sh_alias__git_cherry_pick_continue "${@}"; } -sh_alias__git_cherry_pick_continue() { +gcpc() { sh_a__git_cherry_pick_continue "${@}"; } +sh_a__git_cherry_pick_continue() { git \ cherry-pick \ --continue \ @@ -135,8 +135,8 @@ sh_alias__git_cherry_pick_continue() { } # clean untracked files -gcf() { sh_alias__git_clean_force "${@}"; } -sh_alias__git_clean_force() { +gcf() { sh_a__git_clean_force "${@}"; } +sh_a__git_clean_force() { git \ clean \ -d \ @@ -145,8 +145,8 @@ sh_alias__git_clean_force() { } # redo the last commit with a different message -gcam() { sh_alias__git_commit_amend_message "${@}"; } -sh_alias__git_commit_amend_message() { +gcam() { sh_a__git_commit_amend_message "${@}"; } +sh_a__git_commit_amend_message() { git \ commit \ --amend \ @@ -155,8 +155,8 @@ sh_alias__git_commit_amend_message() { } # make a root commit -gcem() { sh_alias__git_commit_empty_message "${@}"; } -sh_alias__git_commit_empty_message() { +gcem() { sh_a__git_commit_empty_message "${@}"; } +sh_a__git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -166,8 +166,8 @@ sh_alias__git_commit_empty_message() { } # commit the index -gcm() { sh_alias__git_commit_message "${@}"; } -sh_alias__git_commit_message() { +gcm() { sh_a__git_commit_message "${@}"; } +sh_a__git_commit_message() { git \ commit \ --message \ @@ -175,8 +175,8 @@ sh_alias__git_commit_message() { } # configure the user email -gcue() { sh_alias__git_config_user_email "${@}"; } -sh_alias__git_config_user_email() { +gcue() { sh_a__git_config_user_email "${@}"; } +sh_a__git_config_user_email() { git \ config \ "user.email" \ @@ -184,8 +184,8 @@ sh_alias__git_config_user_email() { } # configure the user name -gcun() { sh_alias__git_config_user_name "${@}"; } -sh_alias__git_config_user_name() { +gcun() { sh_a__git_config_user_name "${@}"; } +sh_a__git_config_user_name() { git \ config \ "user.name" \ @@ -193,16 +193,16 @@ sh_alias__git_config_user_name() { } # differences from last or between commits -gd() { sh_alias__git_diff "${@}"; } -sh_alias__git_diff() { +gd() { sh_a__git_diff "${@}"; } +sh_a__git_diff() { git \ diff \ "${@}" } # display what is indexed in cache -gdc() { sh_alias__git_diff_cached "${@}"; } -sh_alias__git_diff_cached() { +gdc() { sh_a__git_diff_cached "${@}"; } +sh_a__git_diff_cached() { git \ diff \ --cached \ @@ -210,8 +210,8 @@ sh_alias__git_diff_cached() { } # indexed character-level differences -gdcw() { sh_alias__git_diff_cached_word "${@}"; } -sh_alias__git_diff_cached_word() { +gdcw() { sh_a__git_diff_cached_word "${@}"; } +sh_a__git_diff_cached_word() { git \ diff \ --cached \ @@ -220,8 +220,8 @@ sh_alias__git_diff_cached_word() { } # differences via external tool -gdt() { sh_alias__git_diff_tool "${@}"; } -sh_alias__git_diff_tool() { +gdt() { sh_a__git_diff_tool "${@}"; } +sh_a__git_diff_tool() { git \ difftool \ --dir-diff \ @@ -229,8 +229,8 @@ sh_alias__git_diff_tool() { } # character-level differences -gdw() { sh_alias__git_diff_word "${@}"; } -sh_alias__git_diff_word() { +gdw() { sh_a__git_diff_word "${@}"; } +sh_a__git_diff_word() { git \ diff \ --word-diff-regex "." \ @@ -238,8 +238,8 @@ sh_alias__git_diff_word() { } # fetch from the remote repository -gf() { sh_alias__git_fetch "${@}"; } -sh_alias__git_fetch() { +gf() { sh_a__git_fetch "${@}"; } +sh_a__git_fetch() { git \ fetch \ --tags \ @@ -248,16 +248,16 @@ sh_alias__git_fetch() { } # fetch from remote repository and prune local orphan branches -gfp() { sh_alias__git_fetch_prune "${@}"; } -sh_alias__git_fetch_prune() { - sh_alias__git_fetch \ +gfp() { sh_a__git_fetch_prune "${@}"; } +sh_a__git_fetch_prune() { + sh_a__git_fetch \ --prune \ "${@}" } # garbage collect all orphan commits -ggc() { sh_alias__git_garbage_collect "${@}"; } -sh_alias__git_garbage_collect() { +ggc() { sh_a__git_garbage_collect "${@}"; } +sh_a__git_garbage_collect() { git \ reflog \ expire \ @@ -270,16 +270,16 @@ sh_alias__git_garbage_collect() { } # initialize a new repository -gi() { sh_alias__git_init "${@}"; } -sh_alias__git_init() { +gi() { sh_a__git_init "${@}"; } +sh_a__git_init() { git \ init \ "${@}" } # initialize a new bare repository -gib() { sh_alias__git_init_bare "${@}"; } -sh_alias__git_init_bare() { +gib() { sh_a__git_init_bare "${@}"; } +sh_a__git_init_bare() { git \ init \ --bare \ @@ -287,8 +287,8 @@ sh_alias__git_init_bare() { } # log history -gl() { sh_alias__git_log "${@}"; } -sh_alias__git_log() { +gl() { sh_a__git_log "${@}"; } +sh_a__git_log() { git \ log \ --abbrev=8 \ @@ -299,33 +299,33 @@ sh_alias__git_log() { } # log all history -gla() { sh_alias__git_log_all "${@}"; } -sh_alias__git_log_all() { - sh_alias__git_log \ +gla() { sh_a__git_log_all "${@}"; } +sh_a__git_log_all() { + sh_a__git_log \ --all \ "${@}" } # log all history with patches -glap() { sh_alias__git_log_all_patch "${@}"; } -sh_alias__git_log_all_patch() { - sh_alias__git_log \ +glap() { sh_a__git_log_all_patch "${@}"; } +sh_a__git_log_all_patch() { + sh_a__git_log \ --all \ --patch \ "${@}" } # log history with patches -glp() { sh_alias__git_log_patch "${@}"; } -sh_alias__git_log_patch() { - sh_alias__git_log \ +glp() { sh_a__git_log_patch "${@}"; } +sh_a__git_log_patch() { + sh_a__git_log \ --patch \ "${@}" } # fast-forward merge to remote branch -gm() { sh_alias__git_merge "${@}"; } -sh_alias__git_merge() { +gm() { sh_a__git_merge "${@}"; } +sh_a__git_merge() { git \ merge \ --ff-only \ @@ -333,8 +333,8 @@ sh_alias__git_merge() { } # abort the current merge commit -gma() { sh_alias__git_merge_abort "${@}"; } -sh_alias__git_merge_abort() { +gma() { sh_a__git_merge_abort "${@}"; } +sh_a__git_merge_abort() { git \ merge \ --abort \ @@ -342,8 +342,8 @@ sh_alias__git_merge_abort() { } # do a merge commit -gmc() { sh_alias__git_merge_commit "${@}"; } -sh_alias__git_merge_commit() { +gmc() { sh_a__git_merge_commit "${@}"; } +sh_a__git_merge_commit() { git \ merge \ --no-ff \ @@ -352,8 +352,8 @@ sh_alias__git_merge_commit() { } # squash a branch and index its modifications -gms() { sh_alias__git_merge_squash "${@}"; } -sh_alias__git_merge_squash() { +gms() { sh_a__git_merge_squash "${@}"; } +sh_a__git_merge_squash() { git \ merge \ --squash \ @@ -361,16 +361,16 @@ sh_alias__git_merge_squash() { } # merge via external tool -gmt() { sh_alias__git_merge_tool "${@}"; } -sh_alias__git_merge_tool() { +gmt() { sh_a__git_merge_tool "${@}"; } +sh_a__git_merge_tool() { git \ mergetool \ "${@}" } # push to the remote repository -gp() { sh_alias__git_push "${@}"; } -sh_alias__git_push() { +gp() { sh_a__git_push "${@}"; } +sh_a__git_push() { git \ push \ --tags \ @@ -379,8 +379,8 @@ sh_alias__git_push() { } # delete from the remote repository -gpd() { sh_alias__git_push_delete "${@}"; } -sh_alias__git_push_delete() { +gpd() { sh_a__git_push_delete "${@}"; } +sh_a__git_push_delete() { git \ push \ --delete \ @@ -388,24 +388,24 @@ sh_alias__git_push_delete() { } # force the push to the remote repository -gpf() { sh_alias__git_push_force "${@}"; } -sh_alias__git_push_force() { - sh_alias__git_push \ +gpf() { sh_a__git_push_force "${@}"; } +sh_a__git_push_force() { + sh_a__git_push \ --force \ "${@}" } # rebase current branch onto another -grb() { sh_alias__git_re_base "${@}"; } -sh_alias__git_re_base() { +grb() { sh_a__git_re_base "${@}"; } +sh_a__git_re_base() { git \ rebase \ "${@}" } # abort current rebase -grba() { sh_alias__git_re_base_abort "${@}"; } -sh_alias__git_re_base_abort() { +grba() { sh_a__git_re_base_abort "${@}"; } +sh_a__git_re_base_abort() { git \ rebase \ --abort \ @@ -413,8 +413,8 @@ sh_alias__git_re_base_abort() { } # continue current rebase -grbc() { sh_alias__git_re_base_continue "${@}"; } -sh_alias__git_re_base_continue() { +grbc() { sh_a__git_re_base_continue "${@}"; } +sh_a__git_re_base_continue() { git \ rebase \ --continue \ @@ -422,8 +422,8 @@ sh_alias__git_re_base_continue() { } # force rebase without fast-forward -grbf() { sh_alias__git_re_base_force "${@}"; } -sh_alias__git_re_base_force() { +grbf() { sh_a__git_re_base_force "${@}"; } +sh_a__git_re_base_force() { git \ rebase \ --force-rebase \ @@ -431,8 +431,8 @@ sh_alias__git_re_base_force() { } # rebase interactively -grbi() { sh_alias__git_re_base_interactive "${@}"; } -sh_alias__git_re_base_interactive() { +grbi() { sh_a__git_re_base_interactive "${@}"; } +sh_a__git_re_base_interactive() { git \ rebase \ --interactive \ @@ -440,8 +440,8 @@ sh_alias__git_re_base_interactive() { } # add a new remote repository -grma() { sh_alias__git_re_mote_add "${@}"; } -sh_alias__git_re_mote_add() { +grma() { sh_a__git_re_mote_add "${@}"; } +sh_a__git_re_mote_add() { git \ remote \ add \ @@ -449,8 +449,8 @@ sh_alias__git_re_mote_add() { } # list remote repositories -grml() { sh_alias__git_re_mote_list "${@}"; } -sh_alias__git_re_mote_list() { +grml() { sh_a__git_re_mote_list "${@}"; } +sh_a__git_re_mote_list() { git \ remote \ --verbose \ @@ -458,8 +458,8 @@ sh_alias__git_re_mote_list() { } # set the location of a remote repository -grmsu() { sh_alias__git_re_mote_set_upstream "${@}"; } -sh_alias__git_re_mote_set_upstream() { +grmsu() { sh_a__git_re_mote_set_upstream "${@}"; } +sh_a__git_re_mote_set_upstream() { git \ remote \ set-url \ @@ -467,8 +467,8 @@ sh_alias__git_re_mote_set_upstream() { } # show connection to a remote repository -grms() { sh_alias__git_re_mote_show "${@}"; } -sh_alias__git_re_mote_show() { +grms() { sh_a__git_re_mote_show "${@}"; } +sh_a__git_re_mote_show() { git \ remote \ show \ @@ -476,24 +476,24 @@ sh_alias__git_re_mote_show() { } # remove and add removal to index -grm() { sh_alias__git_re_move "${@}"; } -sh_alias__git_re_move() { +grm() { sh_a__git_re_move "${@}"; } +sh_a__git_re_move() { git \ rm \ "${@}" } # remove file(s) from index or move current branch pointer -grs() { sh_alias__git_re_set "${@}"; } -sh_alias__git_re_set() { +grs() { sh_a__git_re_set "${@}"; } +sh_a__git_re_set() { git \ reset \ "${@}" } # wipe modifications or reset current branch to another commit -grsh() { sh_alias__git_re_set_hard "${@}"; } -sh_alias__git_re_set_hard() { +grsh() { sh_a__git_re_set_hard "${@}"; } +sh_a__git_re_set_hard() { git \ reset \ --hard \ @@ -501,16 +501,16 @@ sh_alias__git_re_set_hard() { } # show a commit -gsc() { sh_alias__git_show_commit "${@}"; } -sh_alias__git_show_commit() { +gsc() { sh_a__git_show_commit "${@}"; } +sh_a__git_show_commit() { git \ show \ "${@}" } # current state of repository -gs() { sh_alias__git_status "${@}"; } -sh_alias__git_status() { +gs() { sh_a__git_status "${@}"; } +sh_a__git_status() { git \ status \ --untracked-files="all" \ @@ -518,16 +518,16 @@ sh_alias__git_status() { } # tag a commit -gt() { sh_alias__git_tag "${@}"; } -sh_alias__git_tag() { +gt() { sh_a__git_tag "${@}"; } +sh_a__git_tag() { git \ tag \ "${@}" } # delete a tag -gtd() { sh_alias__git_tag_delete "${@}"; } -sh_alias__git_tag_delete() { +gtd() { sh_a__git_tag_delete "${@}"; } +sh_a__git_tag_delete() { git \ tag \ --delete \ From f77081fd17f831f30972d50ddea169db153bb240 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:42:18 +0100 Subject: [PATCH 513/702] mv --- sh/{cmd => alias}/nano.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/nano.sh (100%) diff --git a/sh/cmd/nano.sh b/sh/alias/nano.sh similarity index 100% rename from sh/cmd/nano.sh rename to sh/alias/nano.sh From 95df4c78e51a0c58edb69aa5d2711fbc9f991174 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:45:04 +0100 Subject: [PATCH 514/702] nano --- sh/alias/nano.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/nano.sh b/sh/alias/nano.sh index 2718583..ca6eb65 100644 --- a/sh/alias/nano.sh +++ b/sh/alias/nano.sh @@ -1,4 +1,5 @@ -nn() { +nn() { sh_a__na_no "${@}"; } +sh_a__na_no() { nano \ "${@}" } From ab509523173a838af68d9f0b1506086afc87053f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 14:46:59 +0100 Subject: [PATCH 515/702] mv --- sh/{cmd => alias}/byobu.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/byobu.sh (100%) diff --git a/sh/cmd/byobu.sh b/sh/alias/byobu.sh similarity index 100% rename from sh/cmd/byobu.sh rename to sh/alias/byobu.sh From 75c3627d2c71dd7b9d303d5e6eab85e32c8d92df Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:07:17 +0100 Subject: [PATCH 516/702] byobu --- sh/alias/byobu.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sh/alias/byobu.sh b/sh/alias/byobu.sh index d645cb1..79155b5 100644 --- a/sh/alias/byobu.sh +++ b/sh/alias/byobu.sh @@ -1,21 +1,25 @@ -bb() { +bb() { sh_a__byo_bu "${@}"; } +sh_a__byo_bu() { byobu \ "${@}" } -bba() { +bba() { sh_a__byo_bu_attach "${@}"; } +sh_a__byo_bu_attach() { byobu \ attach-session \ "${@}" } -bbl() { +bbl() { sh_a__byo_bu_ls "${@}"; } +sh_a__byo_bu_ls() { byobu \ ls \ "${@}" } -bbnd() { +bbnd() { sh_a__byo_bu_new_detach "${@}"; } +sh_a__byo_bu_new_detach() { byobu \ new-session \ -d \ From c7430d275ad04c5cc2c03cd9b64897c9677cd74f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:17:11 +0100 Subject: [PATCH 517/702] mv --- sh/{cmd => alias}/evince.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/evince.sh (100%) diff --git a/sh/cmd/evince.sh b/sh/alias/evince.sh similarity index 100% rename from sh/cmd/evince.sh rename to sh/alias/evince.sh From 7df87a0517b710331bbfc66e72b0bbf23cc291b9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:17:50 +0100 Subject: [PATCH 518/702] evince --- sh/alias/evince.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/evince.sh b/sh/alias/evince.sh index 01ec950..3c609ef 100644 --- a/sh/alias/evince.sh +++ b/sh/alias/evince.sh @@ -1,4 +1,5 @@ -ev() { +ev() { sh_a__e_vince "${@}"; } +sh_a__e_vince() { evince \ "${@}" } From 6d000b2ead23e49f48ed06f93c4530e3d573637b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:18:29 +0100 Subject: [PATCH 519/702] mv --- sh/{cmd => alias}/pass.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/pass.sh (100%) diff --git a/sh/cmd/pass.sh b/sh/alias/pass.sh similarity index 100% rename from sh/cmd/pass.sh rename to sh/alias/pass.sh From 464d23cba3b5c6f510d5f710d2783189928b6931 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:19:29 +0100 Subject: [PATCH 520/702] pass --- sh/alias/pass.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/pass.sh b/sh/alias/pass.sh index ddcfa48..e94898a 100644 --- a/sh/alias/pass.sh +++ b/sh/alias/pass.sh @@ -1,11 +1,13 @@ # display pass entry’s content -p() { +p() { sh_a__pass "${@}"; } +sh_a__pass() { pass \ "${@}" } # copy passphrase into clipboard -pc() { +pc() { sh_a__pass_clip "${@}"; } +sh_a__pass_clip() { pass \ --clip \ "${@}" From 1ef0f04b0776e2a6bf5a5dffdfdd9efe64ae5004 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:22:47 +0100 Subject: [PATCH 521/702] mv --- sh/{cmd => alias}/tmux.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/tmux.sh (100%) diff --git a/sh/cmd/tmux.sh b/sh/alias/tmux.sh similarity index 100% rename from sh/cmd/tmux.sh rename to sh/alias/tmux.sh From 078d3b783e9c9ae6bd618b92ec2ce8bc47b84509 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:23:25 +0100 Subject: [PATCH 522/702] tmux --- sh/alias/tmux.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/tmux.sh b/sh/alias/tmux.sh index fa96b6a..fa51bd5 100644 --- a/sh/alias/tmux.sh +++ b/sh/alias/tmux.sh @@ -1,4 +1,5 @@ -tm() { +tm() { sh_a__t_mux "${@}"; } +sh_a__t_mux() { tmux \ "${@}" } From 8d01c89dc10e2d137335b354c3d49b15fd017109 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:24:12 +0100 Subject: [PATCH 523/702] mv --- sh/{cmd => alias}/newsboat.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/newsboat.sh (100%) diff --git a/sh/cmd/newsboat.sh b/sh/alias/newsboat.sh similarity index 100% rename from sh/cmd/newsboat.sh rename to sh/alias/newsboat.sh From be22e290f483159f518ace2cdd33aaeac3d6ff56 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:25:06 +0100 Subject: [PATCH 524/702] newsboat --- sh/alias/newsboat.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/alias/newsboat.sh b/sh/alias/newsboat.sh index adbfd37..18c09e3 100644 --- a/sh/alias/newsboat.sh +++ b/sh/alias/newsboat.sh @@ -1,5 +1,5 @@ -nb() { news_boat "${@}"; } -news_boat() { +nb() { sh_a__news_boat "${@}"; } +sh_a__news_boat() { newsboat \ "${@}" } From 9522c537b4b6a392d18ef82bc0683d309c2a07f7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:25:31 +0100 Subject: [PATCH 525/702] mv --- sh/{cmd => alias}/emacs.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/emacs.sh (100%) diff --git a/sh/cmd/emacs.sh b/sh/alias/emacs.sh similarity index 100% rename from sh/cmd/emacs.sh rename to sh/alias/emacs.sh From 63deee73265375f81264de82770348379b670237 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:26:03 +0100 Subject: [PATCH 526/702] emacs --- sh/alias/emacs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/emacs.sh b/sh/alias/emacs.sh index 8bd77fc..84fc56f 100644 --- a/sh/alias/emacs.sh +++ b/sh/alias/emacs.sh @@ -1,4 +1,5 @@ -em() { +em() { sh_a__e_macs "${@}"; } +sh_a__e_macs() { emacs \ "${@}" } From 0f312f6c853632df75cce201a7ed96b37da77539 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:30:45 +0100 Subject: [PATCH 527/702] mv --- sh/{cmd => alias}/rm.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/rm.sh (100%) diff --git a/sh/cmd/rm.sh b/sh/alias/rm.sh similarity index 100% rename from sh/cmd/rm.sh rename to sh/alias/rm.sh From dcc82f1cf77e6ab4ca925a14a0886a5801795b5b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:31:30 +0100 Subject: [PATCH 528/702] rm --- sh/alias/rm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/rm.sh b/sh/alias/rm.sh index 0d42f42..f944698 100644 --- a/sh/alias/rm.sh +++ b/sh/alias/rm.sh @@ -1,5 +1,6 @@ # remove interactively -rmi() { +rmi() { sh_a__re_move_interactive "${@}"; } +sh_a__re_move_interactive() { rm \ --interactive \ "${@}" From baa163b5b2c93468a14103e7c778b1ee7c8be606 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:33:10 +0100 Subject: [PATCH 529/702] mv --- sh/{cmd => alias}/clear.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/clear.sh (100%) diff --git a/sh/cmd/clear.sh b/sh/alias/clear.sh similarity index 100% rename from sh/cmd/clear.sh rename to sh/alias/clear.sh From b2df5a6eb5804e8c4e1001d37fc7355bd364756c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:33:44 +0100 Subject: [PATCH 530/702] clear --- sh/alias/clear.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/clear.sh b/sh/alias/clear.sh index 6a69638..9731fe0 100644 --- a/sh/alias/clear.sh +++ b/sh/alias/clear.sh @@ -1,5 +1,6 @@ # clear terminal -c() { +c() { sh_a__clear "${@}"; } +sh_a__clear() { clear \ "${@}" } From 53957e5690e75f32ebc873092f7af546d89a9290 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:34:30 +0100 Subject: [PATCH 531/702] mv --- sh/{cmd => alias}/cp.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/cp.sh (100%) diff --git a/sh/cmd/cp.sh b/sh/alias/cp.sh similarity index 100% rename from sh/cmd/cp.sh rename to sh/alias/cp.sh From 743b82cb2d6c6d428e6dab087eee2985464f970a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:35:18 +0100 Subject: [PATCH 532/702] cp --- sh/alias/cp.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/cp.sh b/sh/alias/cp.sh index 5db0082..dd1a271 100644 --- a/sh/alias/cp.sh +++ b/sh/alias/cp.sh @@ -1,5 +1,6 @@ # copy interactively -cpi() { +cpi() { sh_a__co_py_interactive "${@}"; } +sh_a__co_py_interactive() { cp \ --interactive \ "${@}" From 08179f386e96a6fae366e418e0ed2cfb1e2f2e18 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:35:54 +0100 Subject: [PATCH 533/702] mv --- sh/{cmd => alias}/mv.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/mv.sh (100%) diff --git a/sh/cmd/mv.sh b/sh/alias/mv.sh similarity index 100% rename from sh/cmd/mv.sh rename to sh/alias/mv.sh From 97e985f2667533a00bfc74899e83e8e414052dc3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:36:57 +0100 Subject: [PATCH 534/702] mvi --- sh/alias/mv.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/mv.sh b/sh/alias/mv.sh index 89d6efd..2a4ae5e 100644 --- a/sh/alias/mv.sh +++ b/sh/alias/mv.sh @@ -1,5 +1,6 @@ # move interactively -mvi() { +mvi() { sh_a__mo_ve_interactive "${@}"; } +sh_a__mo_ve_interactive() { mv \ --interactive \ "${@}" From 15dfd51681682844c40a0d09eadbe17e7bc926a6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:38:27 +0100 Subject: [PATCH 535/702] mv --- sh/{cmd => alias}/tree.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/tree.sh (100%) diff --git a/sh/cmd/tree.sh b/sh/alias/tree.sh similarity index 100% rename from sh/cmd/tree.sh rename to sh/alias/tree.sh From 491dc1fa1cd4507213b7a385940474c4b4388805 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 15:39:27 +0100 Subject: [PATCH 536/702] tree --- sh/alias/tree.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/tree.sh b/sh/alias/tree.sh index c96738c..9d807c0 100644 --- a/sh/alias/tree.sh +++ b/sh/alias/tree.sh @@ -1,9 +1,11 @@ -t() { +t() { sh_a__tree "${@}"; } +sh_a__tree() { tree \ "${@}" } -ta() { +ta() { sh_a__tree_all "${@}"; } +sh_a__tree_all() { tree \ -a \ "${@}" From 6a7800e19e34bb014671e654a4061ec035dcc3b8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:08:55 +0100 Subject: [PATCH 537/702] cp --- sh/alias/mount.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sh/alias/mount.sh diff --git a/sh/alias/mount.sh b/sh/alias/mount.sh new file mode 100644 index 0000000..d6329c3 --- /dev/null +++ b/sh/alias/mount.sh @@ -0,0 +1,11 @@ +m() { + mount \ + "${@}" +} + +# remount read-only medium in read-write +remount() { + mount \ + -o "remount,rw" \ + "/usr/lib/live/mount/medium" +} From 22c9a661621432a05e2b4aa258c8b96dba478dbb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:10:14 +0100 Subject: [PATCH 538/702] m --- sh/alias/mount.sh | 10 ++-------- sh/cmd/mount.sh | 5 ----- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/sh/alias/mount.sh b/sh/alias/mount.sh index d6329c3..9aa0aad 100644 --- a/sh/alias/mount.sh +++ b/sh/alias/mount.sh @@ -1,11 +1,5 @@ -m() { +m() { sh_a__mount "${@}"; } +sh_a__mount() { mount \ "${@}" } - -# remount read-only medium in read-write -remount() { - mount \ - -o "remount,rw" \ - "/usr/lib/live/mount/medium" -} diff --git a/sh/cmd/mount.sh b/sh/cmd/mount.sh index d6329c3..4454c41 100644 --- a/sh/cmd/mount.sh +++ b/sh/cmd/mount.sh @@ -1,8 +1,3 @@ -m() { - mount \ - "${@}" -} - # remount read-only medium in read-write remount() { mount \ From 4cbdeae4e9038686d47fb95c719b2f968caa0b9f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:11:50 +0100 Subject: [PATCH 539/702] mv --- sh/{cmd => alias}/chmod.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/chmod.sh (100%) diff --git a/sh/cmd/chmod.sh b/sh/alias/chmod.sh similarity index 100% rename from sh/cmd/chmod.sh rename to sh/alias/chmod.sh From ef0a7a6f2867e246c62dd0f9a7656dd6da22de00 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:13:13 +0100 Subject: [PATCH 540/702] chmod --- sh/alias/chmod.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/chmod.sh b/sh/alias/chmod.sh index 89b8bd7..1c55b40 100644 --- a/sh/alias/chmod.sh +++ b/sh/alias/chmod.sh @@ -1,12 +1,14 @@ # change mode to directory -cmd() { +cmd() { sh_a__change_mode_directory "${@}"; } +sh_a__change_mode_directory() { chmod \ "755" \ "${@}" } # change mode to file -cmf() { +cmf() { sh_a__change_mode_file "${@}"; } +sh_a__change_mode_file() { chmod \ "644" \ "${@}" From d418c758d810cd67e4bcf0b14c19f693947f85ef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:16:41 +0100 Subject: [PATCH 541/702] mv --- sh/{cmd => alias}/chown.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/chown.sh (100%) diff --git a/sh/cmd/chown.sh b/sh/alias/chown.sh similarity index 100% rename from sh/cmd/chown.sh rename to sh/alias/chown.sh From 12bc25233cdf426153593680b086eacdfcf5f194 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:17:43 +0100 Subject: [PATCH 542/702] chown --- sh/alias/chown.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/chown.sh b/sh/alias/chown.sh index f7bbef9..6a7a156 100644 --- a/sh/alias/chown.sh +++ b/sh/alias/chown.sh @@ -1,12 +1,14 @@ # change owner to root -cor() { +cor() { sh_a__change_owner_root "${@}"; } +sh_a__change_owner_root() { chown \ "0:0" \ "${@}" } # change owner to user -cou() { +cou() { sh_a__change_owner_user "${@}"; } +sh_a__change_owner_user() { chown \ "1000:1000" \ "${@}" From 3108283a42f9c97b254c5a0725a6777f1591a6d1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:19:37 +0100 Subject: [PATCH 543/702] mv --- sh/{cmd => alias}/ls.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/ls.sh (100%) diff --git a/sh/cmd/ls.sh b/sh/alias/ls.sh similarity index 100% rename from sh/cmd/ls.sh rename to sh/alias/ls.sh From 41ca1b08f8113fdc10a6d017ebc6a4e1a9171483 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:24:54 +0100 Subject: [PATCH 544/702] ls --- sh/alias/ls.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sh/alias/ls.sh b/sh/alias/ls.sh index da0d1bc..f464b3a 100644 --- a/sh/alias/ls.sh +++ b/sh/alias/ls.sh @@ -3,7 +3,8 @@ di=0;94\ " # list current directory’s entries -l() { +l() { sh_a__ls "${@}"; } +sh_a__ls() { ls \ --all \ --color \ @@ -14,15 +15,17 @@ l() { } # list timestamps -lt() { - l \ +lt() { sh_a__ls_time "${@}"; } +sh_a__ls_time() { + sh_a__ls \ --time-style "+%Y%m%d-%H%M%S%-:::z" \ "${@}" } # list timestamps recent last -ltt() { - lt \ +ltr() { sh_a__ls_time_reverse "${@}"; } +sh_a__ls_time_reverse() { + sh_a__ls_time \ --reverse \ -t \ "${@}" From 63efbb7028f7e8eb003890b6eca0819d525b63e6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:25:25 +0100 Subject: [PATCH 545/702] mv --- sh/{cmd => alias}/mkdir.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/mkdir.sh (100%) diff --git a/sh/cmd/mkdir.sh b/sh/alias/mkdir.sh similarity index 100% rename from sh/cmd/mkdir.sh rename to sh/alias/mkdir.sh From 0f4bd2be8540ec9a06049055dfa940474edb82b9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:27:41 +0100 Subject: [PATCH 546/702] mkdir --- sh/alias/mkdir.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/mkdir.sh b/sh/alias/mkdir.sh index 961e14b..ae8ac4b 100644 --- a/sh/alias/mkdir.sh +++ b/sh/alias/mkdir.sh @@ -1,11 +1,13 @@ # make a directory -md() { +md() { sh_a__make_directory "${@}"; } +sh_a__make_directory() { mkdir \ "${@}" } # make a directory after making its parents -mdp() { +mdp() { sh_a__make_directory_parents "${@}"; } +sh_a__make_directory_parents() { mkdir \ --parents \ "${@}" From 81b1f9529c4c5be58bbc5becc0974ba14f0073d3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:28:41 +0100 Subject: [PATCH 547/702] mv --- sh/{cmd => alias}/pwgen.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/pwgen.sh (100%) diff --git a/sh/cmd/pwgen.sh b/sh/alias/pwgen.sh similarity index 100% rename from sh/cmd/pwgen.sh rename to sh/alias/pwgen.sh From 9974f0a99d9ed69acee1c42e1d922079d6a1f599 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:30:11 +0100 Subject: [PATCH 548/702] pwgen --- sh/alias/pwgen.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sh/alias/pwgen.sh b/sh/alias/pwgen.sh index 4052d61..4c0b1f2 100644 --- a/sh/alias/pwgen.sh +++ b/sh/alias/pwgen.sh @@ -1,5 +1,6 @@ # generate passwords -pwg() { +pwg() { sh_a__pass_word_gen "${@}"; } +sh_a__pass_word_gen() { pwgen \ -1 \ --num-passwords 1048576 \ @@ -8,8 +9,9 @@ pwg() { } # generate passwords with symbols -pwgs() { - pwg \ +pwgs() { sh_a__pass_word_gen_symbols "${@}"; } +sh_a__pass_word_gen_symbols() { + sh_a__pass_word_gen \ --symbols \ "${@}" } From e55392137c5564531911a0693edf6ab63243f9c0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:35:44 +0100 Subject: [PATCH 549/702] mv --- sh/{cmd => alias}/kill.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/kill.sh (100%) diff --git a/sh/cmd/kill.sh b/sh/alias/kill.sh similarity index 100% rename from sh/cmd/kill.sh rename to sh/alias/kill.sh From 0b4ac490cd994bdfc0977d5cdf96b7a8f39f377e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:37:07 +0100 Subject: [PATCH 550/702] kill --- sh/alias/kill.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/kill.sh b/sh/alias/kill.sh index a6e105c..ce47bd9 100644 --- a/sh/alias/kill.sh +++ b/sh/alias/kill.sh @@ -1,11 +1,13 @@ # kill a process by id -k() { +k() { sh_a__kill "${@}"; } +sh_a__kill() { kill \ "${@}" } # force kill a process by id -kf() { +kf() { sh_a__kill_force "${@}"; } +sh_a__kill_force() { kill \ -9 \ "${@}" From 5e21bdec58ec2d8fe3e72436c9cf83570e2156f6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:37:18 +0100 Subject: [PATCH 551/702] mv --- sh/{cmd => alias}/killall.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/killall.sh (100%) diff --git a/sh/cmd/killall.sh b/sh/alias/killall.sh similarity index 100% rename from sh/cmd/killall.sh rename to sh/alias/killall.sh From 95ea69c92ff9627f646d3aee808d84a2e90f91b3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:38:17 +0100 Subject: [PATCH 552/702] killall --- sh/alias/killall.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/alias/killall.sh b/sh/alias/killall.sh index a4d083e..0f63b0e 100644 --- a/sh/alias/killall.sh +++ b/sh/alias/killall.sh @@ -1,11 +1,13 @@ # kill all instances of a process by name -ka() { +ka() { sh_a__kill_all "${@}"; } +sh_a__kill_all() { killall \ "${@}" } # force kill all instances of a process by name -kaf() { +kaf() { sh_a__kill_all_force "${@}"; } +sh_a__kill_all_force() { killall \ -9 \ "${@}" From b13056034b9da6572e9a6c6e4c9bd22a483c1aeb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:41:12 +0100 Subject: [PATCH 553/702] mv --- sh/{cmd => alias}/tar.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/tar.sh (100%) diff --git a/sh/cmd/tar.sh b/sh/alias/tar.sh similarity index 100% rename from sh/cmd/tar.sh rename to sh/alias/tar.sh From 6588da4ad645cd00683a111aecb2992d22a8455a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:43:42 +0100 Subject: [PATCH 554/702] tar --- sh/alias/tar.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sh/alias/tar.sh b/sh/alias/tar.sh index bfbf7be..6da0d03 100644 --- a/sh/alias/tar.sh +++ b/sh/alias/tar.sh @@ -1,26 +1,30 @@ -tc() { - tv \ +tc() { sh_a__tar_create "${@}"; } +sh_a__tar_create() { + sh_a__tar_verbose \ --create \ --auto-compress \ --file \ "${@}" } -tl() { - tv \ +tl() { sh_a__tar_list "${@}"; } +sh_a__tar_list() { + sh_a__tar_verbose \ --list \ --file \ "${@}" } -tv() { +tv() { sh_a__tar_verbose "${@}"; } +sh_a__tar_verbose() { tar \ --verbose \ "${@}" } -tx() { - tv \ +tx() { sh_a__tar_xtract "${@}"; } +sh_a__tar_xtract() { + sh_a__tar_verbose \ --extract \ --file \ "${@}" From 40e3b95aaf54241979741d2a40b7aec3fdf4adbc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:49:37 +0100 Subject: [PATCH 555/702] m --- sh/{cmd => alias}/rsync.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/rsync.sh (100%) diff --git a/sh/cmd/rsync.sh b/sh/alias/rsync.sh similarity index 100% rename from sh/cmd/rsync.sh rename to sh/alias/rsync.sh From dd4fd93e1213962ab7a4d4e03cc2378e1385e1ec Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:53:12 +0100 Subject: [PATCH 556/702] rsync --- sh/alias/rsync.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/sh/alias/rsync.sh b/sh/alias/rsync.sh index 7a94aac..02ea400 100644 --- a/sh/alias/rsync.sh +++ b/sh/alias/rsync.sh @@ -1,11 +1,6 @@ # synchronize -rs() { - rsb \ - "${@}" -} - -# base arguments -rsb() { +rs() { sh_a__r_sync "${@}"; } +sh_a__r_sync() { rsync \ --archive \ --no-inc-recursive \ @@ -16,16 +11,17 @@ rsb() { } # synchronize and delete after -rsda() { - rsb \ +rsda() { sh_a__r_sync_delete_after "${@}"; } +sh_a__r_sync_delete_after() { + sh_a__r_sync \ --delete-after \ "${@}" } # synchronize and delete before -rsdb() { r_sync_delete_before "${@}"; } -r_sync_delete_before() { - rsb \ +rsdb() { sh_a__r_sync_delete_before "${@}"; } +sh_a__r_sync_delete_before() { + sh_a__r_sync \ --delete-before \ "${@}" } From b6ffd7256931e7b264be60feab56f0d48f656877 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:55:46 +0100 Subject: [PATCH 557/702] mv --- sh/{cmd => alias}/batcat.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/batcat.sh (100%) diff --git a/sh/cmd/batcat.sh b/sh/alias/batcat.sh similarity index 100% rename from sh/cmd/batcat.sh rename to sh/alias/batcat.sh From 985d4f45a62c6bb7be9c810f2d43c74168d1f2e0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 16:57:19 +0100 Subject: [PATCH 558/702] batcat --- sh/alias/batcat.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/batcat.sh b/sh/alias/batcat.sh index 352cff1..e31ab6d 100644 --- a/sh/alias/batcat.sh +++ b/sh/alias/batcat.sh @@ -1,4 +1,5 @@ -bat() { +bat() { sh_a__b_a_t "${@}"; } +sh_a__b_a_t() { batcat \ "${@}" } From 9e80019dddfa7cebfb77f73b2df5ed5cbfbeddad Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:20:49 +0100 Subject: [PATCH 559/702] mv --- sh/{cmd => alias}/apt.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/apt.sh (100%) diff --git a/sh/cmd/apt.sh b/sh/alias/apt.sh similarity index 100% rename from sh/cmd/apt.sh rename to sh/alias/apt.sh From e933c159c3cea04a09dac16028c8a38639764f3e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:27:59 +0100 Subject: [PATCH 560/702] apt --- sh/alias/apt.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sh/alias/apt.sh b/sh/alias/apt.sh index aba5844..4747c81 100644 --- a/sh/alias/apt.sh +++ b/sh/alias/apt.sh @@ -1,82 +1,94 @@ # show package information -acl() { +acl() { sh_a__apt_cache_list "${@}"; } +sh_a__apt_cache_list() { apt-cache \ show \ "${@}" } # package versions policy -acp() { +acp() { sh_a__apt_cache_policy "${@}"; } +sh_a__apt_cache_policy() { apt-cache \ policy \ "${@}" } # search package -acs() { +acs() { sh_a__apt_cache_search "${@}"; } +sh_a__apt_cache_search() { apt-cache \ search \ "${@}" } # -agap() { +agap() { sh_a__apt_get_auto_purge "${@}"; } +sh_a__apt_get_auto_purge() { apt-get \ autopurge \ "${@}" } # -agar() { +agar() { sh_a__apt_get_auto_remove "${@}"; } +sh_a__apt_get_auto_remove() { apt-get \ autoremove \ "${@}" } # clean packages cache -agc() { +agc() { sh_a__apt_get_clean "${@}"; } +sh_a__apt_get_clean() { apt-get \ clean \ "${@}" } # upgrade allowing package installation or removal -agfu() { +agfu() { sh_a__apt_get_full_upgrade "${@}"; } +sh_a__apt_get_full_upgrade() { apt-get \ full-upgrade \ "${@}" } # install packages -agi() { +agi() { sh_a__apt_get_install "${@}"; } +sh_a__apt_get_install() { apt-get \ install \ "${@}" } # -agp() { +agp() { sh_a__apt_get_purge "${@}"; } +sh_a__apt_get_purge() { apt-get \ purge \ "${@}" } # -agr() { +agr() { sh_a__apt_get_remove "${@}"; } +sh_a__apt_get_remove() { apt-get \ remove \ "${@}" } # update packages catalog -agud() { +agud() { sh_a__apt_get_up_date "${@}"; } +sh_a__apt_get_up_date() { apt-get \ update \ "${@}" } # upgrade forbidding package installation or removal -agug() { +agug() { sh_a__apt_get_up_grade "${@}"; } +sh_a__apt_get_up_grade() { apt-get \ upgrade \ "${@}" From 04a86e40ed1ef26a45d849cbbb026b1419001017 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:29:12 +0100 Subject: [PATCH 561/702] mv --- sh/{cmd => alias}/grep.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/grep.sh (100%) diff --git a/sh/cmd/grep.sh b/sh/alias/grep.sh similarity index 100% rename from sh/cmd/grep.sh rename to sh/alias/grep.sh From 441c42896b09b0b8d7c8a75b740e5749cf0bb485 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:29:57 +0100 Subject: [PATCH 562/702] grep --- sh/alias/grep.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh/alias/grep.sh b/sh/alias/grep.sh index ab8e396..e4fe62f 100644 --- a/sh/alias/grep.sh +++ b/sh/alias/grep.sh @@ -1,5 +1,6 @@ # grep from current directory with regex -g() { +g() { sh_a__grep "${@}"; } +sh_a__grep() { grep \ --directories "recurse" \ --line-number \ From 31e52f986181ae855e0e341f4dd954895cd94e3c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:41:28 +0100 Subject: [PATCH 563/702] mv --- sh/{cmd/ps.sh => alias/pgrep.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd/ps.sh => alias/pgrep.sh} (100%) diff --git a/sh/cmd/ps.sh b/sh/alias/pgrep.sh similarity index 100% rename from sh/cmd/ps.sh rename to sh/alias/pgrep.sh From 39dedbd44030a6e0e894dba635db692a4b05b344 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:43:16 +0100 Subject: [PATCH 564/702] pgrep --- sh/alias/pgrep.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/alias/pgrep.sh b/sh/alias/pgrep.sh index bbb93de..a17c888 100644 --- a/sh/alias/pgrep.sh +++ b/sh/alias/pgrep.sh @@ -1,7 +1,7 @@ # look for a string in processes names -pg() { - ps \ - -A | - grep \ - "${@}" +pg() { sh_a__proc_grep "${@}"; } +sh_a__proc_grep() { + pgrep \ + --list-full \ + "${@}" } From ec16bff4b05f353f3416db06c179c45b2a01478b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:46:23 +0100 Subject: [PATCH 565/702] mv --- sh/{cmd => alias}/lsblk.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => alias}/lsblk.sh (100%) diff --git a/sh/cmd/lsblk.sh b/sh/alias/lsblk.sh similarity index 100% rename from sh/cmd/lsblk.sh rename to sh/alias/lsblk.sh From 96db58083cc741d5907d4c00c95c811e45b5d20c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 18:50:54 +0100 Subject: [PATCH 566/702] lsblk --- sh/alias/lsblk.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sh/alias/lsblk.sh b/sh/alias/lsblk.sh index 398bc42..86e91be 100644 --- a/sh/alias/lsblk.sh +++ b/sh/alias/lsblk.sh @@ -1,27 +1,31 @@ # list block devices -lb() { - lbo \ +lb() { sh_a__list_block "${@}"; } +sh_a__list_block() { + sh_a__list_block_output \ "SIZE" \ "TYPE" \ "FSTYPE" \ "LABEL" \ - "MOUNTPOINTS" + "MOUNTPOINTS" \ + "${@}" } # base arguments -lbb() { +lbne() { sh_a__list_block_no_empty "${@}"; } +sh_a__list_block_no_empty() { lsblk \ --noempty \ "${@}" } # output arguments -lbo() { +lbo() { sh_a__list_block_output "${@}"; } +sh_a__list_block_output() { local argument local arguments="NAME" for argument in "${@}"; do arguments="${arguments},${argument}" done - lbb \ + sh_a__list_block_no_empty \ --output "${arguments}" } From d28e44097c07be29add49a8e632ba899f14fc9a6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 20:33:14 +0100 Subject: [PATCH 567/702] main/log --- sh/main.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index f04cf71..81c412e 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -44,8 +44,6 @@ main_source_directory() { fi done IFS="${ifs}" - sh_log_info - sh_log_info "${CMD}" else echo "Not a directory: ${path}" return 1 From dce638fcbd0ae6554dc07c44747b5f6e2eb0ffa3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 22:20:47 +0100 Subject: [PATCH 568/702] =?UTF-8?q?=E2=88=92=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cs | 3 +-- cs.old | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cs b/cs index 85a53f9..9126efa 100755 --- a/cs +++ b/cs @@ -53,8 +53,7 @@ case "${action}" in ;; "${ACTION_CLOSE}") echo "${container_map_file} ← ${container_mount_directory}" - umount "${container_map_file}" - if [ ${?} -eq 0 ]; then + if umount "${container_map_file}"; then rmdir --ignore-fail-on-non-empty "${container_mount_directory}" echo "${container_file} ← ${container_map_file}" cryptsetup luksClose "${container_name}" diff --git a/cs.old b/cs.old index 85a53f9..9126efa 100755 --- a/cs.old +++ b/cs.old @@ -53,8 +53,7 @@ case "${action}" in ;; "${ACTION_CLOSE}") echo "${container_map_file} ← ${container_mount_directory}" - umount "${container_map_file}" - if [ ${?} -eq 0 ]; then + if umount "${container_map_file}"; then rmdir --ignore-fail-on-non-empty "${container_mount_directory}" echo "${container_file} ← ${container_map_file}" cryptsetup luksClose "${container_name}" From 948e22d64f992c7864d3ef420e447418d90ef18b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 22:22:12 +0100 Subject: [PATCH 569/702] read/-r --- cs | 2 +- cs.old | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cs b/cs index 9126efa..bd9402c 100755 --- a/cs +++ b/cs @@ -25,7 +25,7 @@ case "${action}" in if [ "${1}" ]; then if [ "${action}" == "${ACTION_OPEN}" ]; then echo -n 'PassPhrase: ' - read -s pass_phrase + read -r -s pass_phrase echo fi for container in "${@}"; do diff --git a/cs.old b/cs.old index 9126efa..bd9402c 100755 --- a/cs.old +++ b/cs.old @@ -25,7 +25,7 @@ case "${action}" in if [ "${1}" ]; then if [ "${action}" == "${ACTION_OPEN}" ]; then echo -n 'PassPhrase: ' - read -s pass_phrase + read -r -s pass_phrase echo fi for container in "${@}"; do From 1061c309c3acc02fad5e065da8bf62d19b910b5f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 22:33:59 +0100 Subject: [PATCH 570/702] readme --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 011ed62..f61fc7d 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ -# Public +# SH -## ToDo +## Tasks * [ ] convert alias to () * [ ] git switch signing commits & tags From bbcbcf28a2e909b4219284d3a82935e81ee095fe Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 18 Nov 2024 23:24:14 +0100 Subject: [PATCH 571/702] hetzner --- readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readme.md b/readme.md index f61fc7d..cbcd2bc 100644 --- a/readme.md +++ b/readme.md @@ -2,13 +2,11 @@ ## Tasks -* [ ] convert alias to () * [ ] git switch signing commits & tags * [ ] shellcheck & shfmt * [ ] python tools * [ ] log -* [ ] ovh - * [ ] clean apt cache after each install/upgrade step +* [ ] hetzner * [ ] apt * [ ] apt-file search | grep * [ ] ffmpeg From 46704e9e375805dad467d3b90ad86a246e6327e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:17:14 +0100 Subject: [PATCH 572/702] sa --- sh/alias/apt.sh | 48 ++++----- sh/alias/batcat.sh | 4 +- sh/alias/btrfs.sh | 36 +++---- sh/alias/byobu.sh | 16 +-- sh/alias/chmod.sh | 8 +- sh/alias/chown.sh | 8 +- sh/alias/clear.sh | 4 +- sh/alias/cp.sh | 4 +- sh/alias/emacs.sh | 4 +- sh/alias/evince.sh | 4 +- sh/alias/git.sh | 242 +++++++++++++++++++++---------------------- sh/alias/grep.sh | 4 +- sh/alias/kill.sh | 8 +- sh/alias/killall.sh | 8 +- sh/alias/ls.sh | 16 +-- sh/alias/lsblk.sh | 16 +-- sh/alias/mkdir.sh | 8 +- sh/alias/mount.sh | 4 +- sh/alias/mv.sh | 4 +- sh/alias/nano.sh | 4 +- sh/alias/newsboat.sh | 4 +- sh/alias/pass.sh | 8 +- sh/alias/pgrep.sh | 4 +- sh/alias/pwgen.sh | 10 +- sh/alias/rm.sh | 4 +- sh/alias/rsync.sh | 16 +-- sh/alias/tar.sh | 22 ++-- sh/alias/tmux.sh | 4 +- sh/alias/tree.sh | 8 +- 29 files changed, 265 insertions(+), 265 deletions(-) diff --git a/sh/alias/apt.sh b/sh/alias/apt.sh index 4747c81..1af6d78 100644 --- a/sh/alias/apt.sh +++ b/sh/alias/apt.sh @@ -1,94 +1,94 @@ # show package information -acl() { sh_a__apt_cache_list "${@}"; } -sh_a__apt_cache_list() { +acl() { sa__apt_cache_list "${@}"; } +sa__apt_cache_list() { apt-cache \ show \ "${@}" } # package versions policy -acp() { sh_a__apt_cache_policy "${@}"; } -sh_a__apt_cache_policy() { +acp() { sa__apt_cache_policy "${@}"; } +sa__apt_cache_policy() { apt-cache \ policy \ "${@}" } # search package -acs() { sh_a__apt_cache_search "${@}"; } -sh_a__apt_cache_search() { +acs() { sa__apt_cache_search "${@}"; } +sa__apt_cache_search() { apt-cache \ search \ "${@}" } # -agap() { sh_a__apt_get_auto_purge "${@}"; } -sh_a__apt_get_auto_purge() { +agap() { sa__apt_get_auto_purge "${@}"; } +sa__apt_get_auto_purge() { apt-get \ autopurge \ "${@}" } # -agar() { sh_a__apt_get_auto_remove "${@}"; } -sh_a__apt_get_auto_remove() { +agar() { sa__apt_get_auto_remove "${@}"; } +sa__apt_get_auto_remove() { apt-get \ autoremove \ "${@}" } # clean packages cache -agc() { sh_a__apt_get_clean "${@}"; } -sh_a__apt_get_clean() { +agc() { sa__apt_get_clean "${@}"; } +sa__apt_get_clean() { apt-get \ clean \ "${@}" } # upgrade allowing package installation or removal -agfu() { sh_a__apt_get_full_upgrade "${@}"; } -sh_a__apt_get_full_upgrade() { +agfu() { sa__apt_get_full_upgrade "${@}"; } +sa__apt_get_full_upgrade() { apt-get \ full-upgrade \ "${@}" } # install packages -agi() { sh_a__apt_get_install "${@}"; } -sh_a__apt_get_install() { +agi() { sa__apt_get_install "${@}"; } +sa__apt_get_install() { apt-get \ install \ "${@}" } # -agp() { sh_a__apt_get_purge "${@}"; } -sh_a__apt_get_purge() { +agp() { sa__apt_get_purge "${@}"; } +sa__apt_get_purge() { apt-get \ purge \ "${@}" } # -agr() { sh_a__apt_get_remove "${@}"; } -sh_a__apt_get_remove() { +agr() { sa__apt_get_remove "${@}"; } +sa__apt_get_remove() { apt-get \ remove \ "${@}" } # update packages catalog -agud() { sh_a__apt_get_up_date "${@}"; } -sh_a__apt_get_up_date() { +agud() { sa__apt_get_up_date "${@}"; } +sa__apt_get_up_date() { apt-get \ update \ "${@}" } # upgrade forbidding package installation or removal -agug() { sh_a__apt_get_up_grade "${@}"; } -sh_a__apt_get_up_grade() { +agug() { sa__apt_get_up_grade "${@}"; } +sa__apt_get_up_grade() { apt-get \ upgrade \ "${@}" diff --git a/sh/alias/batcat.sh b/sh/alias/batcat.sh index e31ab6d..4d5968b 100644 --- a/sh/alias/batcat.sh +++ b/sh/alias/batcat.sh @@ -1,5 +1,5 @@ -bat() { sh_a__b_a_t "${@}"; } -sh_a__b_a_t() { +bat() { sa__b_a_t "${@}"; } +sa__b_a_t() { batcat \ "${@}" } diff --git a/sh/alias/btrfs.sh b/sh/alias/btrfs.sh index 3ec74fb..eb48c14 100644 --- a/sh/alias/btrfs.sh +++ b/sh/alias/btrfs.sh @@ -1,13 +1,13 @@ -bfdf() { sh_a__btrfs_filesystem_d_f "${@}"; } -sh_a__btrfs_filesystem_d_f() { +bfdf() { sa__btrfs_filesystem_d_f "${@}"; } +sa__btrfs_filesystem_d_f() { btrfs \ filesystem \ df \ "${@}" } -bfdu() { sh_a__btrfs_filesystem_d_u "${@}"; } -sh_a__btrfs_filesystem_d_u() { +bfdu() { sa__btrfs_filesystem_d_u "${@}"; } +sa__btrfs_filesystem_d_u() { btrfs \ filesystem \ du \ @@ -15,40 +15,40 @@ sh_a__btrfs_filesystem_d_u() { "${@}" } -bfu() { sh_a__btrfs_filesystem_usage "${@}"; } -sh_a__btrfs_filesystem_usage() { +bfu() { sa__btrfs_filesystem_usage "${@}"; } +sa__btrfs_filesystem_usage() { btrfs \ filesystem \ usage \ "${@}" } -bpg() { sh_a__btrfs_property_get "${@}"; } -sh_a__btrfs_property_get() { +bpg() { sa__btrfs_property_get "${@}"; } +sa__btrfs_property_get() { btrfs \ property \ get \ "${@}" } -bsc() { sh_a__btrfs_subvolume_create "${@}"; } -sh_a__btrfs_subvolume_create() { +bsc() { sa__btrfs_subvolume_create "${@}"; } +sa__btrfs_subvolume_create() { btrfs \ subvolume \ create \ "${@}" } -bsd() { sh_a__btrfs_subvolume_delete "${@}"; } -sh_a__btrfs_subvolume_delete() { +bsd() { sa__btrfs_subvolume_delete "${@}"; } +sa__btrfs_subvolume_delete() { btrfs \ subvolume \ delete \ "${@}" } -bsl() { sh_a__btrfs_subvolume_list "${@}"; } -sh_a__btrfs_subvolume_list() { +bsl() { sa__btrfs_subvolume_list "${@}"; } +sa__btrfs_subvolume_list() { if [ -n "${1}" ]; then btrfs subvolume list "${1}" | cut --delimiter " " --fields 9 | @@ -56,16 +56,16 @@ sh_a__btrfs_subvolume_list() { fi } -bss() { sh_a__btrfs_subvolume_snapshot "${@}"; } -sh_a__btrfs_subvolume_snapshot() { +bss() { sa__btrfs_subvolume_snapshot "${@}"; } +sa__btrfs_subvolume_snapshot() { btrfs \ subvolume \ snapshot \ "${@}" } -bssr() { sh_a__btrfs_subvolume_snapshot_r "${@}"; } -sh_a__btrfs_subvolume_snapshot_r() { +bssr() { sa__btrfs_subvolume_snapshot_r "${@}"; } +sa__btrfs_subvolume_snapshot_r() { btrfs \ subvolume \ snapshot -r \ diff --git a/sh/alias/byobu.sh b/sh/alias/byobu.sh index 79155b5..6b66a77 100644 --- a/sh/alias/byobu.sh +++ b/sh/alias/byobu.sh @@ -1,25 +1,25 @@ -bb() { sh_a__byo_bu "${@}"; } -sh_a__byo_bu() { +bb() { sa__byo_bu "${@}"; } +sa__byo_bu() { byobu \ "${@}" } -bba() { sh_a__byo_bu_attach "${@}"; } -sh_a__byo_bu_attach() { +bba() { sa__byo_bu_attach "${@}"; } +sa__byo_bu_attach() { byobu \ attach-session \ "${@}" } -bbl() { sh_a__byo_bu_ls "${@}"; } -sh_a__byo_bu_ls() { +bbl() { sa__byo_bu_ls "${@}"; } +sa__byo_bu_ls() { byobu \ ls \ "${@}" } -bbnd() { sh_a__byo_bu_new_detach "${@}"; } -sh_a__byo_bu_new_detach() { +bbnd() { sa__byo_bu_new_detach "${@}"; } +sa__byo_bu_new_detach() { byobu \ new-session \ -d \ diff --git a/sh/alias/chmod.sh b/sh/alias/chmod.sh index 1c55b40..6a6e0e8 100644 --- a/sh/alias/chmod.sh +++ b/sh/alias/chmod.sh @@ -1,14 +1,14 @@ # change mode to directory -cmd() { sh_a__change_mode_directory "${@}"; } -sh_a__change_mode_directory() { +cmd() { sa__change_mode_directory "${@}"; } +sa__change_mode_directory() { chmod \ "755" \ "${@}" } # change mode to file -cmf() { sh_a__change_mode_file "${@}"; } -sh_a__change_mode_file() { +cmf() { sa__change_mode_file "${@}"; } +sa__change_mode_file() { chmod \ "644" \ "${@}" diff --git a/sh/alias/chown.sh b/sh/alias/chown.sh index 6a7a156..8c992d3 100644 --- a/sh/alias/chown.sh +++ b/sh/alias/chown.sh @@ -1,14 +1,14 @@ # change owner to root -cor() { sh_a__change_owner_root "${@}"; } -sh_a__change_owner_root() { +cor() { sa__change_owner_root "${@}"; } +sa__change_owner_root() { chown \ "0:0" \ "${@}" } # change owner to user -cou() { sh_a__change_owner_user "${@}"; } -sh_a__change_owner_user() { +cou() { sa__change_owner_user "${@}"; } +sa__change_owner_user() { chown \ "1000:1000" \ "${@}" diff --git a/sh/alias/clear.sh b/sh/alias/clear.sh index 9731fe0..542a260 100644 --- a/sh/alias/clear.sh +++ b/sh/alias/clear.sh @@ -1,6 +1,6 @@ # clear terminal -c() { sh_a__clear "${@}"; } -sh_a__clear() { +c() { sa__clear "${@}"; } +sa__clear() { clear \ "${@}" } diff --git a/sh/alias/cp.sh b/sh/alias/cp.sh index dd1a271..d8897c0 100644 --- a/sh/alias/cp.sh +++ b/sh/alias/cp.sh @@ -1,6 +1,6 @@ # copy interactively -cpi() { sh_a__co_py_interactive "${@}"; } -sh_a__co_py_interactive() { +cpi() { sa__co_py_interactive "${@}"; } +sa__co_py_interactive() { cp \ --interactive \ "${@}" diff --git a/sh/alias/emacs.sh b/sh/alias/emacs.sh index 84fc56f..cc7e002 100644 --- a/sh/alias/emacs.sh +++ b/sh/alias/emacs.sh @@ -1,5 +1,5 @@ -em() { sh_a__e_macs "${@}"; } -sh_a__e_macs() { +em() { sa__e_macs "${@}"; } +sa__e_macs() { emacs \ "${@}" } diff --git a/sh/alias/evince.sh b/sh/alias/evince.sh index 3c609ef..5d68ace 100644 --- a/sh/alias/evince.sh +++ b/sh/alias/evince.sh @@ -1,5 +1,5 @@ -ev() { sh_a__e_vince "${@}"; } -sh_a__e_vince() { +ev() { sa__e_vince "${@}"; } +sa__e_vince() { evince \ "${@}" } diff --git a/sh/alias/git.sh b/sh/alias/git.sh index 864620b..5ce2f93 100644 --- a/sh/alias/git.sh +++ b/sh/alias/git.sh @@ -8,16 +8,16 @@ C %C(blue)%cn %ce %B" # add to index -ga() { sh_a__git_add "${@}"; } -sh_a__git_add() { +ga() { sa__git_add "${@}"; } +sa__git_add() { git \ add \ "${@}" } # add all to index -gaa() { sh_a__git_add_all "${@}"; } -sh_a__git_add_all() { +gaa() { sa__git_add_all "${@}"; } +sa__git_add_all() { git \ add \ --all \ @@ -25,8 +25,8 @@ sh_a__git_add_all() { } # add parts of all to index -gaap() { sh_a__git_add_all_patch "${@}"; } -sh_a__git_add_all_patch() { +gaap() { sa__git_add_all_patch "${@}"; } +sa__git_add_all_patch() { git \ add \ --all \ @@ -35,8 +35,8 @@ sh_a__git_add_all_patch() { } # add parts to index -gap() { sh_a__git_add_patch "${@}"; } -sh_a__git_add_patch() { +gap() { sa__git_add_patch "${@}"; } +sa__git_add_patch() { git \ add \ --patch \ @@ -44,16 +44,16 @@ sh_a__git_add_patch() { } # create a branch -gb() { sh_a__git_branch "${@}"; } -sh_a__git_branch() { +gb() { sa__git_branch "${@}"; } +sa__git_branch() { git \ branch \ "${@}" } # delete a branch -gbd() { sh_a__git_branch_delete "${@}"; } -sh_a__git_branch_delete() { +gbd() { sa__git_branch_delete "${@}"; } +sa__git_branch_delete() { git \ branch \ --delete \ @@ -61,8 +61,8 @@ sh_a__git_branch_delete() { } # force a branch deletion -gbdf() { sh_a__git_branch_delete_force "${@}"; } -sh_a__git_branch_delete_force() { +gbdf() { sa__git_branch_delete_force "${@}"; } +sa__git_branch_delete_force() { git \ branch \ --delete \ @@ -71,8 +71,8 @@ sh_a__git_branch_delete_force() { } # list branches -gbl() { sh_a__git_branch_list "${@}"; } -sh_a__git_branch_list() { +gbl() { sa__git_branch_list "${@}"; } +sa__git_branch_list() { git \ branch \ --all \ @@ -83,8 +83,8 @@ sh_a__git_branch_list() { } # set the link to a remote branch from a local branch -gbsu() { sh_a__git_branch_set_upstream "${@}"; } -sh_a__git_branch_set_upstream() { +gbsu() { sa__git_branch_set_upstream "${@}"; } +sa__git_branch_set_upstream() { git \ branch \ --set-upstream-to \ @@ -92,16 +92,16 @@ sh_a__git_branch_set_upstream() { } # switch to a branch or checkout file(s) from a commit -gc() { sh_a__git_checkout "${@}"; } -sh_a__git_checkout() { +gc() { sa__git_checkout "${@}"; } +sa__git_checkout() { git \ checkout \ "${@}" } # checkout an orphan branch -gco() { sh_a__git_checkout_orphan "${@}"; } -sh_a__git_checkout_orphan() { +gco() { sa__git_checkout_orphan "${@}"; } +sa__git_checkout_orphan() { git \ checkout \ --orphan \ @@ -109,16 +109,16 @@ sh_a__git_checkout_orphan() { } # pick a commit -gcp() { sh_a__git_cherry_pick "${@}"; } -sh_a__git_cherry_pick() { +gcp() { sa__git_cherry_pick "${@}"; } +sa__git_cherry_pick() { git \ cherry-pick \ "${@}" } # abort the commit pick -gcpa() { sh_a__git_cherry_pick_abort "${@}"; } -sh_a__git_cherry_pick_abort() { +gcpa() { sa__git_cherry_pick_abort "${@}"; } +sa__git_cherry_pick_abort() { git \ cherry-pick \ --abort \ @@ -126,8 +126,8 @@ sh_a__git_cherry_pick_abort() { } # continue the commit pick -gcpc() { sh_a__git_cherry_pick_continue "${@}"; } -sh_a__git_cherry_pick_continue() { +gcpc() { sa__git_cherry_pick_continue "${@}"; } +sa__git_cherry_pick_continue() { git \ cherry-pick \ --continue \ @@ -135,8 +135,8 @@ sh_a__git_cherry_pick_continue() { } # clean untracked files -gcf() { sh_a__git_clean_force "${@}"; } -sh_a__git_clean_force() { +gcf() { sa__git_clean_force "${@}"; } +sa__git_clean_force() { git \ clean \ -d \ @@ -145,8 +145,8 @@ sh_a__git_clean_force() { } # redo the last commit with a different message -gcam() { sh_a__git_commit_amend_message "${@}"; } -sh_a__git_commit_amend_message() { +gcam() { sa__git_commit_amend_message "${@}"; } +sa__git_commit_amend_message() { git \ commit \ --amend \ @@ -155,8 +155,8 @@ sh_a__git_commit_amend_message() { } # make a root commit -gcem() { sh_a__git_commit_empty_message "${@}"; } -sh_a__git_commit_empty_message() { +gcem() { sa__git_commit_empty_message "${@}"; } +sa__git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -166,8 +166,8 @@ sh_a__git_commit_empty_message() { } # commit the index -gcm() { sh_a__git_commit_message "${@}"; } -sh_a__git_commit_message() { +gcm() { sa__git_commit_message "${@}"; } +sa__git_commit_message() { git \ commit \ --message \ @@ -175,8 +175,8 @@ sh_a__git_commit_message() { } # configure the user email -gcue() { sh_a__git_config_user_email "${@}"; } -sh_a__git_config_user_email() { +gcue() { sa__git_config_user_email "${@}"; } +sa__git_config_user_email() { git \ config \ "user.email" \ @@ -184,8 +184,8 @@ sh_a__git_config_user_email() { } # configure the user name -gcun() { sh_a__git_config_user_name "${@}"; } -sh_a__git_config_user_name() { +gcun() { sa__git_config_user_name "${@}"; } +sa__git_config_user_name() { git \ config \ "user.name" \ @@ -193,16 +193,16 @@ sh_a__git_config_user_name() { } # differences from last or between commits -gd() { sh_a__git_diff "${@}"; } -sh_a__git_diff() { +gd() { sa__git_diff "${@}"; } +sa__git_diff() { git \ diff \ "${@}" } # display what is indexed in cache -gdc() { sh_a__git_diff_cached "${@}"; } -sh_a__git_diff_cached() { +gdc() { sa__git_diff_cached "${@}"; } +sa__git_diff_cached() { git \ diff \ --cached \ @@ -210,8 +210,8 @@ sh_a__git_diff_cached() { } # indexed character-level differences -gdcw() { sh_a__git_diff_cached_word "${@}"; } -sh_a__git_diff_cached_word() { +gdcw() { sa__git_diff_cached_word "${@}"; } +sa__git_diff_cached_word() { git \ diff \ --cached \ @@ -220,8 +220,8 @@ sh_a__git_diff_cached_word() { } # differences via external tool -gdt() { sh_a__git_diff_tool "${@}"; } -sh_a__git_diff_tool() { +gdt() { sa__git_diff_tool "${@}"; } +sa__git_diff_tool() { git \ difftool \ --dir-diff \ @@ -229,8 +229,8 @@ sh_a__git_diff_tool() { } # character-level differences -gdw() { sh_a__git_diff_word "${@}"; } -sh_a__git_diff_word() { +gdw() { sa__git_diff_word "${@}"; } +sa__git_diff_word() { git \ diff \ --word-diff-regex "." \ @@ -238,8 +238,8 @@ sh_a__git_diff_word() { } # fetch from the remote repository -gf() { sh_a__git_fetch "${@}"; } -sh_a__git_fetch() { +gf() { sa__git_fetch "${@}"; } +sa__git_fetch() { git \ fetch \ --tags \ @@ -248,16 +248,16 @@ sh_a__git_fetch() { } # fetch from remote repository and prune local orphan branches -gfp() { sh_a__git_fetch_prune "${@}"; } -sh_a__git_fetch_prune() { - sh_a__git_fetch \ +gfp() { sa__git_fetch_prune "${@}"; } +sa__git_fetch_prune() { + sa__git_fetch \ --prune \ "${@}" } # garbage collect all orphan commits -ggc() { sh_a__git_garbage_collect "${@}"; } -sh_a__git_garbage_collect() { +ggc() { sa__git_garbage_collect "${@}"; } +sa__git_garbage_collect() { git \ reflog \ expire \ @@ -270,16 +270,16 @@ sh_a__git_garbage_collect() { } # initialize a new repository -gi() { sh_a__git_init "${@}"; } -sh_a__git_init() { +gi() { sa__git_init "${@}"; } +sa__git_init() { git \ init \ "${@}" } # initialize a new bare repository -gib() { sh_a__git_init_bare "${@}"; } -sh_a__git_init_bare() { +gib() { sa__git_init_bare "${@}"; } +sa__git_init_bare() { git \ init \ --bare \ @@ -287,8 +287,8 @@ sh_a__git_init_bare() { } # log history -gl() { sh_a__git_log "${@}"; } -sh_a__git_log() { +gl() { sa__git_log "${@}"; } +sa__git_log() { git \ log \ --abbrev=8 \ @@ -299,33 +299,33 @@ sh_a__git_log() { } # log all history -gla() { sh_a__git_log_all "${@}"; } -sh_a__git_log_all() { - sh_a__git_log \ +gla() { sa__git_log_all "${@}"; } +sa__git_log_all() { + sa__git_log \ --all \ "${@}" } # log all history with patches -glap() { sh_a__git_log_all_patch "${@}"; } -sh_a__git_log_all_patch() { - sh_a__git_log \ +glap() { sa__git_log_all_patch "${@}"; } +sa__git_log_all_patch() { + sa__git_log \ --all \ --patch \ "${@}" } # log history with patches -glp() { sh_a__git_log_patch "${@}"; } -sh_a__git_log_patch() { - sh_a__git_log \ +glp() { sa__git_log_patch "${@}"; } +sa__git_log_patch() { + sa__git_log \ --patch \ "${@}" } # fast-forward merge to remote branch -gm() { sh_a__git_merge "${@}"; } -sh_a__git_merge() { +gm() { sa__git_merge "${@}"; } +sa__git_merge() { git \ merge \ --ff-only \ @@ -333,8 +333,8 @@ sh_a__git_merge() { } # abort the current merge commit -gma() { sh_a__git_merge_abort "${@}"; } -sh_a__git_merge_abort() { +gma() { sa__git_merge_abort "${@}"; } +sa__git_merge_abort() { git \ merge \ --abort \ @@ -342,8 +342,8 @@ sh_a__git_merge_abort() { } # do a merge commit -gmc() { sh_a__git_merge_commit "${@}"; } -sh_a__git_merge_commit() { +gmc() { sa__git_merge_commit "${@}"; } +sa__git_merge_commit() { git \ merge \ --no-ff \ @@ -352,8 +352,8 @@ sh_a__git_merge_commit() { } # squash a branch and index its modifications -gms() { sh_a__git_merge_squash "${@}"; } -sh_a__git_merge_squash() { +gms() { sa__git_merge_squash "${@}"; } +sa__git_merge_squash() { git \ merge \ --squash \ @@ -361,16 +361,16 @@ sh_a__git_merge_squash() { } # merge via external tool -gmt() { sh_a__git_merge_tool "${@}"; } -sh_a__git_merge_tool() { +gmt() { sa__git_merge_tool "${@}"; } +sa__git_merge_tool() { git \ mergetool \ "${@}" } # push to the remote repository -gp() { sh_a__git_push "${@}"; } -sh_a__git_push() { +gp() { sa__git_push "${@}"; } +sa__git_push() { git \ push \ --tags \ @@ -379,8 +379,8 @@ sh_a__git_push() { } # delete from the remote repository -gpd() { sh_a__git_push_delete "${@}"; } -sh_a__git_push_delete() { +gpd() { sa__git_push_delete "${@}"; } +sa__git_push_delete() { git \ push \ --delete \ @@ -388,24 +388,24 @@ sh_a__git_push_delete() { } # force the push to the remote repository -gpf() { sh_a__git_push_force "${@}"; } -sh_a__git_push_force() { - sh_a__git_push \ +gpf() { sa__git_push_force "${@}"; } +sa__git_push_force() { + sa__git_push \ --force \ "${@}" } # rebase current branch onto another -grb() { sh_a__git_re_base "${@}"; } -sh_a__git_re_base() { +grb() { sa__git_re_base "${@}"; } +sa__git_re_base() { git \ rebase \ "${@}" } # abort current rebase -grba() { sh_a__git_re_base_abort "${@}"; } -sh_a__git_re_base_abort() { +grba() { sa__git_re_base_abort "${@}"; } +sa__git_re_base_abort() { git \ rebase \ --abort \ @@ -413,8 +413,8 @@ sh_a__git_re_base_abort() { } # continue current rebase -grbc() { sh_a__git_re_base_continue "${@}"; } -sh_a__git_re_base_continue() { +grbc() { sa__git_re_base_continue "${@}"; } +sa__git_re_base_continue() { git \ rebase \ --continue \ @@ -422,8 +422,8 @@ sh_a__git_re_base_continue() { } # force rebase without fast-forward -grbf() { sh_a__git_re_base_force "${@}"; } -sh_a__git_re_base_force() { +grbf() { sa__git_re_base_force "${@}"; } +sa__git_re_base_force() { git \ rebase \ --force-rebase \ @@ -431,8 +431,8 @@ sh_a__git_re_base_force() { } # rebase interactively -grbi() { sh_a__git_re_base_interactive "${@}"; } -sh_a__git_re_base_interactive() { +grbi() { sa__git_re_base_interactive "${@}"; } +sa__git_re_base_interactive() { git \ rebase \ --interactive \ @@ -440,8 +440,8 @@ sh_a__git_re_base_interactive() { } # add a new remote repository -grma() { sh_a__git_re_mote_add "${@}"; } -sh_a__git_re_mote_add() { +grma() { sa__git_re_mote_add "${@}"; } +sa__git_re_mote_add() { git \ remote \ add \ @@ -449,8 +449,8 @@ sh_a__git_re_mote_add() { } # list remote repositories -grml() { sh_a__git_re_mote_list "${@}"; } -sh_a__git_re_mote_list() { +grml() { sa__git_re_mote_list "${@}"; } +sa__git_re_mote_list() { git \ remote \ --verbose \ @@ -458,8 +458,8 @@ sh_a__git_re_mote_list() { } # set the location of a remote repository -grmsu() { sh_a__git_re_mote_set_upstream "${@}"; } -sh_a__git_re_mote_set_upstream() { +grmsu() { sa__git_re_mote_set_upstream "${@}"; } +sa__git_re_mote_set_upstream() { git \ remote \ set-url \ @@ -467,8 +467,8 @@ sh_a__git_re_mote_set_upstream() { } # show connection to a remote repository -grms() { sh_a__git_re_mote_show "${@}"; } -sh_a__git_re_mote_show() { +grms() { sa__git_re_mote_show "${@}"; } +sa__git_re_mote_show() { git \ remote \ show \ @@ -476,24 +476,24 @@ sh_a__git_re_mote_show() { } # remove and add removal to index -grm() { sh_a__git_re_move "${@}"; } -sh_a__git_re_move() { +grm() { sa__git_re_move "${@}"; } +sa__git_re_move() { git \ rm \ "${@}" } # remove file(s) from index or move current branch pointer -grs() { sh_a__git_re_set "${@}"; } -sh_a__git_re_set() { +grs() { sa__git_re_set "${@}"; } +sa__git_re_set() { git \ reset \ "${@}" } # wipe modifications or reset current branch to another commit -grsh() { sh_a__git_re_set_hard "${@}"; } -sh_a__git_re_set_hard() { +grsh() { sa__git_re_set_hard "${@}"; } +sa__git_re_set_hard() { git \ reset \ --hard \ @@ -501,16 +501,16 @@ sh_a__git_re_set_hard() { } # show a commit -gsc() { sh_a__git_show_commit "${@}"; } -sh_a__git_show_commit() { +gsc() { sa__git_show_commit "${@}"; } +sa__git_show_commit() { git \ show \ "${@}" } # current state of repository -gs() { sh_a__git_status "${@}"; } -sh_a__git_status() { +gs() { sa__git_status "${@}"; } +sa__git_status() { git \ status \ --untracked-files="all" \ @@ -518,16 +518,16 @@ sh_a__git_status() { } # tag a commit -gt() { sh_a__git_tag "${@}"; } -sh_a__git_tag() { +gt() { sa__git_tag "${@}"; } +sa__git_tag() { git \ tag \ "${@}" } # delete a tag -gtd() { sh_a__git_tag_delete "${@}"; } -sh_a__git_tag_delete() { +gtd() { sa__git_tag_delete "${@}"; } +sa__git_tag_delete() { git \ tag \ --delete \ diff --git a/sh/alias/grep.sh b/sh/alias/grep.sh index e4fe62f..d479936 100644 --- a/sh/alias/grep.sh +++ b/sh/alias/grep.sh @@ -1,6 +1,6 @@ # grep from current directory with regex -g() { sh_a__grep "${@}"; } -sh_a__grep() { +g() { sa__grep "${@}"; } +sa__grep() { grep \ --directories "recurse" \ --line-number \ diff --git a/sh/alias/kill.sh b/sh/alias/kill.sh index ce47bd9..1900a2d 100644 --- a/sh/alias/kill.sh +++ b/sh/alias/kill.sh @@ -1,13 +1,13 @@ # kill a process by id -k() { sh_a__kill "${@}"; } -sh_a__kill() { +k() { sa__kill "${@}"; } +sa__kill() { kill \ "${@}" } # force kill a process by id -kf() { sh_a__kill_force "${@}"; } -sh_a__kill_force() { +kf() { sa__kill_force "${@}"; } +sa__kill_force() { kill \ -9 \ "${@}" diff --git a/sh/alias/killall.sh b/sh/alias/killall.sh index 0f63b0e..b12e515 100644 --- a/sh/alias/killall.sh +++ b/sh/alias/killall.sh @@ -1,13 +1,13 @@ # kill all instances of a process by name -ka() { sh_a__kill_all "${@}"; } -sh_a__kill_all() { +ka() { sa__kill_all "${@}"; } +sa__kill_all() { killall \ "${@}" } # force kill all instances of a process by name -kaf() { sh_a__kill_all_force "${@}"; } -sh_a__kill_all_force() { +kaf() { sa__kill_all_force "${@}"; } +sa__kill_all_force() { killall \ -9 \ "${@}" diff --git a/sh/alias/ls.sh b/sh/alias/ls.sh index f464b3a..5c90ee5 100644 --- a/sh/alias/ls.sh +++ b/sh/alias/ls.sh @@ -3,8 +3,8 @@ di=0;94\ " # list current directory’s entries -l() { sh_a__ls "${@}"; } -sh_a__ls() { +l() { sa__ls "${@}"; } +sa__ls() { ls \ --all \ --color \ @@ -15,17 +15,17 @@ sh_a__ls() { } # list timestamps -lt() { sh_a__ls_time "${@}"; } -sh_a__ls_time() { - sh_a__ls \ +lt() { sa__ls_time "${@}"; } +sa__ls_time() { + sa__ls \ --time-style "+%Y%m%d-%H%M%S%-:::z" \ "${@}" } # list timestamps recent last -ltr() { sh_a__ls_time_reverse "${@}"; } -sh_a__ls_time_reverse() { - sh_a__ls_time \ +ltr() { sa__ls_time_reverse "${@}"; } +sa__ls_time_reverse() { + sa__ls_time \ --reverse \ -t \ "${@}" diff --git a/sh/alias/lsblk.sh b/sh/alias/lsblk.sh index 86e91be..359f5ae 100644 --- a/sh/alias/lsblk.sh +++ b/sh/alias/lsblk.sh @@ -1,7 +1,7 @@ # list block devices -lb() { sh_a__list_block "${@}"; } -sh_a__list_block() { - sh_a__list_block_output \ +lb() { sa__list_block "${@}"; } +sa__list_block() { + sa__list_block_output \ "SIZE" \ "TYPE" \ "FSTYPE" \ @@ -11,21 +11,21 @@ sh_a__list_block() { } # base arguments -lbne() { sh_a__list_block_no_empty "${@}"; } -sh_a__list_block_no_empty() { +lbne() { sa__list_block_no_empty "${@}"; } +sa__list_block_no_empty() { lsblk \ --noempty \ "${@}" } # output arguments -lbo() { sh_a__list_block_output "${@}"; } -sh_a__list_block_output() { +lbo() { sa__list_block_output "${@}"; } +sa__list_block_output() { local argument local arguments="NAME" for argument in "${@}"; do arguments="${arguments},${argument}" done - sh_a__list_block_no_empty \ + sa__list_block_no_empty \ --output "${arguments}" } diff --git a/sh/alias/mkdir.sh b/sh/alias/mkdir.sh index ae8ac4b..b8821a5 100644 --- a/sh/alias/mkdir.sh +++ b/sh/alias/mkdir.sh @@ -1,13 +1,13 @@ # make a directory -md() { sh_a__make_directory "${@}"; } -sh_a__make_directory() { +md() { sa__make_directory "${@}"; } +sa__make_directory() { mkdir \ "${@}" } # make a directory after making its parents -mdp() { sh_a__make_directory_parents "${@}"; } -sh_a__make_directory_parents() { +mdp() { sa__make_directory_parents "${@}"; } +sa__make_directory_parents() { mkdir \ --parents \ "${@}" diff --git a/sh/alias/mount.sh b/sh/alias/mount.sh index 9aa0aad..b5329a9 100644 --- a/sh/alias/mount.sh +++ b/sh/alias/mount.sh @@ -1,5 +1,5 @@ -m() { sh_a__mount "${@}"; } -sh_a__mount() { +m() { sa__mount "${@}"; } +sa__mount() { mount \ "${@}" } diff --git a/sh/alias/mv.sh b/sh/alias/mv.sh index 2a4ae5e..8f8bffd 100644 --- a/sh/alias/mv.sh +++ b/sh/alias/mv.sh @@ -1,6 +1,6 @@ # move interactively -mvi() { sh_a__mo_ve_interactive "${@}"; } -sh_a__mo_ve_interactive() { +mvi() { sa__mo_ve_interactive "${@}"; } +sa__mo_ve_interactive() { mv \ --interactive \ "${@}" diff --git a/sh/alias/nano.sh b/sh/alias/nano.sh index ca6eb65..b7cad2c 100644 --- a/sh/alias/nano.sh +++ b/sh/alias/nano.sh @@ -1,5 +1,5 @@ -nn() { sh_a__na_no "${@}"; } -sh_a__na_no() { +nn() { sa__na_no "${@}"; } +sa__na_no() { nano \ "${@}" } diff --git a/sh/alias/newsboat.sh b/sh/alias/newsboat.sh index 18c09e3..e061d63 100644 --- a/sh/alias/newsboat.sh +++ b/sh/alias/newsboat.sh @@ -1,5 +1,5 @@ -nb() { sh_a__news_boat "${@}"; } -sh_a__news_boat() { +nb() { sa__news_boat "${@}"; } +sa__news_boat() { newsboat \ "${@}" } diff --git a/sh/alias/pass.sh b/sh/alias/pass.sh index e94898a..6e3a4da 100644 --- a/sh/alias/pass.sh +++ b/sh/alias/pass.sh @@ -1,13 +1,13 @@ # display pass entry’s content -p() { sh_a__pass "${@}"; } -sh_a__pass() { +p() { sa__pass "${@}"; } +sa__pass() { pass \ "${@}" } # copy passphrase into clipboard -pc() { sh_a__pass_clip "${@}"; } -sh_a__pass_clip() { +pc() { sa__pass_clip "${@}"; } +sa__pass_clip() { pass \ --clip \ "${@}" diff --git a/sh/alias/pgrep.sh b/sh/alias/pgrep.sh index a17c888..9350d6e 100644 --- a/sh/alias/pgrep.sh +++ b/sh/alias/pgrep.sh @@ -1,6 +1,6 @@ # look for a string in processes names -pg() { sh_a__proc_grep "${@}"; } -sh_a__proc_grep() { +pg() { sa__proc_grep "${@}"; } +sa__proc_grep() { pgrep \ --list-full \ "${@}" diff --git a/sh/alias/pwgen.sh b/sh/alias/pwgen.sh index 4c0b1f2..a2cfcc7 100644 --- a/sh/alias/pwgen.sh +++ b/sh/alias/pwgen.sh @@ -1,6 +1,6 @@ # generate passwords -pwg() { sh_a__pass_word_gen "${@}"; } -sh_a__pass_word_gen() { +pwg() { sa__pass_word_gen "${@}"; } +sa__pass_word_gen() { pwgen \ -1 \ --num-passwords 1048576 \ @@ -9,9 +9,9 @@ sh_a__pass_word_gen() { } # generate passwords with symbols -pwgs() { sh_a__pass_word_gen_symbols "${@}"; } -sh_a__pass_word_gen_symbols() { - sh_a__pass_word_gen \ +pwgs() { sa__pass_word_gen_symbols "${@}"; } +sa__pass_word_gen_symbols() { + sa__pass_word_gen \ --symbols \ "${@}" } diff --git a/sh/alias/rm.sh b/sh/alias/rm.sh index f944698..ca6bd11 100644 --- a/sh/alias/rm.sh +++ b/sh/alias/rm.sh @@ -1,6 +1,6 @@ # remove interactively -rmi() { sh_a__re_move_interactive "${@}"; } -sh_a__re_move_interactive() { +rmi() { sa__re_move_interactive "${@}"; } +sa__re_move_interactive() { rm \ --interactive \ "${@}" diff --git a/sh/alias/rsync.sh b/sh/alias/rsync.sh index 02ea400..773d317 100644 --- a/sh/alias/rsync.sh +++ b/sh/alias/rsync.sh @@ -1,6 +1,6 @@ # synchronize -rs() { sh_a__r_sync "${@}"; } -sh_a__r_sync() { +rs() { sa__r_sync "${@}"; } +sa__r_sync() { rsync \ --archive \ --no-inc-recursive \ @@ -11,17 +11,17 @@ sh_a__r_sync() { } # synchronize and delete after -rsda() { sh_a__r_sync_delete_after "${@}"; } -sh_a__r_sync_delete_after() { - sh_a__r_sync \ +rsda() { sa__r_sync_delete_after "${@}"; } +sa__r_sync_delete_after() { + sa__r_sync \ --delete-after \ "${@}" } # synchronize and delete before -rsdb() { sh_a__r_sync_delete_before "${@}"; } -sh_a__r_sync_delete_before() { - sh_a__r_sync \ +rsdb() { sa__r_sync_delete_before "${@}"; } +sa__r_sync_delete_before() { + sa__r_sync \ --delete-before \ "${@}" } diff --git a/sh/alias/tar.sh b/sh/alias/tar.sh index 6da0d03..6cebb0d 100644 --- a/sh/alias/tar.sh +++ b/sh/alias/tar.sh @@ -1,30 +1,30 @@ -tc() { sh_a__tar_create "${@}"; } -sh_a__tar_create() { - sh_a__tar_verbose \ +tc() { sa__tar_create "${@}"; } +sa__tar_create() { + sa__tar_verbose \ --create \ --auto-compress \ --file \ "${@}" } -tl() { sh_a__tar_list "${@}"; } -sh_a__tar_list() { - sh_a__tar_verbose \ +tl() { sa__tar_list "${@}"; } +sa__tar_list() { + sa__tar_verbose \ --list \ --file \ "${@}" } -tv() { sh_a__tar_verbose "${@}"; } -sh_a__tar_verbose() { +tv() { sa__tar_verbose "${@}"; } +sa__tar_verbose() { tar \ --verbose \ "${@}" } -tx() { sh_a__tar_xtract "${@}"; } -sh_a__tar_xtract() { - sh_a__tar_verbose \ +tx() { sa__tar_xtract "${@}"; } +sa__tar_xtract() { + sa__tar_verbose \ --extract \ --file \ "${@}" diff --git a/sh/alias/tmux.sh b/sh/alias/tmux.sh index fa51bd5..57d6053 100644 --- a/sh/alias/tmux.sh +++ b/sh/alias/tmux.sh @@ -1,5 +1,5 @@ -tm() { sh_a__t_mux "${@}"; } -sh_a__t_mux() { +tm() { sa__t_mux "${@}"; } +sa__t_mux() { tmux \ "${@}" } diff --git a/sh/alias/tree.sh b/sh/alias/tree.sh index 9d807c0..d172896 100644 --- a/sh/alias/tree.sh +++ b/sh/alias/tree.sh @@ -1,11 +1,11 @@ -t() { sh_a__tree "${@}"; } -sh_a__tree() { +t() { sa__tree "${@}"; } +sa__tree() { tree \ "${@}" } -ta() { sh_a__tree_all "${@}"; } -sh_a__tree_all() { +ta() { sa__tree_all "${@}"; } +sa__tree_all() { tree \ -a \ "${@}" From 07f5f9f4e924aba895ff852d55d9ad4e6aca3f3f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:22:24 +0100 Subject: [PATCH 573/702] gak,gau --- sh/alias/gpg.sh | 14 ++++++++++++++ sh/gpg.sh | 15 --------------- 2 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 sh/alias/gpg.sh diff --git a/sh/alias/gpg.sh b/sh/alias/gpg.sh new file mode 100644 index 0000000..30ece71 --- /dev/null +++ b/sh/alias/gpg.sh @@ -0,0 +1,14 @@ +# turn gpg agent off +gak() { sa__gpg_agent_kill "${@}"; } +sa__gpg_agent_kill() { + gpgconf \ + --kill "gpg-agent" +} + +# bind gpg agent to current tty +gau() { sa__gpg_agent_update "${@}"; } +sa__gpg_agent_update() { + gpg-connect-agent \ + updatestartuptty \ + /bye +} diff --git a/sh/gpg.sh b/sh/gpg.sh index ffa4f63..5990fd0 100644 --- a/sh/gpg.sh +++ b/sh/gpg.sh @@ -1,18 +1,3 @@ -# turn gpg agent off -gak() { gpg_agent_kill "${@}"; } -sh_gpg_agent_kill() { - gpgconf \ - --kill "gpg-agent" -} - -# bind gpg agent to current tty -gau() { gpg_agent_update "${@}"; } -sh_gpg_agent_update() { - gpg-connect-agent \ - updatestartuptty \ - /bye -} - sh_gpg_ssh() { local user_id user_id=$(id --user) From 58090332dd998fd4a9c840abaf7093778afc0094 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:24:45 +0100 Subject: [PATCH 574/702] b --- sh/alias/batcat.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/alias/batcat.sh b/sh/alias/batcat.sh index 4d5968b..9af2774 100644 --- a/sh/alias/batcat.sh +++ b/sh/alias/batcat.sh @@ -1,5 +1,5 @@ -bat() { sa__b_a_t "${@}"; } -sa__b_a_t() { +b() { sa__bat "${@}"; } +sa__bat() { batcat \ "${@}" } From e212c967b03a95bda59894c0a0ff77a9c285b6a0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:25:49 +0100 Subject: [PATCH 575/702] remount --- sh/{cmd/mount.sh => live.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sh/{cmd/mount.sh => live.sh} (79%) diff --git a/sh/cmd/mount.sh b/sh/live.sh similarity index 79% rename from sh/cmd/mount.sh rename to sh/live.sh index 4454c41..dc77ce5 100644 --- a/sh/cmd/mount.sh +++ b/sh/live.sh @@ -1,5 +1,5 @@ # remount read-only medium in read-write -remount() { +sh_live_medium_remount() { mount \ -o "remount,rw" \ "/usr/lib/live/mount/medium" From 0bbd7a68c1e75f35dce3133842e2832c514bc826 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:37:33 +0100 Subject: [PATCH 576/702] home --- sh/rescue/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index f33c5aa..3b5fc85 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -6,7 +6,7 @@ rescue_configure() { apt_sources_write # bash / rc main_link_bashrc - mv .bashrc .bashrc.old + mv "${HOME}/.bashrc" "${HOME}/.bashrc.old" # host name hostname "${hostname}" # locales From e33138bab4acad1fb4bc2d0aadcdc0e2725177e5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:44:00 +0100 Subject: [PATCH 577/702] auth_sock --- sh/gpg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/gpg.sh b/sh/gpg.sh index 5990fd0..26a4e6e 100644 --- a/sh/gpg.sh +++ b/sh/gpg.sh @@ -1,4 +1,4 @@ -sh_gpg_ssh() { +sh_gpg_ssh_auth_sock() { local user_id user_id=$(id --user) if [ "${user_id}" -ne 0 ]; then @@ -9,4 +9,4 @@ sh_gpg_ssh() { fi } -sh_gpg_ssh +sh_gpg_ssh_auth_sock From 2089e8c1e05995c80a5075308683db60c43d4ad4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:52:38 +0100 Subject: [PATCH 578/702] errors --- sh/log.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index c938663..e91c3ca 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -17,13 +17,13 @@ sh_log_debug() { sh_log_error() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then - echo "[ERROR]" "${@}" + echo "[ERROR]" "${@}" >&2 fi } sh_log_fatal() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then - echo "[FATAL]" "${@}" + echo "[FATAL]" "${@}" >&2 fi } From fbe30920d7b79b49376c41cdcc37b2fce74c7ef1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 09:58:15 +0100 Subject: [PATCH 579/702] codes --- sh/log.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sh/log.sh b/sh/log.sh index e91c3ca..34e986f 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -16,14 +16,22 @@ sh_log_debug() { } sh_log_error() { + local code="${1}" + shift + [ -n "${code}" ] || sh_log_fatal 1 "No error code" if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then echo "[ERROR]" "${@}" >&2 + return "${code}" fi } sh_log_fatal() { + local code="${1}" + shift + [ -n "${code}" ] || sh_log_fatal 1 "No error code" if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then echo "[FATAL]" "${@}" >&2 + exit "${code}" fi } From 05e500c36a1d458d84b3804df722051298a93a2e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:22:44 +0100 Subject: [PATCH 580/702] frontend --- sh/debian.sh | 2 +- sh/rescue/common.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index db37cae..a345b08 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -71,6 +71,6 @@ apt_upgrade() { apt_clean } -debian_disable_frontend() { +debian_frontend_disable() { export DEBIAN_FRONTEND="noninteractive" } diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index 3b5fc85..d94616b 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -19,7 +19,7 @@ fr_FR.UTF-8 UTF-8 # update catalog apt_update # disable frontend - debian_disable_frontend + debian_frontend_disable # install backports apt_install_backports "tmux" # install packages @@ -32,7 +32,7 @@ rescue_install() { # update catalog apt_update # disable frontend - debian_disable_frontend + debian_frontend_disable # upgrade packages apt_upgrade # install packages From d8929dfd4c04872f37bea0c56dee81efe4580d95 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:24:05 +0100 Subject: [PATCH 581/702] sh/frontend --- sh/debian.sh | 2 +- sh/rescue/common.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index a345b08..feeb8ac 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -71,6 +71,6 @@ apt_upgrade() { apt_clean } -debian_frontend_disable() { +sh_debian_frontend_disable() { export DEBIAN_FRONTEND="noninteractive" } diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index d94616b..69aded0 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -19,7 +19,7 @@ fr_FR.UTF-8 UTF-8 # update catalog apt_update # disable frontend - debian_frontend_disable + sh_debian_frontend_disable # install backports apt_install_backports "tmux" # install packages @@ -32,7 +32,7 @@ rescue_install() { # update catalog apt_update # disable frontend - debian_frontend_disable + sh_debian_frontend_disable # upgrade packages apt_upgrade # install packages From b02b2d183f9d82cedeb8b77231b64bac91d0c798 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:25:22 +0100 Subject: [PATCH 582/702] apt/upgrade --- sh/debian.sh | 2 +- sh/rescue/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index feeb8ac..4485be6 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -64,7 +64,7 @@ apt_update() { update } -apt_upgrade() { +sh_apt_upgrade() { apt-get \ upgrade \ --assume-yes diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index 69aded0..a9a08d7 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -34,7 +34,7 @@ rescue_install() { # disable frontend sh_debian_frontend_disable # upgrade packages - apt_upgrade + sh_apt_upgrade # install packages apt_install_release \ "man-db" \ From 10162404836a8b2b152fb23ca406404ae04d35f4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:33:56 +0100 Subject: [PATCH 583/702] apt/update --- sh/debian.sh | 2 +- sh/rescue/common.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 4485be6..7cc17e1 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -59,7 +59,7 @@ ${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" } -apt_update() { +sh_apt_update() { apt-get \ update } diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index a9a08d7..200f839 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -17,7 +17,7 @@ fr_FR.UTF-8 UTF-8 # generate locales locale-gen # update catalog - apt_update + sh_apt_update # disable frontend sh_debian_frontend_disable # install backports @@ -25,12 +25,12 @@ fr_FR.UTF-8 UTF-8 # install packages apt_install_release "apt-file" "mosh" "screen" "byobu" # update catalog - apt_update + sh_apt_update } rescue_install() { # update catalog - apt_update + sh_apt_update # disable frontend sh_debian_frontend_disable # upgrade packages From 3c3f8ffeca92056c5cfbfdb5192589e57dd3a653 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:36:35 +0100 Subject: [PATCH 584/702] apt/sources --- sh/debian.sh | 2 +- sh/rescue/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 7cc17e1..36c7cdd 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -46,7 +46,7 @@ apt_install_target() { done } -apt_sources_write() { +sh_apt_sources_write() { printf "%s" "\ deb https://deb.debian.org/debian \ ${DEBIAN_CODENAME} main non-free-firmware contrib non-free diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index 200f839..ecc21c2 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -3,7 +3,7 @@ rescue_configure() { # apt / conf apt_conf_write # apt / sources - apt_sources_write + sh_apt_sources_write # bash / rc main_link_bashrc mv "${HOME}/.bashrc" "${HOME}/.bashrc.old" From c9c4aa9a6fee467a5657eb10f10f2680e3bd12f8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:37:35 +0100 Subject: [PATCH 585/702] apt/clean --- sh/debian.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 36c7cdd..c4deb80 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -3,7 +3,7 @@ DEBIAN_CODENAME="$( cut --delimiter "=" --fields "2" )" -apt_clean() { +sh_apt_clean() { apt-get \ clean } @@ -42,7 +42,7 @@ apt_install_target() { --assume-yes \ --target-release "${target}" \ "${package}" - apt_clean + sh_apt_clean done } @@ -68,7 +68,7 @@ sh_apt_upgrade() { apt-get \ upgrade \ --assume-yes - apt_clean + sh_apt_clean } sh_debian_frontend_disable() { From 67510c2deef3e119022493ab200895e3687dad4e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:39:25 +0100 Subject: [PATCH 586/702] apt/conf --- sh/debian.sh | 2 +- sh/rescue/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index c4deb80..97bb8d3 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -8,7 +8,7 @@ sh_apt_clean() { clean } -apt_conf_write() { +sh_apt_conf_write() { printf "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index ecc21c2..3f026e7 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -1,7 +1,7 @@ rescue_configure() { local hostname="${1}" # apt / conf - apt_conf_write + sh_apt_conf_write # apt / sources sh_apt_sources_write # bash / rc From 1a1679031e9a5707712be361e86c74c960caaa1e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:41:16 +0100 Subject: [PATCH 587/702] apt/target --- sh/debian.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 97bb8d3..8d00ac9 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -23,14 +23,14 @@ Dpkg::Progress True; } apt_install_backports() { - apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" + sh_apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" } apt_install_release() { - apt_install_target "${DEBIAN_CODENAME}" "${@}" + sh_apt_install_target "${DEBIAN_CODENAME}" "${@}" } -apt_install_target() { +sh_apt_install_target() { local target="${1}" shift local package From 1ad055dfb48557aedb6c4664b85801d8917096c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:45:49 +0100 Subject: [PATCH 588/702] apt/release --- sh/debian.sh | 2 +- sh/rescue/common.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 8d00ac9..64a2751 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -26,7 +26,7 @@ apt_install_backports() { sh_apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" } -apt_install_release() { +sh_apt_install_release() { sh_apt_install_target "${DEBIAN_CODENAME}" "${@}" } diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index 3f026e7..de35c83 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -23,7 +23,7 @@ fr_FR.UTF-8 UTF-8 # install backports apt_install_backports "tmux" # install packages - apt_install_release "apt-file" "mosh" "screen" "byobu" + sh_apt_install_release "apt-file" "mosh" "screen" "byobu" # update catalog sh_apt_update } @@ -36,7 +36,7 @@ rescue_install() { # upgrade packages sh_apt_upgrade # install packages - apt_install_release \ + sh_apt_install_release \ "man-db" \ "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \ From bb08d4c5da497b4db17a694f85a72a2ebcebaf90 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 10:46:30 +0100 Subject: [PATCH 589/702] apt/backports --- sh/debian.sh | 2 +- sh/rescue/common.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 64a2751..39639b9 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -22,7 +22,7 @@ Dpkg::Progress True; " >"/etc/apt/apt.conf.d/apt.conf" } -apt_install_backports() { +sh_apt_install_backports() { sh_apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" } diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index de35c83..b108681 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -21,7 +21,7 @@ fr_FR.UTF-8 UTF-8 # disable frontend sh_debian_frontend_disable # install backports - apt_install_backports "tmux" + sh_apt_install_backports "tmux" # install packages sh_apt_install_release "apt-file" "mosh" "screen" "byobu" # update catalog @@ -45,7 +45,7 @@ rescue_install() { "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" # install backports - apt_install_backports \ + sh_apt_install_backports \ "grub-pc-bin" \ \ "grub-efi-amd64-bin" From 7dfbb947ff27303b400fca1bdfb6f0e2ec4a05f8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 11:02:32 +0100 Subject: [PATCH 590/702] prefixes --- sh/main.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 81c412e..d45a22a 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -44,6 +44,8 @@ main_source_directory() { fi done IFS="${ifs}" + sh_log + sh_log "sa__… sh_… su__…" else echo "Not a directory: ${path}" return 1 From d90f0fd6ef960425a4f9a59a65e121352264ca79 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 12:21:29 +0100 Subject: [PATCH 591/702] _sh_log --- sh/log.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index 34e986f..40cb311 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -11,7 +11,7 @@ sh_log() { sh_log_info "${@}"; } sh_log_debug() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then - echo "[DEBUG]" "${@}" + _sh_log "[DEBUG]" "${@}" fi } @@ -20,7 +20,7 @@ sh_log_error() { shift [ -n "${code}" ] || sh_log_fatal 1 "No error code" if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then - echo "[ERROR]" "${@}" >&2 + _sh_log "[ERROR]" "${@}" >&2 return "${code}" fi } @@ -30,25 +30,35 @@ sh_log_fatal() { shift [ -n "${code}" ] || sh_log_fatal 1 "No error code" if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then - echo "[FATAL]" "${@}" >&2 + _sh_log "[FATAL]" "${@}" >&2 exit "${code}" fi } sh_log_info() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_INFO}" ]; then - echo "${@}" + _sh_log "" "${@}" fi } sh_log_trace() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_TRACE}" ]; then - echo "[TRACE]" "${@}" + _sh_log "[TRACE]" "${@}" fi } sh_log_warn() { if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_WARN}" ]; then - echo " [WARN]" "${@}" + _sh_log "[ WARN]" "${@}" fi } + +_sh_log() { + local prefix="${1}" + shift + local line + for line in "${@}"; do + printf "%s" "${prefix}" + echo " ${line}" + done +} \ No newline at end of file From ea17fc995a4b5e8054a45053a9695e57d1cc9e33 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 12:29:30 +0100 Subject: [PATCH 592/702] prefix --- sh/log.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index 40cb311..1674324 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -58,7 +58,7 @@ _sh_log() { shift local line for line in "${@}"; do - printf "%s" "${prefix}" - echo " ${line}" + [ -n "${prefix}" ] && printf "%s" "${prefix} " + echo "${line}" done -} \ No newline at end of file +} From a133acea99c1b7aa3ec7db6b7437d0869a1eed7b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 12:32:29 +0100 Subject: [PATCH 593/702] main/log --- sh/main.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index d45a22a..f727013 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -44,8 +44,6 @@ main_source_directory() { fi done IFS="${ifs}" - sh_log - sh_log "sa__… sh_… su__…" else echo "Not a directory: ${path}" return 1 @@ -65,3 +63,8 @@ main_source_file() { main_source_file "${ENV}" main_source_directory "${SH_USER}" + +sh_log "" \ + "sh_… shell functions" \ + "sa__… shell aliases" \ + "su__… shell user" From c8f6264f20556f25c6819227a8999795523d1939 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 14:11:11 +0100 Subject: [PATCH 594/702] main/commands --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index f727013..b761e6e 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -7,7 +7,7 @@ SH_MAIN="${SH_ROOT}/main.sh" [ -n "${ENV}" ] || export ENV="${SH_MAIN}" -main_commands() { +_sh_main_commands() { local file="${1}" grep "()" "${file}" | cut --delimiter "(" --fields 1 @@ -35,7 +35,7 @@ main_source_directory() { module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then . "${module}" - cmd="$(main_commands "${module}")" + cmd="$(_sh_main_commands "${module}")" if [ -n "${cmd}" ]; then [ -n "${CMD}" ] && CMD="${CMD} " From 838dbfc4f567225167557393c1e9e6e4edcda4b3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 14:33:03 +0100 Subject: [PATCH 595/702] user --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index b761e6e..22d716e 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -67,4 +67,4 @@ main_source_directory "${SH_USER}" sh_log "" \ "sh_… shell functions" \ "sa__… shell aliases" \ - "su__… shell user" + "u__… user aliases" From 14e9e52362d7827e720a8f81d8aaaebdda3d7b01 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 14:39:50 +0100 Subject: [PATCH 596/702] main/log --- sh/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 22d716e..387b1b3 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -65,6 +65,6 @@ main_source_file "${ENV}" main_source_directory "${SH_USER}" sh_log "" \ - "sh_… shell functions" \ - "sa__… shell aliases" \ - "u__… user aliases" + "sh_… = shell functions" \ + "a__… = aliases" \ + "u__… = user" From 8fae0bd63ecae5f7dc0561f4b06c15f066628e53 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 14:42:11 +0100 Subject: [PATCH 597/702] a__ --- sh/alias/apt.sh | 48 ++++----- sh/alias/batcat.sh | 4 +- sh/alias/btrfs.sh | 36 +++---- sh/alias/byobu.sh | 16 +-- sh/alias/chmod.sh | 8 +- sh/alias/chown.sh | 8 +- sh/alias/clear.sh | 4 +- sh/alias/cp.sh | 4 +- sh/alias/emacs.sh | 4 +- sh/alias/evince.sh | 4 +- sh/alias/git.sh | 242 +++++++++++++++++++++---------------------- sh/alias/gpg.sh | 8 +- sh/alias/grep.sh | 4 +- sh/alias/kill.sh | 8 +- sh/alias/killall.sh | 8 +- sh/alias/ls.sh | 16 +-- sh/alias/lsblk.sh | 16 +-- sh/alias/mkdir.sh | 8 +- sh/alias/mount.sh | 4 +- sh/alias/mv.sh | 4 +- sh/alias/nano.sh | 4 +- sh/alias/newsboat.sh | 4 +- sh/alias/pass.sh | 8 +- sh/alias/pgrep.sh | 4 +- sh/alias/pwgen.sh | 10 +- sh/alias/rm.sh | 4 +- sh/alias/rsync.sh | 16 +-- sh/alias/tar.sh | 22 ++-- sh/alias/tmux.sh | 4 +- sh/alias/tree.sh | 8 +- 30 files changed, 269 insertions(+), 269 deletions(-) diff --git a/sh/alias/apt.sh b/sh/alias/apt.sh index 1af6d78..0f3294e 100644 --- a/sh/alias/apt.sh +++ b/sh/alias/apt.sh @@ -1,94 +1,94 @@ # show package information -acl() { sa__apt_cache_list "${@}"; } -sa__apt_cache_list() { +acl() { a__apt_cache_list "${@}"; } +a__apt_cache_list() { apt-cache \ show \ "${@}" } # package versions policy -acp() { sa__apt_cache_policy "${@}"; } -sa__apt_cache_policy() { +acp() { a__apt_cache_policy "${@}"; } +a__apt_cache_policy() { apt-cache \ policy \ "${@}" } # search package -acs() { sa__apt_cache_search "${@}"; } -sa__apt_cache_search() { +acs() { a__apt_cache_search "${@}"; } +a__apt_cache_search() { apt-cache \ search \ "${@}" } # -agap() { sa__apt_get_auto_purge "${@}"; } -sa__apt_get_auto_purge() { +agap() { a__apt_get_auto_purge "${@}"; } +a__apt_get_auto_purge() { apt-get \ autopurge \ "${@}" } # -agar() { sa__apt_get_auto_remove "${@}"; } -sa__apt_get_auto_remove() { +agar() { a__apt_get_auto_remove "${@}"; } +a__apt_get_auto_remove() { apt-get \ autoremove \ "${@}" } # clean packages cache -agc() { sa__apt_get_clean "${@}"; } -sa__apt_get_clean() { +agc() { a__apt_get_clean "${@}"; } +a__apt_get_clean() { apt-get \ clean \ "${@}" } # upgrade allowing package installation or removal -agfu() { sa__apt_get_full_upgrade "${@}"; } -sa__apt_get_full_upgrade() { +agfu() { a__apt_get_full_upgrade "${@}"; } +a__apt_get_full_upgrade() { apt-get \ full-upgrade \ "${@}" } # install packages -agi() { sa__apt_get_install "${@}"; } -sa__apt_get_install() { +agi() { a__apt_get_install "${@}"; } +a__apt_get_install() { apt-get \ install \ "${@}" } # -agp() { sa__apt_get_purge "${@}"; } -sa__apt_get_purge() { +agp() { a__apt_get_purge "${@}"; } +a__apt_get_purge() { apt-get \ purge \ "${@}" } # -agr() { sa__apt_get_remove "${@}"; } -sa__apt_get_remove() { +agr() { a__apt_get_remove "${@}"; } +a__apt_get_remove() { apt-get \ remove \ "${@}" } # update packages catalog -agud() { sa__apt_get_up_date "${@}"; } -sa__apt_get_up_date() { +agud() { a__apt_get_up_date "${@}"; } +a__apt_get_up_date() { apt-get \ update \ "${@}" } # upgrade forbidding package installation or removal -agug() { sa__apt_get_up_grade "${@}"; } -sa__apt_get_up_grade() { +agug() { a__apt_get_up_grade "${@}"; } +a__apt_get_up_grade() { apt-get \ upgrade \ "${@}" diff --git a/sh/alias/batcat.sh b/sh/alias/batcat.sh index 9af2774..99d8373 100644 --- a/sh/alias/batcat.sh +++ b/sh/alias/batcat.sh @@ -1,5 +1,5 @@ -b() { sa__bat "${@}"; } -sa__bat() { +b() { a__bat "${@}"; } +a__bat() { batcat \ "${@}" } diff --git a/sh/alias/btrfs.sh b/sh/alias/btrfs.sh index eb48c14..0e4ba62 100644 --- a/sh/alias/btrfs.sh +++ b/sh/alias/btrfs.sh @@ -1,13 +1,13 @@ -bfdf() { sa__btrfs_filesystem_d_f "${@}"; } -sa__btrfs_filesystem_d_f() { +bfdf() { a__btrfs_filesystem_d_f "${@}"; } +a__btrfs_filesystem_d_f() { btrfs \ filesystem \ df \ "${@}" } -bfdu() { sa__btrfs_filesystem_d_u "${@}"; } -sa__btrfs_filesystem_d_u() { +bfdu() { a__btrfs_filesystem_d_u "${@}"; } +a__btrfs_filesystem_d_u() { btrfs \ filesystem \ du \ @@ -15,40 +15,40 @@ sa__btrfs_filesystem_d_u() { "${@}" } -bfu() { sa__btrfs_filesystem_usage "${@}"; } -sa__btrfs_filesystem_usage() { +bfu() { a__btrfs_filesystem_usage "${@}"; } +a__btrfs_filesystem_usage() { btrfs \ filesystem \ usage \ "${@}" } -bpg() { sa__btrfs_property_get "${@}"; } -sa__btrfs_property_get() { +bpg() { a__btrfs_property_get "${@}"; } +a__btrfs_property_get() { btrfs \ property \ get \ "${@}" } -bsc() { sa__btrfs_subvolume_create "${@}"; } -sa__btrfs_subvolume_create() { +bsc() { a__btrfs_subvolume_create "${@}"; } +a__btrfs_subvolume_create() { btrfs \ subvolume \ create \ "${@}" } -bsd() { sa__btrfs_subvolume_delete "${@}"; } -sa__btrfs_subvolume_delete() { +bsd() { a__btrfs_subvolume_delete "${@}"; } +a__btrfs_subvolume_delete() { btrfs \ subvolume \ delete \ "${@}" } -bsl() { sa__btrfs_subvolume_list "${@}"; } -sa__btrfs_subvolume_list() { +bsl() { a__btrfs_subvolume_list "${@}"; } +a__btrfs_subvolume_list() { if [ -n "${1}" ]; then btrfs subvolume list "${1}" | cut --delimiter " " --fields 9 | @@ -56,16 +56,16 @@ sa__btrfs_subvolume_list() { fi } -bss() { sa__btrfs_subvolume_snapshot "${@}"; } -sa__btrfs_subvolume_snapshot() { +bss() { a__btrfs_subvolume_snapshot "${@}"; } +a__btrfs_subvolume_snapshot() { btrfs \ subvolume \ snapshot \ "${@}" } -bssr() { sa__btrfs_subvolume_snapshot_r "${@}"; } -sa__btrfs_subvolume_snapshot_r() { +bssr() { a__btrfs_subvolume_snapshot_r "${@}"; } +a__btrfs_subvolume_snapshot_r() { btrfs \ subvolume \ snapshot -r \ diff --git a/sh/alias/byobu.sh b/sh/alias/byobu.sh index 6b66a77..0f5336e 100644 --- a/sh/alias/byobu.sh +++ b/sh/alias/byobu.sh @@ -1,25 +1,25 @@ -bb() { sa__byo_bu "${@}"; } -sa__byo_bu() { +bb() { a__byo_bu "${@}"; } +a__byo_bu() { byobu \ "${@}" } -bba() { sa__byo_bu_attach "${@}"; } -sa__byo_bu_attach() { +bba() { a__byo_bu_attach "${@}"; } +a__byo_bu_attach() { byobu \ attach-session \ "${@}" } -bbl() { sa__byo_bu_ls "${@}"; } -sa__byo_bu_ls() { +bbl() { a__byo_bu_ls "${@}"; } +a__byo_bu_ls() { byobu \ ls \ "${@}" } -bbnd() { sa__byo_bu_new_detach "${@}"; } -sa__byo_bu_new_detach() { +bbnd() { a__byo_bu_new_detach "${@}"; } +a__byo_bu_new_detach() { byobu \ new-session \ -d \ diff --git a/sh/alias/chmod.sh b/sh/alias/chmod.sh index 6a6e0e8..57ec74e 100644 --- a/sh/alias/chmod.sh +++ b/sh/alias/chmod.sh @@ -1,14 +1,14 @@ # change mode to directory -cmd() { sa__change_mode_directory "${@}"; } -sa__change_mode_directory() { +cmd() { a__change_mode_directory "${@}"; } +a__change_mode_directory() { chmod \ "755" \ "${@}" } # change mode to file -cmf() { sa__change_mode_file "${@}"; } -sa__change_mode_file() { +cmf() { a__change_mode_file "${@}"; } +a__change_mode_file() { chmod \ "644" \ "${@}" diff --git a/sh/alias/chown.sh b/sh/alias/chown.sh index 8c992d3..f4fa865 100644 --- a/sh/alias/chown.sh +++ b/sh/alias/chown.sh @@ -1,14 +1,14 @@ # change owner to root -cor() { sa__change_owner_root "${@}"; } -sa__change_owner_root() { +cor() { a__change_owner_root "${@}"; } +a__change_owner_root() { chown \ "0:0" \ "${@}" } # change owner to user -cou() { sa__change_owner_user "${@}"; } -sa__change_owner_user() { +cou() { a__change_owner_user "${@}"; } +a__change_owner_user() { chown \ "1000:1000" \ "${@}" diff --git a/sh/alias/clear.sh b/sh/alias/clear.sh index 542a260..ae32b30 100644 --- a/sh/alias/clear.sh +++ b/sh/alias/clear.sh @@ -1,6 +1,6 @@ # clear terminal -c() { sa__clear "${@}"; } -sa__clear() { +c() { a__clear "${@}"; } +a__clear() { clear \ "${@}" } diff --git a/sh/alias/cp.sh b/sh/alias/cp.sh index d8897c0..c9e7d6b 100644 --- a/sh/alias/cp.sh +++ b/sh/alias/cp.sh @@ -1,6 +1,6 @@ # copy interactively -cpi() { sa__co_py_interactive "${@}"; } -sa__co_py_interactive() { +cpi() { a__co_py_interactive "${@}"; } +a__co_py_interactive() { cp \ --interactive \ "${@}" diff --git a/sh/alias/emacs.sh b/sh/alias/emacs.sh index cc7e002..8e26878 100644 --- a/sh/alias/emacs.sh +++ b/sh/alias/emacs.sh @@ -1,5 +1,5 @@ -em() { sa__e_macs "${@}"; } -sa__e_macs() { +em() { a__e_macs "${@}"; } +a__e_macs() { emacs \ "${@}" } diff --git a/sh/alias/evince.sh b/sh/alias/evince.sh index 5d68ace..25ac069 100644 --- a/sh/alias/evince.sh +++ b/sh/alias/evince.sh @@ -1,5 +1,5 @@ -ev() { sa__e_vince "${@}"; } -sa__e_vince() { +ev() { a__e_vince "${@}"; } +a__e_vince() { evince \ "${@}" } diff --git a/sh/alias/git.sh b/sh/alias/git.sh index 5ce2f93..6400092 100644 --- a/sh/alias/git.sh +++ b/sh/alias/git.sh @@ -8,16 +8,16 @@ C %C(blue)%cn %ce %B" # add to index -ga() { sa__git_add "${@}"; } -sa__git_add() { +ga() { a__git_add "${@}"; } +a__git_add() { git \ add \ "${@}" } # add all to index -gaa() { sa__git_add_all "${@}"; } -sa__git_add_all() { +gaa() { a__git_add_all "${@}"; } +a__git_add_all() { git \ add \ --all \ @@ -25,8 +25,8 @@ sa__git_add_all() { } # add parts of all to index -gaap() { sa__git_add_all_patch "${@}"; } -sa__git_add_all_patch() { +gaap() { a__git_add_all_patch "${@}"; } +a__git_add_all_patch() { git \ add \ --all \ @@ -35,8 +35,8 @@ sa__git_add_all_patch() { } # add parts to index -gap() { sa__git_add_patch "${@}"; } -sa__git_add_patch() { +gap() { a__git_add_patch "${@}"; } +a__git_add_patch() { git \ add \ --patch \ @@ -44,16 +44,16 @@ sa__git_add_patch() { } # create a branch -gb() { sa__git_branch "${@}"; } -sa__git_branch() { +gb() { a__git_branch "${@}"; } +a__git_branch() { git \ branch \ "${@}" } # delete a branch -gbd() { sa__git_branch_delete "${@}"; } -sa__git_branch_delete() { +gbd() { a__git_branch_delete "${@}"; } +a__git_branch_delete() { git \ branch \ --delete \ @@ -61,8 +61,8 @@ sa__git_branch_delete() { } # force a branch deletion -gbdf() { sa__git_branch_delete_force "${@}"; } -sa__git_branch_delete_force() { +gbdf() { a__git_branch_delete_force "${@}"; } +a__git_branch_delete_force() { git \ branch \ --delete \ @@ -71,8 +71,8 @@ sa__git_branch_delete_force() { } # list branches -gbl() { sa__git_branch_list "${@}"; } -sa__git_branch_list() { +gbl() { a__git_branch_list "${@}"; } +a__git_branch_list() { git \ branch \ --all \ @@ -83,8 +83,8 @@ sa__git_branch_list() { } # set the link to a remote branch from a local branch -gbsu() { sa__git_branch_set_upstream "${@}"; } -sa__git_branch_set_upstream() { +gbsu() { a__git_branch_set_upstream "${@}"; } +a__git_branch_set_upstream() { git \ branch \ --set-upstream-to \ @@ -92,16 +92,16 @@ sa__git_branch_set_upstream() { } # switch to a branch or checkout file(s) from a commit -gc() { sa__git_checkout "${@}"; } -sa__git_checkout() { +gc() { a__git_checkout "${@}"; } +a__git_checkout() { git \ checkout \ "${@}" } # checkout an orphan branch -gco() { sa__git_checkout_orphan "${@}"; } -sa__git_checkout_orphan() { +gco() { a__git_checkout_orphan "${@}"; } +a__git_checkout_orphan() { git \ checkout \ --orphan \ @@ -109,16 +109,16 @@ sa__git_checkout_orphan() { } # pick a commit -gcp() { sa__git_cherry_pick "${@}"; } -sa__git_cherry_pick() { +gcp() { a__git_cherry_pick "${@}"; } +a__git_cherry_pick() { git \ cherry-pick \ "${@}" } # abort the commit pick -gcpa() { sa__git_cherry_pick_abort "${@}"; } -sa__git_cherry_pick_abort() { +gcpa() { a__git_cherry_pick_abort "${@}"; } +a__git_cherry_pick_abort() { git \ cherry-pick \ --abort \ @@ -126,8 +126,8 @@ sa__git_cherry_pick_abort() { } # continue the commit pick -gcpc() { sa__git_cherry_pick_continue "${@}"; } -sa__git_cherry_pick_continue() { +gcpc() { a__git_cherry_pick_continue "${@}"; } +a__git_cherry_pick_continue() { git \ cherry-pick \ --continue \ @@ -135,8 +135,8 @@ sa__git_cherry_pick_continue() { } # clean untracked files -gcf() { sa__git_clean_force "${@}"; } -sa__git_clean_force() { +gcf() { a__git_clean_force "${@}"; } +a__git_clean_force() { git \ clean \ -d \ @@ -145,8 +145,8 @@ sa__git_clean_force() { } # redo the last commit with a different message -gcam() { sa__git_commit_amend_message "${@}"; } -sa__git_commit_amend_message() { +gcam() { a__git_commit_amend_message "${@}"; } +a__git_commit_amend_message() { git \ commit \ --amend \ @@ -155,8 +155,8 @@ sa__git_commit_amend_message() { } # make a root commit -gcem() { sa__git_commit_empty_message "${@}"; } -sa__git_commit_empty_message() { +gcem() { a__git_commit_empty_message "${@}"; } +a__git_commit_empty_message() { git \ commit \ --allow-empty \ @@ -166,8 +166,8 @@ sa__git_commit_empty_message() { } # commit the index -gcm() { sa__git_commit_message "${@}"; } -sa__git_commit_message() { +gcm() { a__git_commit_message "${@}"; } +a__git_commit_message() { git \ commit \ --message \ @@ -175,8 +175,8 @@ sa__git_commit_message() { } # configure the user email -gcue() { sa__git_config_user_email "${@}"; } -sa__git_config_user_email() { +gcue() { a__git_config_user_email "${@}"; } +a__git_config_user_email() { git \ config \ "user.email" \ @@ -184,8 +184,8 @@ sa__git_config_user_email() { } # configure the user name -gcun() { sa__git_config_user_name "${@}"; } -sa__git_config_user_name() { +gcun() { a__git_config_user_name "${@}"; } +a__git_config_user_name() { git \ config \ "user.name" \ @@ -193,16 +193,16 @@ sa__git_config_user_name() { } # differences from last or between commits -gd() { sa__git_diff "${@}"; } -sa__git_diff() { +gd() { a__git_diff "${@}"; } +a__git_diff() { git \ diff \ "${@}" } # display what is indexed in cache -gdc() { sa__git_diff_cached "${@}"; } -sa__git_diff_cached() { +gdc() { a__git_diff_cached "${@}"; } +a__git_diff_cached() { git \ diff \ --cached \ @@ -210,8 +210,8 @@ sa__git_diff_cached() { } # indexed character-level differences -gdcw() { sa__git_diff_cached_word "${@}"; } -sa__git_diff_cached_word() { +gdcw() { a__git_diff_cached_word "${@}"; } +a__git_diff_cached_word() { git \ diff \ --cached \ @@ -220,8 +220,8 @@ sa__git_diff_cached_word() { } # differences via external tool -gdt() { sa__git_diff_tool "${@}"; } -sa__git_diff_tool() { +gdt() { a__git_diff_tool "${@}"; } +a__git_diff_tool() { git \ difftool \ --dir-diff \ @@ -229,8 +229,8 @@ sa__git_diff_tool() { } # character-level differences -gdw() { sa__git_diff_word "${@}"; } -sa__git_diff_word() { +gdw() { a__git_diff_word "${@}"; } +a__git_diff_word() { git \ diff \ --word-diff-regex "." \ @@ -238,8 +238,8 @@ sa__git_diff_word() { } # fetch from the remote repository -gf() { sa__git_fetch "${@}"; } -sa__git_fetch() { +gf() { a__git_fetch "${@}"; } +a__git_fetch() { git \ fetch \ --tags \ @@ -248,16 +248,16 @@ sa__git_fetch() { } # fetch from remote repository and prune local orphan branches -gfp() { sa__git_fetch_prune "${@}"; } -sa__git_fetch_prune() { - sa__git_fetch \ +gfp() { a__git_fetch_prune "${@}"; } +a__git_fetch_prune() { + a__git_fetch \ --prune \ "${@}" } # garbage collect all orphan commits -ggc() { sa__git_garbage_collect "${@}"; } -sa__git_garbage_collect() { +ggc() { a__git_garbage_collect "${@}"; } +a__git_garbage_collect() { git \ reflog \ expire \ @@ -270,16 +270,16 @@ sa__git_garbage_collect() { } # initialize a new repository -gi() { sa__git_init "${@}"; } -sa__git_init() { +gi() { a__git_init "${@}"; } +a__git_init() { git \ init \ "${@}" } # initialize a new bare repository -gib() { sa__git_init_bare "${@}"; } -sa__git_init_bare() { +gib() { a__git_init_bare "${@}"; } +a__git_init_bare() { git \ init \ --bare \ @@ -287,8 +287,8 @@ sa__git_init_bare() { } # log history -gl() { sa__git_log "${@}"; } -sa__git_log() { +gl() { a__git_log "${@}"; } +a__git_log() { git \ log \ --abbrev=8 \ @@ -299,33 +299,33 @@ sa__git_log() { } # log all history -gla() { sa__git_log_all "${@}"; } -sa__git_log_all() { - sa__git_log \ +gla() { a__git_log_all "${@}"; } +a__git_log_all() { + a__git_log \ --all \ "${@}" } # log all history with patches -glap() { sa__git_log_all_patch "${@}"; } -sa__git_log_all_patch() { - sa__git_log \ +glap() { a__git_log_all_patch "${@}"; } +a__git_log_all_patch() { + a__git_log \ --all \ --patch \ "${@}" } # log history with patches -glp() { sa__git_log_patch "${@}"; } -sa__git_log_patch() { - sa__git_log \ +glp() { a__git_log_patch "${@}"; } +a__git_log_patch() { + a__git_log \ --patch \ "${@}" } # fast-forward merge to remote branch -gm() { sa__git_merge "${@}"; } -sa__git_merge() { +gm() { a__git_merge "${@}"; } +a__git_merge() { git \ merge \ --ff-only \ @@ -333,8 +333,8 @@ sa__git_merge() { } # abort the current merge commit -gma() { sa__git_merge_abort "${@}"; } -sa__git_merge_abort() { +gma() { a__git_merge_abort "${@}"; } +a__git_merge_abort() { git \ merge \ --abort \ @@ -342,8 +342,8 @@ sa__git_merge_abort() { } # do a merge commit -gmc() { sa__git_merge_commit "${@}"; } -sa__git_merge_commit() { +gmc() { a__git_merge_commit "${@}"; } +a__git_merge_commit() { git \ merge \ --no-ff \ @@ -352,8 +352,8 @@ sa__git_merge_commit() { } # squash a branch and index its modifications -gms() { sa__git_merge_squash "${@}"; } -sa__git_merge_squash() { +gms() { a__git_merge_squash "${@}"; } +a__git_merge_squash() { git \ merge \ --squash \ @@ -361,16 +361,16 @@ sa__git_merge_squash() { } # merge via external tool -gmt() { sa__git_merge_tool "${@}"; } -sa__git_merge_tool() { +gmt() { a__git_merge_tool "${@}"; } +a__git_merge_tool() { git \ mergetool \ "${@}" } # push to the remote repository -gp() { sa__git_push "${@}"; } -sa__git_push() { +gp() { a__git_push "${@}"; } +a__git_push() { git \ push \ --tags \ @@ -379,8 +379,8 @@ sa__git_push() { } # delete from the remote repository -gpd() { sa__git_push_delete "${@}"; } -sa__git_push_delete() { +gpd() { a__git_push_delete "${@}"; } +a__git_push_delete() { git \ push \ --delete \ @@ -388,24 +388,24 @@ sa__git_push_delete() { } # force the push to the remote repository -gpf() { sa__git_push_force "${@}"; } -sa__git_push_force() { - sa__git_push \ +gpf() { a__git_push_force "${@}"; } +a__git_push_force() { + a__git_push \ --force \ "${@}" } # rebase current branch onto another -grb() { sa__git_re_base "${@}"; } -sa__git_re_base() { +grb() { a__git_re_base "${@}"; } +a__git_re_base() { git \ rebase \ "${@}" } # abort current rebase -grba() { sa__git_re_base_abort "${@}"; } -sa__git_re_base_abort() { +grba() { a__git_re_base_abort "${@}"; } +a__git_re_base_abort() { git \ rebase \ --abort \ @@ -413,8 +413,8 @@ sa__git_re_base_abort() { } # continue current rebase -grbc() { sa__git_re_base_continue "${@}"; } -sa__git_re_base_continue() { +grbc() { a__git_re_base_continue "${@}"; } +a__git_re_base_continue() { git \ rebase \ --continue \ @@ -422,8 +422,8 @@ sa__git_re_base_continue() { } # force rebase without fast-forward -grbf() { sa__git_re_base_force "${@}"; } -sa__git_re_base_force() { +grbf() { a__git_re_base_force "${@}"; } +a__git_re_base_force() { git \ rebase \ --force-rebase \ @@ -431,8 +431,8 @@ sa__git_re_base_force() { } # rebase interactively -grbi() { sa__git_re_base_interactive "${@}"; } -sa__git_re_base_interactive() { +grbi() { a__git_re_base_interactive "${@}"; } +a__git_re_base_interactive() { git \ rebase \ --interactive \ @@ -440,8 +440,8 @@ sa__git_re_base_interactive() { } # add a new remote repository -grma() { sa__git_re_mote_add "${@}"; } -sa__git_re_mote_add() { +grma() { a__git_re_mote_add "${@}"; } +a__git_re_mote_add() { git \ remote \ add \ @@ -449,8 +449,8 @@ sa__git_re_mote_add() { } # list remote repositories -grml() { sa__git_re_mote_list "${@}"; } -sa__git_re_mote_list() { +grml() { a__git_re_mote_list "${@}"; } +a__git_re_mote_list() { git \ remote \ --verbose \ @@ -458,8 +458,8 @@ sa__git_re_mote_list() { } # set the location of a remote repository -grmsu() { sa__git_re_mote_set_upstream "${@}"; } -sa__git_re_mote_set_upstream() { +grmsu() { a__git_re_mote_set_upstream "${@}"; } +a__git_re_mote_set_upstream() { git \ remote \ set-url \ @@ -467,8 +467,8 @@ sa__git_re_mote_set_upstream() { } # show connection to a remote repository -grms() { sa__git_re_mote_show "${@}"; } -sa__git_re_mote_show() { +grms() { a__git_re_mote_show "${@}"; } +a__git_re_mote_show() { git \ remote \ show \ @@ -476,24 +476,24 @@ sa__git_re_mote_show() { } # remove and add removal to index -grm() { sa__git_re_move "${@}"; } -sa__git_re_move() { +grm() { a__git_re_move "${@}"; } +a__git_re_move() { git \ rm \ "${@}" } # remove file(s) from index or move current branch pointer -grs() { sa__git_re_set "${@}"; } -sa__git_re_set() { +grs() { a__git_re_set "${@}"; } +a__git_re_set() { git \ reset \ "${@}" } # wipe modifications or reset current branch to another commit -grsh() { sa__git_re_set_hard "${@}"; } -sa__git_re_set_hard() { +grsh() { a__git_re_set_hard "${@}"; } +a__git_re_set_hard() { git \ reset \ --hard \ @@ -501,16 +501,16 @@ sa__git_re_set_hard() { } # show a commit -gsc() { sa__git_show_commit "${@}"; } -sa__git_show_commit() { +gsc() { a__git_show_commit "${@}"; } +a__git_show_commit() { git \ show \ "${@}" } # current state of repository -gs() { sa__git_status "${@}"; } -sa__git_status() { +gs() { a__git_status "${@}"; } +a__git_status() { git \ status \ --untracked-files="all" \ @@ -518,16 +518,16 @@ sa__git_status() { } # tag a commit -gt() { sa__git_tag "${@}"; } -sa__git_tag() { +gt() { a__git_tag "${@}"; } +a__git_tag() { git \ tag \ "${@}" } # delete a tag -gtd() { sa__git_tag_delete "${@}"; } -sa__git_tag_delete() { +gtd() { a__git_tag_delete "${@}"; } +a__git_tag_delete() { git \ tag \ --delete \ diff --git a/sh/alias/gpg.sh b/sh/alias/gpg.sh index 30ece71..496b05e 100644 --- a/sh/alias/gpg.sh +++ b/sh/alias/gpg.sh @@ -1,13 +1,13 @@ # turn gpg agent off -gak() { sa__gpg_agent_kill "${@}"; } -sa__gpg_agent_kill() { +gak() { a__gpg_agent_kill "${@}"; } +a__gpg_agent_kill() { gpgconf \ --kill "gpg-agent" } # bind gpg agent to current tty -gau() { sa__gpg_agent_update "${@}"; } -sa__gpg_agent_update() { +gau() { a__gpg_agent_update "${@}"; } +a__gpg_agent_update() { gpg-connect-agent \ updatestartuptty \ /bye diff --git a/sh/alias/grep.sh b/sh/alias/grep.sh index d479936..5b00ed7 100644 --- a/sh/alias/grep.sh +++ b/sh/alias/grep.sh @@ -1,6 +1,6 @@ # grep from current directory with regex -g() { sa__grep "${@}"; } -sa__grep() { +g() { a__grep "${@}"; } +a__grep() { grep \ --directories "recurse" \ --line-number \ diff --git a/sh/alias/kill.sh b/sh/alias/kill.sh index 1900a2d..718a307 100644 --- a/sh/alias/kill.sh +++ b/sh/alias/kill.sh @@ -1,13 +1,13 @@ # kill a process by id -k() { sa__kill "${@}"; } -sa__kill() { +k() { a__kill "${@}"; } +a__kill() { kill \ "${@}" } # force kill a process by id -kf() { sa__kill_force "${@}"; } -sa__kill_force() { +kf() { a__kill_force "${@}"; } +a__kill_force() { kill \ -9 \ "${@}" diff --git a/sh/alias/killall.sh b/sh/alias/killall.sh index b12e515..6658065 100644 --- a/sh/alias/killall.sh +++ b/sh/alias/killall.sh @@ -1,13 +1,13 @@ # kill all instances of a process by name -ka() { sa__kill_all "${@}"; } -sa__kill_all() { +ka() { a__kill_all "${@}"; } +a__kill_all() { killall \ "${@}" } # force kill all instances of a process by name -kaf() { sa__kill_all_force "${@}"; } -sa__kill_all_force() { +kaf() { a__kill_all_force "${@}"; } +a__kill_all_force() { killall \ -9 \ "${@}" diff --git a/sh/alias/ls.sh b/sh/alias/ls.sh index 5c90ee5..ad5a809 100644 --- a/sh/alias/ls.sh +++ b/sh/alias/ls.sh @@ -3,8 +3,8 @@ di=0;94\ " # list current directory’s entries -l() { sa__ls "${@}"; } -sa__ls() { +l() { a__ls "${@}"; } +a__ls() { ls \ --all \ --color \ @@ -15,17 +15,17 @@ sa__ls() { } # list timestamps -lt() { sa__ls_time "${@}"; } -sa__ls_time() { - sa__ls \ +lt() { a__ls_time "${@}"; } +a__ls_time() { + a__ls \ --time-style "+%Y%m%d-%H%M%S%-:::z" \ "${@}" } # list timestamps recent last -ltr() { sa__ls_time_reverse "${@}"; } -sa__ls_time_reverse() { - sa__ls_time \ +ltr() { a__ls_time_reverse "${@}"; } +a__ls_time_reverse() { + a__ls_time \ --reverse \ -t \ "${@}" diff --git a/sh/alias/lsblk.sh b/sh/alias/lsblk.sh index 359f5ae..43dffc6 100644 --- a/sh/alias/lsblk.sh +++ b/sh/alias/lsblk.sh @@ -1,7 +1,7 @@ # list block devices -lb() { sa__list_block "${@}"; } -sa__list_block() { - sa__list_block_output \ +lb() { a__list_block "${@}"; } +a__list_block() { + a__list_block_output \ "SIZE" \ "TYPE" \ "FSTYPE" \ @@ -11,21 +11,21 @@ sa__list_block() { } # base arguments -lbne() { sa__list_block_no_empty "${@}"; } -sa__list_block_no_empty() { +lbne() { a__list_block_no_empty "${@}"; } +a__list_block_no_empty() { lsblk \ --noempty \ "${@}" } # output arguments -lbo() { sa__list_block_output "${@}"; } -sa__list_block_output() { +lbo() { a__list_block_output "${@}"; } +a__list_block_output() { local argument local arguments="NAME" for argument in "${@}"; do arguments="${arguments},${argument}" done - sa__list_block_no_empty \ + a__list_block_no_empty \ --output "${arguments}" } diff --git a/sh/alias/mkdir.sh b/sh/alias/mkdir.sh index b8821a5..bebc665 100644 --- a/sh/alias/mkdir.sh +++ b/sh/alias/mkdir.sh @@ -1,13 +1,13 @@ # make a directory -md() { sa__make_directory "${@}"; } -sa__make_directory() { +md() { a__make_directory "${@}"; } +a__make_directory() { mkdir \ "${@}" } # make a directory after making its parents -mdp() { sa__make_directory_parents "${@}"; } -sa__make_directory_parents() { +mdp() { a__make_directory_parents "${@}"; } +a__make_directory_parents() { mkdir \ --parents \ "${@}" diff --git a/sh/alias/mount.sh b/sh/alias/mount.sh index b5329a9..535910e 100644 --- a/sh/alias/mount.sh +++ b/sh/alias/mount.sh @@ -1,5 +1,5 @@ -m() { sa__mount "${@}"; } -sa__mount() { +m() { a__mount "${@}"; } +a__mount() { mount \ "${@}" } diff --git a/sh/alias/mv.sh b/sh/alias/mv.sh index 8f8bffd..0630042 100644 --- a/sh/alias/mv.sh +++ b/sh/alias/mv.sh @@ -1,6 +1,6 @@ # move interactively -mvi() { sa__mo_ve_interactive "${@}"; } -sa__mo_ve_interactive() { +mvi() { a__mo_ve_interactive "${@}"; } +a__mo_ve_interactive() { mv \ --interactive \ "${@}" diff --git a/sh/alias/nano.sh b/sh/alias/nano.sh index b7cad2c..7570cda 100644 --- a/sh/alias/nano.sh +++ b/sh/alias/nano.sh @@ -1,5 +1,5 @@ -nn() { sa__na_no "${@}"; } -sa__na_no() { +nn() { a__na_no "${@}"; } +a__na_no() { nano \ "${@}" } diff --git a/sh/alias/newsboat.sh b/sh/alias/newsboat.sh index e061d63..6c08c90 100644 --- a/sh/alias/newsboat.sh +++ b/sh/alias/newsboat.sh @@ -1,5 +1,5 @@ -nb() { sa__news_boat "${@}"; } -sa__news_boat() { +nb() { a__news_boat "${@}"; } +a__news_boat() { newsboat \ "${@}" } diff --git a/sh/alias/pass.sh b/sh/alias/pass.sh index 6e3a4da..66cad55 100644 --- a/sh/alias/pass.sh +++ b/sh/alias/pass.sh @@ -1,13 +1,13 @@ # display pass entry’s content -p() { sa__pass "${@}"; } -sa__pass() { +p() { a__pass "${@}"; } +a__pass() { pass \ "${@}" } # copy passphrase into clipboard -pc() { sa__pass_clip "${@}"; } -sa__pass_clip() { +pc() { a__pass_clip "${@}"; } +a__pass_clip() { pass \ --clip \ "${@}" diff --git a/sh/alias/pgrep.sh b/sh/alias/pgrep.sh index 9350d6e..72de025 100644 --- a/sh/alias/pgrep.sh +++ b/sh/alias/pgrep.sh @@ -1,6 +1,6 @@ # look for a string in processes names -pg() { sa__proc_grep "${@}"; } -sa__proc_grep() { +pg() { a__proc_grep "${@}"; } +a__proc_grep() { pgrep \ --list-full \ "${@}" diff --git a/sh/alias/pwgen.sh b/sh/alias/pwgen.sh index a2cfcc7..3b3dc83 100644 --- a/sh/alias/pwgen.sh +++ b/sh/alias/pwgen.sh @@ -1,6 +1,6 @@ # generate passwords -pwg() { sa__pass_word_gen "${@}"; } -sa__pass_word_gen() { +pwg() { a__pass_word_gen "${@}"; } +a__pass_word_gen() { pwgen \ -1 \ --num-passwords 1048576 \ @@ -9,9 +9,9 @@ sa__pass_word_gen() { } # generate passwords with symbols -pwgs() { sa__pass_word_gen_symbols "${@}"; } -sa__pass_word_gen_symbols() { - sa__pass_word_gen \ +pwgs() { a__pass_word_gen_symbols "${@}"; } +a__pass_word_gen_symbols() { + a__pass_word_gen \ --symbols \ "${@}" } diff --git a/sh/alias/rm.sh b/sh/alias/rm.sh index ca6bd11..9634c1b 100644 --- a/sh/alias/rm.sh +++ b/sh/alias/rm.sh @@ -1,6 +1,6 @@ # remove interactively -rmi() { sa__re_move_interactive "${@}"; } -sa__re_move_interactive() { +rmi() { a__re_move_interactive "${@}"; } +a__re_move_interactive() { rm \ --interactive \ "${@}" diff --git a/sh/alias/rsync.sh b/sh/alias/rsync.sh index 773d317..bdbe4ed 100644 --- a/sh/alias/rsync.sh +++ b/sh/alias/rsync.sh @@ -1,6 +1,6 @@ # synchronize -rs() { sa__r_sync "${@}"; } -sa__r_sync() { +rs() { a__r_sync "${@}"; } +a__r_sync() { rsync \ --archive \ --no-inc-recursive \ @@ -11,17 +11,17 @@ sa__r_sync() { } # synchronize and delete after -rsda() { sa__r_sync_delete_after "${@}"; } -sa__r_sync_delete_after() { - sa__r_sync \ +rsda() { a__r_sync_delete_after "${@}"; } +a__r_sync_delete_after() { + a__r_sync \ --delete-after \ "${@}" } # synchronize and delete before -rsdb() { sa__r_sync_delete_before "${@}"; } -sa__r_sync_delete_before() { - sa__r_sync \ +rsdb() { a__r_sync_delete_before "${@}"; } +a__r_sync_delete_before() { + a__r_sync \ --delete-before \ "${@}" } diff --git a/sh/alias/tar.sh b/sh/alias/tar.sh index 6cebb0d..92b8fbf 100644 --- a/sh/alias/tar.sh +++ b/sh/alias/tar.sh @@ -1,30 +1,30 @@ -tc() { sa__tar_create "${@}"; } -sa__tar_create() { - sa__tar_verbose \ +tc() { a__tar_create "${@}"; } +a__tar_create() { + a__tar_verbose \ --create \ --auto-compress \ --file \ "${@}" } -tl() { sa__tar_list "${@}"; } -sa__tar_list() { - sa__tar_verbose \ +tl() { a__tar_list "${@}"; } +a__tar_list() { + a__tar_verbose \ --list \ --file \ "${@}" } -tv() { sa__tar_verbose "${@}"; } -sa__tar_verbose() { +tv() { a__tar_verbose "${@}"; } +a__tar_verbose() { tar \ --verbose \ "${@}" } -tx() { sa__tar_xtract "${@}"; } -sa__tar_xtract() { - sa__tar_verbose \ +tx() { a__tar_xtract "${@}"; } +a__tar_xtract() { + a__tar_verbose \ --extract \ --file \ "${@}" diff --git a/sh/alias/tmux.sh b/sh/alias/tmux.sh index 57d6053..b30dc79 100644 --- a/sh/alias/tmux.sh +++ b/sh/alias/tmux.sh @@ -1,5 +1,5 @@ -tm() { sa__t_mux "${@}"; } -sa__t_mux() { +tm() { a__t_mux "${@}"; } +a__t_mux() { tmux \ "${@}" } diff --git a/sh/alias/tree.sh b/sh/alias/tree.sh index d172896..03be3de 100644 --- a/sh/alias/tree.sh +++ b/sh/alias/tree.sh @@ -1,11 +1,11 @@ -t() { sa__tree "${@}"; } -sa__tree() { +t() { a__tree "${@}"; } +a__tree() { tree \ "${@}" } -ta() { sa__tree_all "${@}"; } -sa__tree_all() { +ta() { a__tree_all "${@}"; } +a__tree_all() { tree \ -a \ "${@}" From 07483cdadf37bb7c7822fbc21928538168b50490 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:15:12 +0100 Subject: [PATCH 598/702] sh_shell --- sh/sh.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sh/sh.sh b/sh/sh.sh index 6fab8a6..a1dc2d1 100644 --- a/sh/sh.sh +++ b/sh/sh.sh @@ -1,11 +1,12 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " -SH="$(cat /proc/$$/comm)" + +SH_SHELL="$(cat /proc/$$/comm)" shell_color() { local code="${1}" - case "${SH}" in + case "${SH_SHELL}" in "bash") printf "\x01\e[0" if [ -n "${code}" ]; then @@ -32,7 +33,7 @@ SH_MAGENTA="$(shell_color 35)" SH_RED="$(shell_color 32)" shell_configure() { - case "${SH}" in + case "${SH_SHELL}" in "bash") # completion local root="/usr/share/bash-completion" @@ -140,7 +141,7 @@ x() { "${@}" } -[ "${SH}" = "bash" ] || return +[ "${SH_SHELL}" = "bash" ] || return # shellcheck disable=SC3033 ..() { From 9da45266c4e82c137af9c735c2f8d954f8f6de0a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:22:07 +0100 Subject: [PATCH 599/702] sh_shell --- sh/alias/shell.sh | 30 ++++++++++++++++++++++++++++++ sh/main.sh | 2 ++ sh/sh.sh | 32 -------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 sh/alias/shell.sh diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh new file mode 100644 index 0000000..8f6684c --- /dev/null +++ b/sh/alias/shell.sh @@ -0,0 +1,30 @@ +# shorten alias +a() { + alias \ + "${@}" +} + +# swap directory (current ↔ previous) +sd() { + cd \ + - || + return +} + +# exit terminal +x() { + exit \ + "${@}" +} + +# shellcheck disable=SC2154 +[ "${SH_SHELL}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} diff --git a/sh/main.sh b/sh/main.sh index 387b1b3..6369d05 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,4 +1,6 @@ SH_NAME="sh" +SH_SHELL="$(cat /proc/$$/comm)" +export SH_SHELL SH_ROOT="/etc/${SH_NAME}" SH_USER="${HOME}/${SH_NAME}" diff --git a/sh/sh.sh b/sh/sh.sh index a1dc2d1..39dee54 100644 --- a/sh/sh.sh +++ b/sh/sh.sh @@ -2,8 +2,6 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " -SH_SHELL="$(cat /proc/$$/comm)" - shell_color() { local code="${1}" case "${SH_SHELL}" in @@ -121,33 +119,3 @@ shell_setup() { rm --force --recursive "${file}" ln --symbolic "${ENV}" "${file}" } - -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} - -[ "${SH_SHELL}" = "bash" ] || return - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -} From f2544c4243a8f42486f06d23496d7f4d15591152 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:22:29 +0100 Subject: [PATCH 600/702] shell --- sh/{sh.sh => shell.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{sh.sh => shell.sh} (100%) diff --git a/sh/sh.sh b/sh/shell.sh similarity index 100% rename from sh/sh.sh rename to sh/shell.sh From aa1226f8f4bf0eb64b5ded1c2ec2f2231b5fafbe Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:38:20 +0100 Subject: [PATCH 601/702] _sh_shell_color --- sh/shell.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index 39dee54..4a2c6ea 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -2,7 +2,7 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " -shell_color() { +_sh_shell_color() { local code="${1}" case "${SH_SHELL}" in "bash") @@ -23,12 +23,12 @@ shell_color() { ;; esac } -SH_BROWN="$(shell_color 33)" -SH_CYAN="$(shell_color 36)" -SH_DEFAULT="$(shell_color)" -SH_GREEN="$(shell_color 31)" -SH_MAGENTA="$(shell_color 35)" -SH_RED="$(shell_color 32)" +SH_BROWN="$(_sh_shell_color 33)" +SH_CYAN="$(_sh_shell_color 36)" +SH_DEFAULT="$(_sh_shell_color)" +SH_GREEN="$(_sh_shell_color 31)" +SH_MAGENTA="$(_sh_shell_color 35)" +SH_RED="$(_sh_shell_color 32)" shell_configure() { case "${SH_SHELL}" in From 321d55a8230d1700b3c3e438414b9d9d301786bb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:40:11 +0100 Subject: [PATCH 602/702] sh_shell_prompt --- sh/shell.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index 4a2c6ea..4fcc895 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -1,4 +1,4 @@ -PS1="\$(shell_prompt \${?})" +PS1="\$(sh_shell_prompt \${?})" PS2="\ ├ " @@ -58,7 +58,7 @@ shell_configure() { } shell_configure -shell_prompt() { +sh_shell_prompt() { local date host id local code="${1}" date="$(date +%H:%M:%S)" From aaa530295ee10522de2c00c84ff2ef8a54baebae Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:18:40 +0100 Subject: [PATCH 603/702] mv --- sh/{cmd => }/gnome.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{cmd => }/gnome.sh (100%) diff --git a/sh/cmd/gnome.sh b/sh/gnome.sh similarity index 100% rename from sh/cmd/gnome.sh rename to sh/gnome.sh From 04f64f68a87f18c6ddadbc9cb4c364faf7a5ee86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:27:41 +0100 Subject: [PATCH 604/702] debian --- sh/debian.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index 39639b9..b544f08 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -1,4 +1,4 @@ -DEBIAN_CODENAME="$( +SH_DEBIAN_CODENAME="$( grep "VERSION_CODENAME" "/etc/os-release" | cut --delimiter "=" --fields "2" )" @@ -23,11 +23,11 @@ Dpkg::Progress True; } sh_apt_install_backports() { - sh_apt_install_target "${DEBIAN_CODENAME}-backports" "${@}" + sh_apt_install_target "${SH_DEBIAN_CODENAME}-backports" "${@}" } sh_apt_install_release() { - sh_apt_install_target "${DEBIAN_CODENAME}" "${@}" + sh_apt_install_target "${SH_DEBIAN_CODENAME}" "${@}" } sh_apt_install_target() { @@ -49,13 +49,13 @@ sh_apt_install_target() { sh_apt_sources_write() { printf "%s" "\ deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME} main non-free-firmware contrib non-free +${SH_DEBIAN_CODENAME} main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free +${SH_DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free +${SH_DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free deb https://deb.debian.org/debian-security \ -${DEBIAN_CODENAME}-security main non-free-firmware contrib non-free +${SH_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" } From c641c95c0d61b6b3fae587609e030dff60534342 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:31:53 +0100 Subject: [PATCH 605/702] luks_format --- sh/fs.sh | 2 +- sh/rescue/hetzner.sh | 4 ++-- sh/rescue/ovh.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index 2635ce0..67bd2a5 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -93,7 +93,7 @@ fs_wipe() { fi } -luks_format() { +sh_fs_luks_format() { local passphrase="${1}" local device="${2}" local label="${3}" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 80d901b..5f27eaa 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -92,7 +92,7 @@ rescue_wipe_0_init_hetzner_8_8() { fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt - luks_format "${passphrase}" "/dev/md/crypt" + sh_fs_luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" @@ -107,7 +107,7 @@ rescue_wipe_2_make_hetzner_8_8() { # read passphrase passphrase="$(read_passphrase)" # encrypt - luks_format "${passphrase}" "/dev/md/crypt" + sh_fs_luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index b12c50b..333e365 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -36,7 +36,7 @@ rescue_wipe_0_init_ovh_vle2() { # crypt / wipe fs_wipe "${device}1" "1G" 1 # crypt / encrypt - luks_format "${passphrase}" "${device}1" + sh_fs_luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" @@ -52,7 +52,7 @@ rescue_wipe_2_make_ovh_vle2() { # read passphrase passphrase="$(read_passphrase)" # crypt / encrypt - luks_format "${passphrase}" "${device}1" + sh_fs_luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" From ce6ca845bc6d3e2b9878f0aecc0b63a0a066e76a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:34:45 +0100 Subject: [PATCH 606/702] fs_wipe --- sh/fs.sh | 2 +- sh/rescue/common.sh | 2 +- sh/rescue/hetzner.sh | 8 ++++---- sh/rescue/ovh.sh | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index 67bd2a5..46fe414 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -72,7 +72,7 @@ fs_raid_create() { fi } -fs_wipe() { +sh_fs_wipe() { local device="${1}" local buffer="${2}" local count="${3}" diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index b108681..d28591b 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -84,7 +84,7 @@ rescue_upload() { } rescue_wipe_1_zero() { - fs_wipe "/dev/mapper/crypt" "512M" + sh_fs_wipe "/dev/mapper/crypt" "512M" } rescue_wipe_3_close() { diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 5f27eaa..3e95ba3 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -34,7 +34,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}4" # wipe bios - fs_wipe "${device}4" + sh_fs_wipe "${device}4" done # number=0 @@ -43,7 +43,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}3" # format esp - fs_wipe "${device}3" "1M" + sh_fs_wipe "${device}3" "1M" fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" @@ -56,7 +56,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}2" # wipe boot - fs_wipe "${device}2" "1G" 1 + sh_fs_wipe "${device}2" "1G" 1 done # members="" @@ -81,7 +81,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}1" # wipe crypt head - fs_wipe "${device}1" "1G" 1 + sh_fs_wipe "${device}1" "1G" 1 done # members="" diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 333e365..732b045 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -16,16 +16,16 @@ rescue_wipe_0_init_ovh_vle2() { mkpart bios 1 2 \ set 4 bios_grub on # bios / wipe - fs_wipe "${device}4" + sh_fs_wipe "${device}4" # esp / wipe - fs_wipe "${device}3" "1M" + sh_fs_wipe "${device}3" "1M" # esp / format fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp" # boot / wipe - fs_wipe "${device}2" "1G" 1 + sh_fs_wipe "${device}2" "1G" 1 # boot / format fs_make_btrfs "${device}2" "boot" \ "00000000-0000-0000-0000-00000000000b" @@ -34,7 +34,7 @@ rescue_wipe_0_init_ovh_vle2() { mount --options "autodefrag,compress-force=zstd" \ "${device}2" "/media/boot" # crypt / wipe - fs_wipe "${device}1" "1G" 1 + sh_fs_wipe "${device}1" "1G" 1 # crypt / encrypt sh_fs_luks_format "${passphrase}" "${device}1" # crypt / open From 1dfebbc35a8f4f5c6558837ecc931519960843ec Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:35:47 +0100 Subject: [PATCH 607/702] raid_create --- sh/fs.sh | 2 +- sh/rescue/hetzner.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index 46fe414..fb3db50 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -56,7 +56,7 @@ fs_make_fat() { fi } -fs_raid_create() { +sh_fs_raid_create() { if [ -n "${4}" ]; then local name="${1}" local uuid="${2}" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 3e95ba3..f5283f2 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -64,7 +64,7 @@ rescue_wipe_0_init_hetzner_8_8() { members="${members} ${device}2" done # shellcheck disable=SC2086 - fs_raid_create \ + sh_fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # fs_make_btrfs "/dev/md/boot" "boot" \ @@ -89,7 +89,7 @@ rescue_wipe_0_init_hetzner_8_8() { members="${members} ${device}1" done # shellcheck disable=SC2086 - fs_raid_create \ + sh_fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt sh_fs_luks_format "${passphrase}" "/dev/md/crypt" From beb4695b29d92c8d0b5dff55375d3c7b955609d6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:37:07 +0100 Subject: [PATCH 608/702] make_fat --- sh/fs.sh | 2 +- sh/rescue/hetzner.sh | 2 +- sh/rescue/ovh.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index fb3db50..6cc85ff 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -36,7 +36,7 @@ fs_make_btrfs_swap() { fi } -fs_make_fat() { +sh_fs_make_fat() { local device="${1}" local name="${2}" local volid="${3}" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index f5283f2..9de0134 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -44,7 +44,7 @@ rescue_wipe_0_init_hetzner_8_8() { echo "#${number}: ${device}3" # format esp sh_fs_wipe "${device}3" "1M" - fs_make_fat "${device}3" "esp-${number}" "0000000${number}" + sh_fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" mount "${device}3" "/media/esp/${number}" diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 732b045..117ac5e 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -20,7 +20,7 @@ rescue_wipe_0_init_ovh_vle2() { # esp / wipe sh_fs_wipe "${device}3" "1M" # esp / format - fs_make_fat "${device}3" "esp" "00000001" + sh_fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp" From 844b2f21d3c598d10b10c4261efc8c7135c7f0d0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:38:22 +0100 Subject: [PATCH 609/702] btrfs_swap --- sh/fs.sh | 2 +- sh/rescue/hetzner.sh | 2 +- sh/rescue/ovh.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index 6cc85ff..fa0657f 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -18,7 +18,7 @@ fs_make_btrfs() { fi } -fs_make_btrfs_swap() { +sh_fs_make_btrfs_swap() { local path="${1}" local size="${2}" local uuid="${3}" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 9de0134..b541b26 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -122,6 +122,6 @@ rescue_wipe_2_make_hetzner_8_8() { --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # make swap file - fs_make_btrfs_swap "/media/crypt/swap" "64g" \ + sh_fs_make_btrfs_swap "/media/crypt/swap" "64g" \ "00000000-0000-0000-0000-000000000005" } diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 117ac5e..3127564 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -66,6 +66,6 @@ rescue_wipe_2_make_ovh_vle2() { mount --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # crypt / swap - fs_make_btrfs_swap "/media/crypt/swap" "4g" \ + sh_fs_make_btrfs_swap "/media/crypt/swap" "4g" \ "00000000-0000-0000-0000-000000000005" } From dc0540c4ca57cb2e8f742b7fac95f0aee23ee93a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:40:58 +0100 Subject: [PATCH 610/702] make_btrfs --- sh/fs.sh | 2 +- sh/rescue/hetzner.sh | 4 ++-- sh/rescue/ovh.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index fa0657f..95965e2 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -1,4 +1,4 @@ -fs_make_btrfs() { +sh_fs_make_btrfs() { local device="${1}" local label="${2}" local uuid="${3}" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index b541b26..36dc2ea 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -67,7 +67,7 @@ rescue_wipe_0_init_hetzner_8_8() { sh_fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # - fs_make_btrfs "/dev/md/boot" "boot" \ + sh_fs_make_btrfs "/dev/md/boot" "boot" \ "00000000-0000-0000-0000-00000000000b" # mount boot mkdir --parents "/media/boot" @@ -114,7 +114,7 @@ rescue_wipe_2_make_hetzner_8_8() { # passphrase unset passphrase # format crypt - fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ "00000000-0000-0000-0000-00000000000c" # mount crypt mkdir --parents "/media/crypt" diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 3127564..4a54f64 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -27,7 +27,7 @@ rescue_wipe_0_init_ovh_vle2() { # boot / wipe sh_fs_wipe "${device}2" "1G" 1 # boot / format - fs_make_btrfs "${device}2" "boot" \ + sh_fs_make_btrfs "${device}2" "boot" \ "00000000-0000-0000-0000-00000000000b" # boot / mount mkdir --parents "/media/boot" @@ -59,7 +59,7 @@ rescue_wipe_2_make_ovh_vle2() { # passphrase unset passphrase # crypt / format - fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ "00000000-0000-0000-0000-00000000000c" # crypt / mount mkdir --parents "/media/crypt" From 96f0697e37a7c8f8fd84670f041ccc0470815bc1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 09:42:44 +0100 Subject: [PATCH 611/702] {} --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 6369d05..fa0c556 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,5 +1,5 @@ SH_NAME="sh" -SH_SHELL="$(cat /proc/$$/comm)" +SH_SHELL="$(cat /proc/${$}/comm)" export SH_SHELL SH_ROOT="/etc/${SH_NAME}" From 4cf578356242a5967d28e72907c4690aaf099a17 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 10:05:56 +0100 Subject: [PATCH 612/702] warn_wipe --- sh/rescue/hetzner.sh | 2 +- sh/rescue/ovh.sh | 2 +- sh/util.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 36dc2ea..9de13db 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -9,7 +9,7 @@ rescue_wipe_0_init_hetzner_8_8() { # read passphrase passphrase="$(read_passphrase)" # warn - warn_wipe "${@}" + sh_warn_wipe "${@}" # number=0 for device in "${@}"; do diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 4a54f64..e7e2ea8 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -4,7 +4,7 @@ rescue_wipe_0_init_ovh_vle2() { # read passphrase passphrase="$(read_passphrase)" # warn - warn_wipe "${device}" + sh_warn_wipe "${device}" # parted --script "${device}" \ mktable gpt \ diff --git a/sh/util.sh b/sh/util.sh index 2f2b400..05eb5d2 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -28,7 +28,7 @@ read_secret() { unset secret } -warn_wipe() { +sh_warn_wipe() { local tmp list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" From c2a3a130d191f997c9d9c8fab5b4f0e86aa27d3a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 10:06:58 +0100 Subject: [PATCH 613/702] read_secret --- sh/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/util.sh b/sh/util.sh index 05eb5d2..5fb3178 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -13,10 +13,10 @@ not() { } read_passphrase() { - read_secret "PassPhrase: " + sh_read_secret "PassPhrase: " } -read_secret() { +sh_read_secret() { local prompt="${1}" local secret printf "%s" "${prompt}" 1>&2 From 6b45b885c70282af47340d83ecc54b209c59699b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 10:08:23 +0100 Subject: [PATCH 614/702] not --- sh/gnome.sh | 2 +- sh/util.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/gnome.sh b/sh/gnome.sh index c773ff8..ff15c10 100644 --- a/sh/gnome.sh +++ b/sh/gnome.sh @@ -16,7 +16,7 @@ sh_gnome_workspaces_primary() { bool="$(gsettings get "${group}" "${name}")" sh_log_debug "${var}: ${bool}" # not - bool="$(not "${bool}")" + bool="$(sh_not "${bool}")" sh_log_debug "bool: ${bool}" # set gsettings set "${group}" "${name}" "${bool}" diff --git a/sh/util.sh b/sh/util.sh index 5fb3178..e5f9c82 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -4,7 +4,7 @@ list_block_devices() { --output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS" } -not() { +sh_not() { case "${1}" in "false") echo "true" ;; "true") echo "false" ;; From 510ca5a5b35fe184a8e5ce3d26eabb303dd6607d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 10:09:40 +0100 Subject: [PATCH 615/702] read_passphrase --- sh/rescue/hetzner.sh | 4 ++-- sh/rescue/ovh.sh | 4 ++-- sh/util.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 9de13db..8d7f02b 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -7,7 +7,7 @@ rescue_wipe_0_init_hetzner_8_8() { local number local passphrase # read passphrase - passphrase="$(read_passphrase)" + passphrase="$(sh_read_passphrase)" # warn sh_warn_wipe "${@}" # @@ -105,7 +105,7 @@ rescue_wipe_2_make_hetzner_8_8() { # close cryptsetup luksClose "crypt" # read passphrase - passphrase="$(read_passphrase)" + passphrase="$(sh_read_passphrase)" # encrypt sh_fs_luks_format "${passphrase}" "/dev/md/crypt" # open diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index e7e2ea8..0d3c860 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -2,7 +2,7 @@ rescue_wipe_0_init_ovh_vle2() { local device="/dev/sdb" local passphrase # read passphrase - passphrase="$(read_passphrase)" + passphrase="$(sh_read_passphrase)" # warn sh_warn_wipe "${device}" # @@ -50,7 +50,7 @@ rescue_wipe_2_make_ovh_vle2() { # crypt / close cryptsetup luksClose "crypt" # read passphrase - passphrase="$(read_passphrase)" + passphrase="$(sh_read_passphrase)" # crypt / encrypt sh_fs_luks_format "${passphrase}" "${device}1" # crypt / open diff --git a/sh/util.sh b/sh/util.sh index e5f9c82..0454ba8 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -12,7 +12,7 @@ sh_not() { esac } -read_passphrase() { +sh_read_passphrase() { sh_read_secret "PassPhrase: " } From 86db452e72c25e0ad76d0ae1ad61378eeb9e9fc7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 10:11:02 +0100 Subject: [PATCH 616/702] list_block_devices --- sh/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/util.sh b/sh/util.sh index 0454ba8..3f1c614 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -1,4 +1,4 @@ -list_block_devices() { +sh_list_block_devices() { lsblk \ --noempty \ --output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS" @@ -30,7 +30,7 @@ sh_read_secret() { sh_warn_wipe() { local tmp - list_block_devices + sh_list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r tmp sh_log_trace "${tmp}" From 942de1caed7e0c889fb70a8d9a82645ac14455ca Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 14:29:42 +0100 Subject: [PATCH 617/702] colors --- sh/shell.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index 4fcc895..d56ca56 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -23,12 +23,12 @@ _sh_shell_color() { ;; esac } -SH_BROWN="$(_sh_shell_color 33)" -SH_CYAN="$(_sh_shell_color 36)" -SH_DEFAULT="$(_sh_shell_color)" -SH_GREEN="$(_sh_shell_color 31)" -SH_MAGENTA="$(_sh_shell_color 35)" -SH_RED="$(_sh_shell_color 32)" +SH_COLOR_BROWN="$(_sh_shell_color 33)" +SH_COLOR_CYAN="$(_sh_shell_color 36)" +SH_COLOR_DEFAULT="$(_sh_shell_color)" +SH_COLOR_GREEN="$(_sh_shell_color 31)" +SH_COLOR_MAGENTA="$(_sh_shell_color 35)" +SH_COLOR_RED="$(_sh_shell_color 32)" shell_configure() { case "${SH_SHELL}" in @@ -70,43 +70,43 @@ sh_shell_prompt() { local view="└ " # code if [ "${code}" -ne 0 ]; then - view="${view}${SH_GREEN}" + view="${view}${SH_COLOR_GREEN}" else - view="${view}${SH_RED}" + view="${view}${SH_COLOR_RED}" fi view="${view}${code}" # date - view="${view}${SH_DEFAULT} @ " - view="${view}${SH_BROWN}${date}" + view="${view}${SH_COLOR_DEFAULT} @ " + view="${view}${SH_COLOR_BROWN}${date}" # git if command -v "__git_ps1" >"/dev/null"; then git="$(__git_ps1)" if [ -n "${git}" ]; then - view="${view}${SH_DEFAULT} –${SH_MAGENTA}${git}" + view="${view}${SH_COLOR_DEFAULT} –${SH_COLOR_MAGENTA}${git}" fi fi # new view="${view}\\n" # path - view="${view}${SH_CYAN}${path}" + view="${view}${SH_COLOR_CYAN}${path}" # new view="${view}\\n" # frame - view="${view}${SH_DEFAULT}┌ " + view="${view}${SH_COLOR_DEFAULT}┌ " # user if [ "${id}" -eq 0 ]; then - view="${view}${SH_GREEN}" + view="${view}${SH_COLOR_GREEN}" else - view="${view}${SH_RED}" + view="${view}${SH_COLOR_RED}" fi view="${view}${user}" # host - view="${view}${SH_DEFAULT} @ " - view="${view}${SH_BROWN}${host}" + view="${view}${SH_COLOR_DEFAULT} @ " + view="${view}${SH_COLOR_BROWN}${host}" # new view="${view}\\n" # prompt - view="${view}${SH_DEFAULT}${PS2}" + view="${view}${SH_COLOR_DEFAULT}${PS2}" # print printf "%b" "${view}" } From cdc976db0b6bef2f355e26c6295d231f762a01a5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 14:36:41 +0100 Subject: [PATCH 618/702] shell_setup --- sh/shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/shell.sh b/sh/shell.sh index d56ca56..099c68d 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -111,7 +111,7 @@ sh_shell_prompt() { printf "%b" "${view}" } -shell_setup() { +sh_shell_setup() { # shell echo "export ENV=\"${ENV}\"" >"/etc/profile.d/sh.sh" # bash From 5ffc9fc84090e64ba01037a8340fc2d5f3d4c7d6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 14:39:01 +0100 Subject: [PATCH 619/702] shell_configure --- sh/shell.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index 099c68d..c4569d1 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -1,7 +1,3 @@ -PS1="\$(sh_shell_prompt \${?})" -PS2="\ -├ " - _sh_shell_color() { local code="${1}" case "${SH_SHELL}" in @@ -30,7 +26,7 @@ SH_COLOR_GREEN="$(_sh_shell_color 31)" SH_COLOR_MAGENTA="$(_sh_shell_color 35)" SH_COLOR_RED="$(_sh_shell_color 32)" -shell_configure() { +sh_shell_configure() { case "${SH_SHELL}" in "bash") # completion @@ -52,11 +48,14 @@ shell_configure() { HISTCONTROL="ignorespace" HISTSIZE=-1 HISTTIMEFORMAT="%Y%m%d %H%M%S " + # prompt + PS1="\$(sh_shell_prompt \${?})" + PS2="├ " ;; *) ;; esac } -shell_configure +sh_shell_configure sh_shell_prompt() { local date host id From e305827808e0ff5af3bed9c929ed1da79de96e0f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 14:47:30 +0100 Subject: [PATCH 620/702] mv --- sh/{mount.sh => alias/overlay.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sh/{mount.sh => alias/overlay.sh} (100%) diff --git a/sh/mount.sh b/sh/alias/overlay.sh similarity index 100% rename from sh/mount.sh rename to sh/alias/overlay.sh From d691f67581762842bc8a5ad5f62d5f4797e09d92 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 15:48:10 +0100 Subject: [PATCH 621/702] main/output --- sh/main.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index fa0c556..68bc516 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -28,12 +28,12 @@ main_source_directory() { IFS=" " count=0 - echo - echo ". ${path}" + #echo + #echo ". ${path}" for module in ${modules}; do count=$((count + 1)) - printf "%02d" "${count}" - echo " ${module%.sh}" + #printf "%02d" "${count}" + #echo " ${module%.sh}" module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then . "${module}" @@ -47,7 +47,7 @@ main_source_directory() { done IFS="${ifs}" else - echo "Not a directory: ${path}" + #echo "Not a directory: ${path}" return 1 fi } @@ -57,7 +57,7 @@ main_source_file() { if [ -f "${path}" ]; then main_source_directory "$(dirname "${path}")" else - echo "Not a file: ${path}" + #echo "Not a file: ${path}" return 1 fi } @@ -66,7 +66,7 @@ main_source_file "${ENV}" main_source_directory "${SH_USER}" -sh_log "" \ - "sh_… = shell functions" \ - "a__… = aliases" \ - "u__… = user" +#sh_log "" \ +# "sh_… = shell functions" \ +# "a__… = aliases" \ +# "u__… = user" From ee694a8fdee08beb2273389f19a16be1ff90336f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 16:47:41 +0100 Subject: [PATCH 622/702] main/log --- sh/main.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 68bc516..d2fafb8 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -15,6 +15,18 @@ _sh_main_commands() { cut --delimiter "(" --fields 1 } +_sh_main_log() { + case "${-}" in + *i*) + local argument + for argument in "${@}"; do + echo "${argument}" + done + ;; + *) ;; + esac +} + main_source_directory() { local path="${1}" if [ -d "${path}" ]; then @@ -28,12 +40,12 @@ main_source_directory() { IFS=" " count=0 - #echo - #echo ". ${path}" + _sh_main_log "" \ + ". ${path}" for module in ${modules}; do count=$((count + 1)) #printf "%02d" "${count}" - #echo " ${module%.sh}" + _sh_main_log "${module%.sh}" module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then . "${module}" @@ -47,7 +59,7 @@ main_source_directory() { done IFS="${ifs}" else - #echo "Not a directory: ${path}" + _sh_main_log "Not a directory: ${path}" return 1 fi } @@ -57,7 +69,7 @@ main_source_file() { if [ -f "${path}" ]; then main_source_directory "$(dirname "${path}")" else - #echo "Not a file: ${path}" + _sh_main_log "Not a file: ${path}" return 1 fi } @@ -66,7 +78,7 @@ main_source_file "${ENV}" main_source_directory "${SH_USER}" -#sh_log "" \ -# "sh_… = shell functions" \ -# "a__… = aliases" \ -# "u__… = user" +_sh_main_log "" \ + "sh_… = shell functions" \ + "a__… = aliases" \ + "u__… = user" From 0ed8b2486c84050d3a43024b3b3ca5a2751204e1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 21 Nov 2024 11:25:40 +0100 Subject: [PATCH 623/702] _sh_main --- sh/main.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index d2fafb8..9a86ebe 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -74,11 +74,13 @@ main_source_file() { fi } -main_source_file "${ENV}" +_sh_main() { + main_source_file "${ENV}" + main_source_directory "${SH_USER}" + _sh_main_log "" \ + "sh_… = shell functions" \ + "a__… = aliases" \ + "u__… = user" +} -main_source_directory "${SH_USER}" - -_sh_main_log "" \ - "sh_… = shell functions" \ - "a__… = aliases" \ - "u__… = user" +_sh_main From a52d3595f747c724825739513f9712bdc9dc18c2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 11:52:42 +0100 Subject: [PATCH 624/702] prompt --- sh/shell.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index c4569d1..bf39f7b 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -48,12 +48,12 @@ sh_shell_configure() { HISTCONTROL="ignorespace" HISTSIZE=-1 HISTTIMEFORMAT="%Y%m%d %H%M%S " - # prompt - PS1="\$(sh_shell_prompt \${?})" - PS2="├ " ;; *) ;; esac + # prompt + PS1="\$(sh_shell_prompt \${?})" + PS2="├ " } sh_shell_configure From 6b8da7e16b067d5208f0b571c6288cb71a77c6c4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 12:49:17 +0100 Subject: [PATCH 625/702] ovl --- sh/alias/overlay.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index b2bd77f..82fe273 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -1,4 +1,5 @@ -mo() { +orm() { a__overlay_root_mount "${@}"; } +a__overlay_root_mount() { local root="${1}" if [ -z "${root}" ]; then sh_log_error "No root target directory" @@ -36,7 +37,8 @@ mo() { ) } -uo() { +oru() { a__overlay_root_unmount "${@}"; } +a__overlay_root_unmount() { ( if ! cd "overlay"; then sh_log_error "Unable to move into overlay directory" @@ -72,7 +74,8 @@ uo() { fi } -mr() { +obm() { a__overlay_bind_mount "${@}"; } +a__overlay_bind_mount() { local directory for directory in "dev" "dev/pts" "proc" "sys"; do if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then @@ -82,18 +85,21 @@ mr() { done } -cr() { +ocr() { a__overlay_command_root "${@}"; } +a__overlay_command_root() { chroot \ "overlay/mount" "${@}" } -cru() { +ocu() { a__overlay_command_user "${@}"; } +a__overlay_command_user() { chroot \ --userspec "1000:1000" \ "overlay/mount" "${@}" } -ur() { +obu() { a__overlay_bind_unmount "${@}"; } +a__overlay_bind_unmount() { local directory for directory in "sys" "proc" "dev/pts" "dev"; do if ! umount --lazy "overlay/mount/${directory}"; then @@ -103,15 +109,18 @@ ur() { done } -mm() { +omm() { a__overlay_mirror_mount "${@}"; } +a__overlay_mirror_mount() { mount --make-rslave --rbind "/deb" "overlay/mount/deb" } -um() { +omu() { a__overlay_mirror_unmount "${@}"; } +a__overlay_mirror_unmount() { umount --recursive "overlay/mount/deb" } -ms() { +ors() { a__overlay_root_squash "${@}"; } +a__overlay_root_squash() { local directory="${1}" local file local level="${2}" From 0b2b2acb7bb456e0e017faeff9ead207c0daa8e5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 12:50:43 +0100 Subject: [PATCH 626/702] ovl/bind --- sh/alias/overlay.sh | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index 82fe273..9418f75 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -1,3 +1,25 @@ +obm() { a__overlay_bind_mount "${@}"; } +a__overlay_bind_mount() { + local directory + for directory in "dev" "dev/pts" "proc" "sys"; do + if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then + sh_log_error "Unable to bind mount directory: ${directory}" + return 1 + fi + done +} + +obu() { a__overlay_bind_unmount "${@}"; } +a__overlay_bind_unmount() { + local directory + for directory in "sys" "proc" "dev/pts" "dev"; do + if ! umount --lazy "overlay/mount/${directory}"; then + sh_log_error "Unable to bind unmount directory: ${directory}" + return 1 + fi + done +} + orm() { a__overlay_root_mount "${@}"; } a__overlay_root_mount() { local root="${1}" @@ -74,17 +96,6 @@ a__overlay_root_unmount() { fi } -obm() { a__overlay_bind_mount "${@}"; } -a__overlay_bind_mount() { - local directory - for directory in "dev" "dev/pts" "proc" "sys"; do - if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then - sh_log_error "Unable to bind mount directory: ${directory}" - return 1 - fi - done -} - ocr() { a__overlay_command_root "${@}"; } a__overlay_command_root() { chroot \ @@ -98,17 +109,6 @@ a__overlay_command_user() { "overlay/mount" "${@}" } -obu() { a__overlay_bind_unmount "${@}"; } -a__overlay_bind_unmount() { - local directory - for directory in "sys" "proc" "dev/pts" "dev"; do - if ! umount --lazy "overlay/mount/${directory}"; then - sh_log_error "Unable to bind unmount directory: ${directory}" - return 1 - fi - done -} - omm() { a__overlay_mirror_mount "${@}"; } a__overlay_mirror_mount() { mount --make-rslave --rbind "/deb" "overlay/mount/deb" From 8490621281f655a865c65dbaca43ec0889c6efbb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 12:51:29 +0100 Subject: [PATCH 627/702] ovl/cmd --- sh/alias/overlay.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index 9418f75..7870c2e 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -20,6 +20,19 @@ a__overlay_bind_unmount() { done } +ocr() { a__overlay_command_root "${@}"; } +a__overlay_command_root() { + chroot \ + "overlay/mount" "${@}" +} + +ocu() { a__overlay_command_user "${@}"; } +a__overlay_command_user() { + chroot \ + --userspec "1000:1000" \ + "overlay/mount" "${@}" +} + orm() { a__overlay_root_mount "${@}"; } a__overlay_root_mount() { local root="${1}" @@ -96,19 +109,6 @@ a__overlay_root_unmount() { fi } -ocr() { a__overlay_command_root "${@}"; } -a__overlay_command_root() { - chroot \ - "overlay/mount" "${@}" -} - -ocu() { a__overlay_command_user "${@}"; } -a__overlay_command_user() { - chroot \ - --userspec "1000:1000" \ - "overlay/mount" "${@}" -} - omm() { a__overlay_mirror_mount "${@}"; } a__overlay_mirror_mount() { mount --make-rslave --rbind "/deb" "overlay/mount/deb" From c4b7796bb3782e89badc67098dd1eb5e08b5e0c2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 12:52:21 +0100 Subject: [PATCH 628/702] ovl/mirror --- sh/alias/overlay.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index 7870c2e..65f1c46 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -33,6 +33,16 @@ a__overlay_command_user() { "overlay/mount" "${@}" } +omm() { a__overlay_mirror_mount "${@}"; } +a__overlay_mirror_mount() { + mount --make-rslave --rbind "/deb" "overlay/mount/deb" +} + +omu() { a__overlay_mirror_unmount "${@}"; } +a__overlay_mirror_unmount() { + umount --recursive "overlay/mount/deb" +} + orm() { a__overlay_root_mount "${@}"; } a__overlay_root_mount() { local root="${1}" @@ -109,16 +119,6 @@ a__overlay_root_unmount() { fi } -omm() { a__overlay_mirror_mount "${@}"; } -a__overlay_mirror_mount() { - mount --make-rslave --rbind "/deb" "overlay/mount/deb" -} - -omu() { a__overlay_mirror_unmount "${@}"; } -a__overlay_mirror_unmount() { - umount --recursive "overlay/mount/deb" -} - ors() { a__overlay_root_squash "${@}"; } a__overlay_root_squash() { local directory="${1}" From bb76a2f956d83c3d1ee0e50c2e46a86f1692e45b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 12:53:01 +0100 Subject: [PATCH 629/702] ovl/squash --- sh/alias/overlay.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index 65f1c46..307c470 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -82,6 +82,26 @@ a__overlay_root_mount() { ) } +ors() { a__overlay_root_squash "${@}"; } +a__overlay_root_squash() { + local directory="${1}" + local file + local level="${2}" + if [ -n "${directory}" ]; then + if mkdir "${directory}"; then + [ -n "${level}" ] || level="18" + for file in "vmlinuz" "initrd.img"; do + cp "overlay/mount/${file}" "${directory}" + done + mksquashfs \ + "overlay/mount" "${directory}/filesystem.squashfs" \ + -noappend \ + -comp "zstd" -Xcompression-level "${level}" + chown --recursive 1000:1000 "${directory}" + fi + fi +} + oru() { a__overlay_root_unmount "${@}"; } a__overlay_root_unmount() { ( @@ -118,23 +138,3 @@ a__overlay_root_unmount() { return 7 fi } - -ors() { a__overlay_root_squash "${@}"; } -a__overlay_root_squash() { - local directory="${1}" - local file - local level="${2}" - if [ -n "${directory}" ]; then - if mkdir "${directory}"; then - [ -n "${level}" ] || level="18" - for file in "vmlinuz" "initrd.img"; do - cp "overlay/mount/${file}" "${directory}" - done - mksquashfs \ - "overlay/mount" "${directory}/filesystem.squashfs" \ - -noappend \ - -comp "zstd" -Xcompression-level "${level}" - chown --recursive 1000:1000 "${directory}" - fi - fi -} From 6eee35b3a4be4a63ca09f3f7e688a095bfcf9858 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:03:00 +0100 Subject: [PATCH 630/702] =?UTF-8?q?=E2=88=92ovl/lxc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/mount-lxc.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 sh/mount-lxc.sh diff --git a/sh/mount-lxc.sh b/sh/mount-lxc.sh deleted file mode 100644 index 8cc946e..0000000 --- a/sh/mount-lxc.sh +++ /dev/null @@ -1,31 +0,0 @@ -mrc() { - local container="${1}" - local f - for f in "dev" "dev/pts" "proc" "sys"; do - mount --bind "/${f}" "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" - done -} - -crc() { - local container="${1}" - shift - chroot "overlay/mount/var/lib/lxc/${container}/squashfs-root" "${@}" -} - -urc() { - local container="${1}" - local f - for f in "sys" "proc" "dev/pts" "dev"; do - umount --lazy "overlay/mount/var/lib/lxc/${container}/squashfs-root/${f}" - done -} - -mmc() { - local container="${1}" - mount --bind "/deb" "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" -} - -umc() { - local container="${1}" - umount "overlay/mount/var/lib/lxc/${container}/squashfs-root/deb" -} From e6e446868de04341a2622632d0d31de270a2c599 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:16:24 +0100 Subject: [PATCH 631/702] main/lf --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 9a86ebe..60f5df0 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -34,8 +34,8 @@ main_source_directory() { modules="$(find "${path}" \ -type "f" \ -name "*.sh" \ - -printf "%P -" | sort)" + -printf "%P\n" | + sort)" ifs="${IFS}" IFS=" " From 20ea46c5e4774cac160fa20ff9a35a92f1c2977c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:21:23 +0100 Subject: [PATCH 632/702] shellcheck/sources --- sh/.shellcheckrc | 1 + 1 file changed, 1 insertion(+) diff --git a/sh/.shellcheckrc b/sh/.shellcheckrc index 173f983..09194f4 100644 --- a/sh/.shellcheckrc +++ b/sh/.shellcheckrc @@ -1,3 +1,4 @@ disable=1090,3043 enable=all +external-sources=true shell=sh From 35626d110458050f4e724f68640b300bbc19e37c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:23:09 +0100 Subject: [PATCH 633/702] =?UTF-8?q?=E2=88=92main/export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/main.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 60f5df0..e037089 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,6 +1,5 @@ SH_NAME="sh" SH_SHELL="$(cat /proc/${$}/comm)" -export SH_SHELL SH_ROOT="/etc/${SH_NAME}" SH_USER="${HOME}/${SH_NAME}" From d2ee4678d77fdd200e722ef693b78f487b87fcda Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:28:42 +0100 Subject: [PATCH 634/702] source/check --- sh/main.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index e037089..bb7c2bc 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -8,6 +8,17 @@ SH_MAIN="${SH_ROOT}/main.sh" [ -n "${ENV}" ] || export ENV="${SH_MAIN}" +sh_source_check() { + local file=".shellcheck.sh" + find \ + -type "f" \ + -name "*.sh" \ + -printf ". \"%P\"\n" \ + >"${file}" + shellcheck "${file}" + rm "${file}" +} + _sh_main_commands() { local file="${1}" grep "()" "${file}" | From e029b00caebdced768f0187fecaa4dd2086a7d05 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:31:34 +0100 Subject: [PATCH 635/702] useless --- sh/alias/shell.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh index 8f6684c..daadbce 100644 --- a/sh/alias/shell.sh +++ b/sh/alias/shell.sh @@ -17,7 +17,6 @@ x() { "${@}" } -# shellcheck disable=SC2154 [ "${SH_SHELL}" = "bash" ] || return # shellcheck disable=SC3033 From 84f6922b6f9a8ad2d2eaf2c4b14a07a9d609d2e5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 13:56:01 +0100 Subject: [PATCH 636/702] check sourced --- sh/main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index bb7c2bc..4c1e58b 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -15,7 +15,9 @@ sh_source_check() { -name "*.sh" \ -printf ". \"%P\"\n" \ >"${file}" - shellcheck "${file}" + shellcheck \ + --check-sourced \ + "${file}" rm "${file}" } From ae8aaec327e2180437a4061e31909ee3cd090108 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:06:22 +0100 Subject: [PATCH 637/702] not output --- sh/main.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 4c1e58b..27aca02 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -13,6 +13,8 @@ sh_source_check() { find \ -type "f" \ -name "*.sh" \ + -not \ + -name "${file}" \ -printf ". \"%P\"\n" \ >"${file}" shellcheck \ From 4b9f7df102f2445ca8aea5dc119fffe862d550bf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:07:38 +0100 Subject: [PATCH 638/702] . --- sh/main.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sh/main.sh b/sh/main.sh index 27aca02..3e2008f 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -11,6 +11,7 @@ SH_MAIN="${SH_ROOT}/main.sh" sh_source_check() { local file=".shellcheck.sh" find \ + "." \ -type "f" \ -name "*.sh" \ -not \ From 0eaebdf4011b3208c8da12c1fcb15abea18c7187 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:16:23 +0100 Subject: [PATCH 639/702] source --- sh/.shellcheckrc | 2 +- sh/main.sh | 1 + sh/shell.sh | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sh/.shellcheckrc b/sh/.shellcheckrc index 09194f4..8e71c00 100644 --- a/sh/.shellcheckrc +++ b/sh/.shellcheckrc @@ -1,4 +1,4 @@ -disable=1090,3043 +disable=3043 enable=all external-sources=true shell=sh diff --git a/sh/main.sh b/sh/main.sh index 3e2008f..3ce303c 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -63,6 +63,7 @@ main_source_directory() { _sh_main_log "${module%.sh}" module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then + # shellcheck disable=1090 . "${module}" cmd="$(_sh_main_commands "${module}")" if [ -n "${cmd}" ]; then diff --git a/sh/shell.sh b/sh/shell.sh index bf39f7b..720c884 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -33,6 +33,7 @@ sh_shell_configure() { local root="/usr/share/bash-completion" local file="bash_completion" local path="${root}/${file}" + # shellcheck disable=1090 [ -f "${path}" ] && . "${path}" root="${root}/completions" if [ -d "${root}" ]; then @@ -41,6 +42,7 @@ sh_shell_configure() { "tar" for file in "${@}"; do path="${root}/${file}" + # shellcheck disable=1090 [ -f "${path}" ] && . "${path}" done fi From c68409c546b98c98aa628c43b296526c38d223b0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:27:23 +0100 Subject: [PATCH 640/702] +sc --- sh/main.sh | 2 +- sh/shell.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 3ce303c..61637fb 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -63,7 +63,7 @@ main_source_directory() { _sh_main_log "${module%.sh}" module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then - # shellcheck disable=1090 + # shellcheck disable=SC1090 . "${module}" cmd="$(_sh_main_commands "${module}")" if [ -n "${cmd}" ]; then diff --git a/sh/shell.sh b/sh/shell.sh index 720c884..733d823 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -33,7 +33,7 @@ sh_shell_configure() { local root="/usr/share/bash-completion" local file="bash_completion" local path="${root}/${file}" - # shellcheck disable=1090 + # shellcheck disable=SC1090 [ -f "${path}" ] && . "${path}" root="${root}/completions" if [ -d "${root}" ]; then @@ -42,7 +42,7 @@ sh_shell_configure() { "tar" for file in "${@}"; do path="${root}/${file}" - # shellcheck disable=1090 + # shellcheck disable=SC1090 [ -f "${path}" ] && . "${path}" done fi From 47f108f0a3022171b99daed5299158fee1ddeeb7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:45:16 +0100 Subject: [PATCH 641/702] source/find --- sh/main.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 61637fb..7da2446 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -24,6 +24,21 @@ sh_source_check() { rm "${file}" } +sh_source_find() { + local root="${1}" + local file="${2}" + set -- \ + "${root}" \ + -name "*.sh" \ + -type "f" + [ -n "${file}" ] && + set -- "${@}" \ + -not \ + -name "${file}" + find "${@}" \ + -printf "%P\n" +} + _sh_main_commands() { local file="${1}" grep "()" "${file}" | From d517b783d78d8615a31e209219cb007c2473894f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:52:47 +0100 Subject: [PATCH 642/702] sort,shfmt --- sh/main.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 7da2446..ff80d0d 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -11,13 +11,13 @@ SH_MAIN="${SH_ROOT}/main.sh" sh_source_check() { local file=".shellcheck.sh" find \ - "." \ - -type "f" \ - -name "*.sh" \ - -not \ - -name "${file}" \ - -printf ". \"%P\"\n" \ - >"${file}" + "." \ + -type "f" \ + -name "*.sh" \ + -not \ + -name "${file}" \ + -printf ". \"%P\"\n" \ + >"${file}" shellcheck \ --check-sourced \ "${file}" @@ -36,7 +36,8 @@ sh_source_find() { -not \ -name "${file}" find "${@}" \ - -printf "%P\n" + -printf "%P\n" | + sort } _sh_main_commands() { From 51de08aaa3175e69a1627cf8fe8dd1c510520918 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 14:59:24 +0100 Subject: [PATCH 643/702] source/find --- sh/main.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index ff80d0d..d593295 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -62,11 +62,7 @@ main_source_directory() { local path="${1}" if [ -d "${path}" ]; then local cmd count ifs module modules - modules="$(find "${path}" \ - -type "f" \ - -name "*.sh" \ - -printf "%P\n" | - sort)" + modules="$(sh_source_find "${path}")" ifs="${IFS}" IFS=" " From 8fb0750b596bfbb30cd5033bc10abd68307da276 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 15:07:19 +0100 Subject: [PATCH 644/702] except --- sh/main.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index d593295..7b3fe28 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -62,7 +62,7 @@ main_source_directory() { local path="${1}" if [ -d "${path}" ]; then local cmd count ifs module modules - modules="$(sh_source_find "${path}")" + modules="$(sh_source_find "${path}" "main.sh")" ifs="${IFS}" IFS=" " @@ -74,15 +74,13 @@ main_source_directory() { #printf "%02d" "${count}" _sh_main_log "${module%.sh}" module="${path}/${module}" - if [ "${module}" != "${ENV}" ]; then - # shellcheck disable=SC1090 - . "${module}" - cmd="$(_sh_main_commands "${module}")" - if [ -n "${cmd}" ]; then - [ -n "${CMD}" ] && CMD="${CMD} + # shellcheck disable=SC1090 + . "${module}" + cmd="$(_sh_main_commands "${module}")" + if [ -n "${cmd}" ]; then + [ -n "${CMD}" ] && CMD="${CMD} " - CMD="${CMD}${cmd}" - fi + CMD="${CMD}${cmd}" fi done IFS="${ifs}" From e9904f2965ea44cf41f9f786a7e7780d9f44ac53 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 15:09:58 +0100 Subject: [PATCH 645/702] main/name --- sh/main.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 7b3fe28..3ee4c6f 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,10 +1,11 @@ +SH_MAIN_NAME="main.sh" SH_NAME="sh" SH_SHELL="$(cat /proc/${$}/comm)" SH_ROOT="/etc/${SH_NAME}" SH_USER="${HOME}/${SH_NAME}" -SH_MAIN="${SH_ROOT}/main.sh" +SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" [ -n "${ENV}" ] || export ENV="${SH_MAIN}" @@ -62,7 +63,7 @@ main_source_directory() { local path="${1}" if [ -d "${path}" ]; then local cmd count ifs module modules - modules="$(sh_source_find "${path}" "main.sh")" + modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" ifs="${IFS}" IFS=" " From df136cbad5c2cbc33f88690e7fdd17ca0ae4b2c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 15:33:18 +0100 Subject: [PATCH 646/702] check/find --- sh/main.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 3ee4c6f..ea6a4d0 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -11,14 +11,16 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" sh_source_check() { local file=".shellcheck.sh" - find \ - "." \ - -type "f" \ - -name "*.sh" \ - -not \ - -name "${file}" \ - -printf ". \"%P\"\n" \ - >"${file}" + local ifs module modules + modules="$(sh_source_find "." "${file}")" + rm --force "${file}" + ifs="${IFS}" + IFS=" +" + for module in ${modules}; do + echo ". \"${module}\"" >>"${file}" + done + IFS="${ifs}" shellcheck \ --check-sourced \ "${file}" From 62b8f608419eba4dceba3ee2287bfbe3efe92ef1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 16:19:48 +0100 Subject: [PATCH 647/702] main/count --- sh/main.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index ea6a4d0..bfa8c04 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -74,8 +74,7 @@ main_source_directory() { ". ${path}" for module in ${modules}; do count=$((count + 1)) - #printf "%02d" "${count}" - _sh_main_log "${module%.sh}" + _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" module="${path}/${module}" # shellcheck disable=SC1090 . "${module}" From 678cf741c993310c774d7109b1b8f874b82d146c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 16:31:59 +0100 Subject: [PATCH 648/702] main/if --- sh/main.sh | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index bfa8c04..92edc7b 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -63,33 +63,32 @@ _sh_main_log() { main_source_directory() { local path="${1}" - if [ -d "${path}" ]; then - local cmd count ifs module modules - modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" - ifs="${IFS}" - IFS=" -" - count=0 - _sh_main_log "" \ - ". ${path}" - for module in ${modules}; do - count=$((count + 1)) - _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" - module="${path}/${module}" - # shellcheck disable=SC1090 - . "${module}" - cmd="$(_sh_main_commands "${module}")" - if [ -n "${cmd}" ]; then - [ -n "${CMD}" ] && CMD="${CMD} -" - CMD="${CMD}${cmd}" - fi - done - IFS="${ifs}" - else + if [ ! -d "${path}" ]; then _sh_main_log "Not a directory: ${path}" return 1 fi + local cmd count ifs module modules + modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" + ifs="${IFS}" + IFS=" +" + count=0 + _sh_main_log "" \ + ". ${path}" + for module in ${modules}; do + count=$((count + 1)) + _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" + module="${path}/${module}" + # shellcheck disable=SC1090 + . "${module}" + cmd="$(_sh_main_commands "${module}")" + if [ -n "${cmd}" ]; then + [ -n "${CMD}" ] && CMD="${CMD} +" + CMD="${CMD}${cmd}" + fi + done + IFS="${ifs}" } main_source_file() { From ec8d1c113cd7a05ddce6b10aeb8b3fa906061525 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 16:38:48 +0100 Subject: [PATCH 649/702] ifs/new,pop --- sh/main.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 92edc7b..2c240b6 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -9,18 +9,27 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" [ -n "${ENV}" ] || export ENV="${SH_MAIN}" -sh_source_check() { - local file=".shellcheck.sh" - local ifs module modules - modules="$(sh_source_find "." "${file}")" - rm --force "${file}" - ifs="${IFS}" +_sh_ifs_new() { + SH_IFS="${IFS}" IFS=" " +} + +_sh_ifs_pop() { + IFS="${SH_IFS}" + unset SH_IFS +} + +sh_source_check() { + local file=".shellcheck.sh" + local module modules + modules="$(sh_source_find "." "${file}")" + rm --force "${file}" + _sh_ifs_new for module in ${modules}; do echo ". \"${module}\"" >>"${file}" done - IFS="${ifs}" + _sh_ifs_pop shellcheck \ --check-sourced \ "${file}" @@ -69,9 +78,7 @@ main_source_directory() { fi local cmd count ifs module modules modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" - ifs="${IFS}" - IFS=" -" + _sh_ifs_new count=0 _sh_main_log "" \ ". ${path}" @@ -88,7 +95,7 @@ main_source_directory() { CMD="${CMD}${cmd}" fi done - IFS="${ifs}" + _sh_ifs_pop } main_source_file() { From 25e7cc4f6c93d6a6fe383b47703b18cc657fdd4f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 17:17:05 +0100 Subject: [PATCH 650/702] loopback --- sh/main.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 2c240b6..4cbf317 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -21,17 +21,21 @@ _sh_ifs_pop() { } sh_source_check() { - local file=".shellcheck.sh" - local module modules - modules="$(sh_source_find "." "${file}")" - rm --force "${file}" + local root="${1}" + local file module modules + file="$(mktemp)" + modules="$(sh_source_find "${root}")" _sh_ifs_new for module in ${modules}; do - echo ". \"${module}\"" >>"${file}" + echo ". \"${root}/${module}\"" >>"${file}" done _sh_ifs_pop shellcheck \ --check-sourced \ + --enable "all" \ + --exclude "3043" \ + --external-sources \ + --shell "dash" \ "${file}" rm "${file}" } @@ -76,7 +80,7 @@ main_source_directory() { _sh_main_log "Not a directory: ${path}" return 1 fi - local cmd count ifs module modules + local cmd count module modules modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" _sh_ifs_new count=0 @@ -111,6 +115,7 @@ main_source_file() { _sh_main() { main_source_file "${ENV}" main_source_directory "${SH_USER}" + sh_source_check "$(dirname "${ENV}")" _sh_main_log "" \ "sh_… = shell functions" \ "a__… = aliases" \ From df1fb4f343b5f93d54514516c129ce7e1e114fcc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 17:32:44 +0100 Subject: [PATCH 651/702] env --- sh/main.sh | 11 ++++++++--- sh/shell.sh | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 4cbf317..9189197 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,13 +1,18 @@ +# constants + SH_MAIN_NAME="main.sh" SH_NAME="sh" -SH_SHELL="$(cat /proc/${$}/comm)" SH_ROOT="/etc/${SH_NAME}" -SH_USER="${HOME}/${SH_NAME}" SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" -[ -n "${ENV}" ] || export ENV="${SH_MAIN}" +# variables + +SH_SHELL="$(cat /proc/${$}/comm)" +SH_USER="${HOME}/${SH_NAME}" + +# functions _sh_ifs_new() { SH_IFS="${IFS}" diff --git a/sh/shell.sh b/sh/shell.sh index 733d823..3a76cb6 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -27,6 +27,12 @@ SH_COLOR_MAGENTA="$(_sh_shell_color 35)" SH_COLOR_RED="$(_sh_shell_color 32)" sh_shell_configure() { + [ -n "${ENV}" ] || ENV="${SH_MAIN}" + export ENV + # prompt + PS1="\$(sh_shell_prompt \${?})" + PS2="├ " + # specific case "${SH_SHELL}" in "bash") # completion @@ -53,9 +59,6 @@ sh_shell_configure() { ;; *) ;; esac - # prompt - PS1="\$(sh_shell_prompt \${?})" - PS2="├ " } sh_shell_configure From 558c5d82c3adf7b1fad4c225c7fab7e5b9112f9a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 17:54:40 +0100 Subject: [PATCH 652/702] quote --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 9189197..665e707 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -9,7 +9,7 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" # variables -SH_SHELL="$(cat /proc/${$}/comm)" +SH_SHELL="$(cat "/proc/${$}/comm")" SH_USER="${HOME}/${SH_NAME}" # functions From d048757efee2c383bc92971866fef4c7d1104ade Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 17:57:41 +0100 Subject: [PATCH 653/702] main/help --- sh/main.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 665e707..9c1c59d 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -117,14 +117,18 @@ main_source_file() { fi } -_sh_main() { - main_source_file "${ENV}" - main_source_directory "${SH_USER}" - sh_source_check "$(dirname "${ENV}")" +sh_help() { _sh_main_log "" \ "sh_… = shell functions" \ "a__… = aliases" \ "u__… = user" } +_sh_main() { + main_source_file "${ENV}" + main_source_directory "${SH_USER}" + sh_source_check "$(dirname "${ENV}")" + sh_help +} + _sh_main From b9158be284766fb0b696bf1a3e2d2b6f0c9371c3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:09:03 +0100 Subject: [PATCH 654/702] main --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 9c1c59d..4fbecc3 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -124,11 +124,11 @@ sh_help() { "u__… = user" } -_sh_main() { +sh_main() { main_source_file "${ENV}" main_source_directory "${SH_USER}" sh_source_check "$(dirname "${ENV}")" sh_help } -_sh_main +sh_main From 80463e92135e82e0754349d1c00409cf985a0576 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:20:08 +0100 Subject: [PATCH 655/702] logs --- sh/log.sh | 7 +++++-- sh/main.sh | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index 1674324..4e7a63e 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -58,7 +58,10 @@ _sh_log() { shift local line for line in "${@}"; do - [ -n "${prefix}" ] && printf "%s" "${prefix} " - echo "${line}" + if [ -n "${prefix}" ]; then + _sh_main_log "${prefix} ${line}" + else + _sh_main_log "${line}" + fi done } diff --git a/sh/main.sh b/sh/main.sh index 4fbecc3..1cc1116 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -70,9 +70,10 @@ _sh_main_commands() { _sh_main_log() { case "${-}" in *i*) - local argument - for argument in "${@}"; do - echo "${argument}" + [ -n "${1}" ] || set -- "" + local line + for line in "${@}"; do + echo "${line}" done ;; *) ;; From 47188ffedde589db3462acce705a7a267f1e0e47 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:22:35 +0100 Subject: [PATCH 656/702] gt --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 1cc1116..6e68a16 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -70,7 +70,7 @@ _sh_main_commands() { _sh_main_log() { case "${-}" in *i*) - [ -n "${1}" ] || set -- "" + [ ${#} -gt 0 ] || set -- "" local line for line in "${@}"; do echo "${line}" From 1507a935b97b4dd5c303eb368657eadf0eecd6e2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:23:48 +0100 Subject: [PATCH 657/702] help/log --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 6e68a16..2bae67d 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -119,7 +119,7 @@ main_source_file() { } sh_help() { - _sh_main_log "" \ + sh_log "" \ "sh_… = shell functions" \ "a__… = aliases" \ "u__… = user" From a8da17d1965efd1ed1d235e78b00b3079258a989 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:25:13 +0100 Subject: [PATCH 658/702] main/logs --- sh/main.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 2bae67d..5274b28 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -119,7 +119,7 @@ main_source_file() { } sh_help() { - sh_log "" \ + sh_log \ "sh_… = shell functions" \ "a__… = aliases" \ "u__… = user" @@ -128,7 +128,9 @@ sh_help() { sh_main() { main_source_file "${ENV}" main_source_directory "${SH_USER}" + sh_log sh_source_check "$(dirname "${ENV}")" + sh_log sh_help } From 1bc166a046ec794536ba3e37b36a864d215a8cea Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:30:35 +0100 Subject: [PATCH 659/702] empty --- sh/log.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sh/log.sh b/sh/log.sh index 4e7a63e..2be59e0 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -56,6 +56,7 @@ sh_log_warn() { _sh_log() { local prefix="${1}" shift + [ ${#} -gt 0 ] || set -- "" local line for line in "${@}"; do if [ -n "${prefix}" ]; then From 839c8fa069cf3792648cd74192fa0158afb115e1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:33:23 +0100 Subject: [PATCH 660/702] main/log --- sh/main.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 5274b28..2a351c9 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -12,7 +12,7 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" SH_SHELL="$(cat "/proc/${$}/comm")" SH_USER="${HOME}/${SH_NAME}" -# functions +# private _sh_ifs_new() { SH_IFS="${IFS}" @@ -25,6 +25,21 @@ _sh_ifs_pop() { unset SH_IFS } +_sh_main_log() { + case "${-}" in + *i*) + [ ${#} -gt 0 ] || set -- "" + local line + for line in "${@}"; do + echo "${line}" + done + ;; + *) ;; + esac +} + +# + sh_source_check() { local root="${1}" local file module modules @@ -67,19 +82,6 @@ _sh_main_commands() { cut --delimiter "(" --fields 1 } -_sh_main_log() { - case "${-}" in - *i*) - [ ${#} -gt 0 ] || set -- "" - local line - for line in "${@}"; do - echo "${line}" - done - ;; - *) ;; - esac -} - main_source_directory() { local path="${1}" if [ ! -d "${path}" ]; then From 0e8cab41f6c03824e46b3015b440f0eea213c84c Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:39:25 +0100 Subject: [PATCH 661/702] shellcheck --- sh/main.sh | 28 ++++++---------------------- sh/shellcheck.sh | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 sh/shellcheck.sh diff --git a/sh/main.sh b/sh/main.sh index 2a351c9..83f0705 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -38,27 +38,7 @@ _sh_main_log() { esac } -# - -sh_source_check() { - local root="${1}" - local file module modules - file="$(mktemp)" - modules="$(sh_source_find "${root}")" - _sh_ifs_new - for module in ${modules}; do - echo ". \"${root}/${module}\"" >>"${file}" - done - _sh_ifs_pop - shellcheck \ - --check-sourced \ - --enable "all" \ - --exclude "3043" \ - --external-sources \ - --shell "dash" \ - "${file}" - rm "${file}" -} +# sort sh_source_find() { local root="${1}" @@ -120,6 +100,8 @@ main_source_file() { fi } +# public + sh_help() { sh_log \ "sh_… = shell functions" \ @@ -131,9 +113,11 @@ sh_main() { main_source_file "${ENV}" main_source_directory "${SH_USER}" sh_log - sh_source_check "$(dirname "${ENV}")" + sh_shellcheck "$(dirname "${ENV}")" sh_log sh_help } +# main + sh_main diff --git a/sh/shellcheck.sh b/sh/shellcheck.sh new file mode 100644 index 0000000..d5ccb53 --- /dev/null +++ b/sh/shellcheck.sh @@ -0,0 +1,19 @@ +sh_shellcheck() { + local root="${1}" + local file module modules + file="$(mktemp)" + modules="$(sh_source_find "${root}")" + _sh_ifs_new + for module in ${modules}; do + echo ". \"${root}/${module}\"" >>"${file}" + done + _sh_ifs_pop + shellcheck \ + --check-sourced \ + --enable "all" \ + --exclude "3043" \ + --external-sources \ + --shell "dash" \ + "${file}" + rm "${file}" +} From 86be462cbe5e4cca8da07d43392255bed0aadc14 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:48:22 +0100 Subject: [PATCH 662/702] =?UTF-8?q?=E2=88=92file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/main.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 83f0705..4925099 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -90,16 +90,6 @@ main_source_directory() { _sh_ifs_pop } -main_source_file() { - local path="${1}" - if [ -f "${path}" ]; then - main_source_directory "$(dirname "${path}")" - else - _sh_main_log "Not a file: ${path}" - return 1 - fi -} - # public sh_help() { @@ -110,10 +100,10 @@ sh_help() { } sh_main() { - main_source_file "${ENV}" + main_source_directory "${SH_ROOT}" main_source_directory "${SH_USER}" sh_log - sh_shellcheck "$(dirname "${ENV}")" + sh_shellcheck "${SH_ROOT}" sh_log sh_help } From 586373ca3f21e93d86c879ed922d22d235a9ed47 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 18:51:24 +0100 Subject: [PATCH 663/702] erroot --- sh/main.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 4925099..e4f45ba 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -64,10 +64,8 @@ _sh_main_commands() { main_source_directory() { local path="${1}" - if [ ! -d "${path}" ]; then - _sh_main_log "Not a directory: ${path}" + [ -d "${path}" ] || return 1 - fi local cmd count module modules modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" _sh_ifs_new @@ -100,7 +98,10 @@ sh_help() { } sh_main() { - main_source_directory "${SH_ROOT}" + if ! main_source_directory "${SH_ROOT}"; then + _sh_main_log "Not a directory: ${SH_ROOT}" + return 1 + fi main_source_directory "${SH_USER}" sh_log sh_shellcheck "${SH_ROOT}" From 13e89092e4cdea1a4fbad0873803d4e80e7524a9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 20:40:57 +0100 Subject: [PATCH 664/702] public/find --- sh/main.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index e4f45ba..99882a7 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -40,22 +40,6 @@ _sh_main_log() { # sort -sh_source_find() { - local root="${1}" - local file="${2}" - set -- \ - "${root}" \ - -name "*.sh" \ - -type "f" - [ -n "${file}" ] && - set -- "${@}" \ - -not \ - -name "${file}" - find "${@}" \ - -printf "%P\n" | - sort -} - _sh_main_commands() { local file="${1}" grep "()" "${file}" | @@ -90,6 +74,22 @@ main_source_directory() { # public +sh_source_find() { + local root="${1}" + local file="${2}" + set -- \ + "${root}" \ + -name "*.sh" \ + -type "f" + [ -n "${file}" ] && + set -- "${@}" \ + -not \ + -name "${file}" + find "${@}" \ + -printf "%P\n" | + sort +} + sh_help() { sh_log \ "sh_… = shell functions" \ From ff7f64e670aa5e143f884d6dd744fa062e6c8e19 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 20:46:09 +0100 Subject: [PATCH 665/702] find/ext,sh --- sh/main.sh | 15 ++++++++++----- sh/shellcheck.sh | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 99882a7..7921bce 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -51,7 +51,7 @@ main_source_directory() { [ -d "${path}" ] || return 1 local cmd count module modules - modules="$(sh_source_find "${path}" "${SH_MAIN_NAME}")" + modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")" _sh_ifs_new count=0 _sh_main_log "" \ @@ -74,12 +74,13 @@ main_source_directory() { # public -sh_source_find() { - local root="${1}" - local file="${2}" +sh_find_extension() { + local extension="${1}" + local root="${2}" + local file="${3}" set -- \ "${root}" \ - -name "*.sh" \ + -name "*.${extension}" \ -type "f" [ -n "${file}" ] && set -- "${@}" \ @@ -90,6 +91,10 @@ sh_source_find() { sort } +sh_find_sh() { + sh_find_extension "sh" "${@}" +} + sh_help() { sh_log \ "sh_… = shell functions" \ diff --git a/sh/shellcheck.sh b/sh/shellcheck.sh index d5ccb53..567568c 100644 --- a/sh/shellcheck.sh +++ b/sh/shellcheck.sh @@ -2,7 +2,7 @@ sh_shellcheck() { local root="${1}" local file module modules file="$(mktemp)" - modules="$(sh_source_find "${root}")" + modules="$(sh_find_sh "${root}")" _sh_ifs_new for module in ${modules}; do echo ". \"${root}/${module}\"" >>"${file}" From ff077a039a17129c1471cb45089c9810c778a5f3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 21:00:14 +0100 Subject: [PATCH 666/702] grep_functions --- sh/main.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 7921bce..bc3fecc 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -40,12 +40,6 @@ _sh_main_log() { # sort -_sh_main_commands() { - local file="${1}" - grep "()" "${file}" | - cut --delimiter "(" --fields 1 -} - main_source_directory() { local path="${1}" [ -d "${path}" ] || @@ -62,7 +56,7 @@ main_source_directory() { module="${path}/${module}" # shellcheck disable=SC1090 . "${module}" - cmd="$(_sh_main_commands "${module}")" + cmd="$(sh_grep_functions "${module}")" if [ -n "${cmd}" ]; then [ -n "${CMD}" ] && CMD="${CMD} " @@ -95,6 +89,12 @@ sh_find_sh() { sh_find_extension "sh" "${@}" } +sh_grep_functions() { + local file="${1}" + grep "()" "${file}" | + cut --delimiter "(" --fields 1 +} + sh_help() { sh_log \ "sh_… = shell functions" \ From 4c862481f77ca1c127556a9efaf65b51f529896a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 25 Nov 2024 22:21:01 +0100 Subject: [PATCH 667/702] main/source_dir --- sh/main.sh | 62 ++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index bc3fecc..6c18b48 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -38,34 +38,6 @@ _sh_main_log() { esac } -# sort - -main_source_directory() { - local path="${1}" - [ -d "${path}" ] || - return 1 - local cmd count module modules - modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")" - _sh_ifs_new - count=0 - _sh_main_log "" \ - ". ${path}" - for module in ${modules}; do - count=$((count + 1)) - _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" - module="${path}/${module}" - # shellcheck disable=SC1090 - . "${module}" - cmd="$(sh_grep_functions "${module}")" - if [ -n "${cmd}" ]; then - [ -n "${CMD}" ] && CMD="${CMD} -" - CMD="${CMD}${cmd}" - fi - done - _sh_ifs_pop -} - # public sh_find_extension() { @@ -102,18 +74,44 @@ sh_help() { "u__… = user" } +sh_source_directory() { + local path="${1}" + [ -d "${path}" ] || + return 1 + local cmd count module modules + modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")" + _sh_ifs_new + count=0 + _sh_main_log "" \ + ". ${path}" + for module in ${modules}; do + count=$((count + 1)) + _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" + module="${path}/${module}" + # shellcheck disable=SC1090 + . "${module}" + cmd="$(sh_grep_functions "${module}")" + if [ -n "${cmd}" ]; then + [ -n "${CMD}" ] && CMD="${CMD} +" + CMD="${CMD}${cmd}" + fi + done + _sh_ifs_pop +} + +# main + sh_main() { - if ! main_source_directory "${SH_ROOT}"; then + if ! sh_source_directory "${SH_ROOT}"; then _sh_main_log "Not a directory: ${SH_ROOT}" return 1 fi - main_source_directory "${SH_USER}" + sh_source_directory "${SH_USER}" sh_log sh_shellcheck "${SH_ROOT}" sh_log sh_help } -# main - sh_main From 05271ef8285f77772637b2fd22f7178604b56296 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 11:28:28 +0100 Subject: [PATCH 668/702] members --- sh/rescue/hetzner.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 8d7f02b..8d4f56d 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -63,7 +63,6 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}2" done - # shellcheck disable=SC2086 sh_fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # @@ -88,7 +87,6 @@ rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}1" done - # shellcheck disable=SC2086 sh_fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt From eee9e38b7d7a7954a3be6e22a58eeb9508bd26d6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 11:55:03 +0100 Subject: [PATCH 669/702] shell/interactive --- sh/main.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 6c18b48..692664a 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -74,6 +74,13 @@ sh_help() { "u__… = user" } +sh_shell_interactive() { + case "${-}" in + *i*) ;; + *) return 1 ;; + esac +} + sh_source_directory() { local path="${1}" [ -d "${path}" ] || From 1572a779ae7f25576758891489f5976197b519f7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 12:01:01 +0100 Subject: [PATCH 670/702] if interactive --- sh/main.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 692664a..4c99298 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -26,16 +26,13 @@ _sh_ifs_pop() { } _sh_main_log() { - case "${-}" in - *i*) + if sh_shell_interactive; then [ ${#} -gt 0 ] || set -- "" local line for line in "${@}"; do echo "${line}" done - ;; - *) ;; - esac + fi } # public @@ -115,10 +112,12 @@ sh_main() { return 1 fi sh_source_directory "${SH_USER}" - sh_log - sh_shellcheck "${SH_ROOT}" - sh_log - sh_help + if sh_shell_interactive; then + sh_log + sh_shellcheck "${SH_ROOT}" + sh_log + sh_help + fi } sh_main From 321070d5cc825d027439738a6f17e251b6c80f66 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 12:17:39 +0100 Subject: [PATCH 671/702] +shfmt --- sh/shellcheck.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sh/shellcheck.sh b/sh/shellcheck.sh index 567568c..7b04827 100644 --- a/sh/shellcheck.sh +++ b/sh/shellcheck.sh @@ -1,11 +1,13 @@ sh_shellcheck() { local root="${1}" - local file module modules + local file module modules path file="$(mktemp)" modules="$(sh_find_sh "${root}")" _sh_ifs_new for module in ${modules}; do - echo ". \"${root}/${module}\"" >>"${file}" + path="${root}/${module}" + shfmt --diff "${path}" + echo ". \"${path}\"" >>"${file}" done _sh_ifs_pop shellcheck \ From b93a6909bb4275ac5f85cf19514b6aceca122f71 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 15:42:58 +0100 Subject: [PATCH 672/702] comments --- sh/main.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 4c99298..e91efbf 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,6 +37,7 @@ _sh_main_log() { # public +# find directory’s files by extension sh_find_extension() { local extension="${1}" local root="${2}" @@ -54,16 +55,19 @@ sh_find_extension() { sort } +# find directory’s sh files sh_find_sh() { sh_find_extension "sh" "${@}" } +# get functions from file sh_grep_functions() { local file="${1}" grep "()" "${file}" | cut --delimiter "(" --fields 1 } +# output help message sh_help() { sh_log \ "sh_… = shell functions" \ @@ -71,6 +75,7 @@ sh_help() { "u__… = user" } +# test if active shell is in interactive mode sh_shell_interactive() { case "${-}" in *i*) ;; @@ -106,18 +111,25 @@ sh_source_directory() { # main +# run initial steps sh_main() { + # system root if ! sh_source_directory "${SH_ROOT}"; then _sh_main_log "Not a directory: ${SH_ROOT}" return 1 fi + # user root sh_source_directory "${SH_USER}" + # run interactive extras if sh_shell_interactive; then + # check sh_log sh_shellcheck "${SH_ROOT}" + # help sh_log sh_help fi } +# run main function sh_main From 6eec85df21914a7d884cec08e1b787726817cd99 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 15:45:32 +0100 Subject: [PATCH 673/702] main/frames --- sh/main.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index e91efbf..cf5f767 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,4 +1,6 @@ -# constants +# ╭───────────╮ +# │ constants │ +# ╰───────────╯ SH_MAIN_NAME="main.sh" SH_NAME="sh" @@ -7,12 +9,16 @@ SH_ROOT="/etc/${SH_NAME}" SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" -# variables +# ╭───────────╮ +# │ variables │ +# ╰───────────╯ SH_SHELL="$(cat "/proc/${$}/comm")" SH_USER="${HOME}/${SH_NAME}" -# private +# ╭─────────╮ +# │ private │ +# ╰─────────╯ _sh_ifs_new() { SH_IFS="${IFS}" @@ -35,7 +41,9 @@ _sh_main_log() { fi } -# public +# ╭────────╮ +# │ public │ +# ╰────────╯ # find directory’s files by extension sh_find_extension() { @@ -109,7 +117,9 @@ sh_source_directory() { _sh_ifs_pop } -# main +# ╭──────╮ +# │ main │ +# ╰──────╯ # run initial steps sh_main() { From 75e7e2330d73daa714f2407e163ce92ea8c4cc4a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:13:51 +0100 Subject: [PATCH 674/702] rwx/main --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index cf5f767..acdb7a2 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -122,7 +122,7 @@ sh_source_directory() { # ╰──────╯ # run initial steps -sh_main() { +rwx_main() { # system root if ! sh_source_directory "${SH_ROOT}"; then _sh_main_log "Not a directory: ${SH_ROOT}" @@ -142,4 +142,4 @@ sh_main() { } # run main function -sh_main +rwx_main From 835f7339f37ead10416f0182ca7718d3b46b9dff Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:15:09 +0100 Subject: [PATCH 675/702] rwx/help --- sh/main.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index acdb7a2..8ad5695 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -76,7 +76,7 @@ sh_grep_functions() { } # output help message -sh_help() { +rwx_help() { sh_log \ "sh_… = shell functions" \ "a__… = aliases" \ @@ -137,7 +137,7 @@ rwx_main() { sh_shellcheck "${SH_ROOT}" # help sh_log - sh_help + rwx_help fi } From 68a4d518700e35466df98733acf833c3376775c6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:16:56 +0100 Subject: [PATCH 676/702] rwx/shellcheck --- sh/main.sh | 2 +- sh/shellcheck.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 8ad5695..92b9601 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -134,7 +134,7 @@ rwx_main() { if sh_shell_interactive; then # check sh_log - sh_shellcheck "${SH_ROOT}" + rwx_shellcheck_check "${SH_ROOT}" # help sh_log rwx_help diff --git a/sh/shellcheck.sh b/sh/shellcheck.sh index 7b04827..703b21d 100644 --- a/sh/shellcheck.sh +++ b/sh/shellcheck.sh @@ -1,4 +1,4 @@ -sh_shellcheck() { +rwx_shellcheck_check() { local root="${1}" local file module modules path file="$(mktemp)" From f25059d1593126cb82f859759fac71a2efc8a508 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:20:38 +0100 Subject: [PATCH 677/702] shfmt --- sh/main.sh | 5 ++++- sh/shellcheck.sh | 1 - sh/shfmt.sh | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 sh/shfmt.sh diff --git a/sh/main.sh b/sh/main.sh index 92b9601..7d85c49 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -132,7 +132,10 @@ rwx_main() { sh_source_directory "${SH_USER}" # run interactive extras if sh_shell_interactive; then - # check + # check format + sh_log + rwx_shfmt "${SH_ROOT}" + # check syntax sh_log rwx_shellcheck_check "${SH_ROOT}" # help diff --git a/sh/shellcheck.sh b/sh/shellcheck.sh index 703b21d..df2c02d 100644 --- a/sh/shellcheck.sh +++ b/sh/shellcheck.sh @@ -6,7 +6,6 @@ rwx_shellcheck_check() { _sh_ifs_new for module in ${modules}; do path="${root}/${module}" - shfmt --diff "${path}" echo ". \"${path}\"" >>"${file}" done _sh_ifs_pop diff --git a/sh/shfmt.sh b/sh/shfmt.sh new file mode 100644 index 0000000..107170b --- /dev/null +++ b/sh/shfmt.sh @@ -0,0 +1,4 @@ +rwx_shfmt_check() { + local root="${1}" + shfmt --diff "${root}" +} From 57da8c62123d4a89cef1c92a05143961f1416411 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:21:19 +0100 Subject: [PATCH 678/702] lint --- sh/{ => lint}/shellcheck.sh | 0 sh/{ => lint}/shfmt.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename sh/{ => lint}/shellcheck.sh (100%) rename sh/{ => lint}/shfmt.sh (100%) diff --git a/sh/shellcheck.sh b/sh/lint/shellcheck.sh similarity index 100% rename from sh/shellcheck.sh rename to sh/lint/shellcheck.sh diff --git a/sh/shfmt.sh b/sh/lint/shfmt.sh similarity index 100% rename from sh/shfmt.sh rename to sh/lint/shfmt.sh From 24a623bd6efca50076865678c9471d46d38f86d2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 17:46:09 +0100 Subject: [PATCH 679/702] fix --- sh/main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/main.sh b/sh/main.sh index 7d85c49..2611ebe 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -134,7 +134,7 @@ rwx_main() { if sh_shell_interactive; then # check format sh_log - rwx_shfmt "${SH_ROOT}" + rwx_shfmt_check "${SH_ROOT}" # check syntax sh_log rwx_shellcheck_check "${SH_ROOT}" From 1e5451f05992f68bb5cf81f858e9e95c60cec577 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:31:49 +0100 Subject: [PATCH 680/702] main/source --- sh/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 2611ebe..6376e03 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -91,7 +91,7 @@ sh_shell_interactive() { esac } -sh_source_directory() { +rwx_main_source() { local path="${1}" [ -d "${path}" ] || return 1 @@ -124,12 +124,12 @@ sh_source_directory() { # run initial steps rwx_main() { # system root - if ! sh_source_directory "${SH_ROOT}"; then + if ! rwx_main_source "${SH_ROOT}"; then _sh_main_log "Not a directory: ${SH_ROOT}" return 1 fi # user root - sh_source_directory "${SH_USER}" + rwx_main_source "${SH_USER}" # run interactive extras if sh_shell_interactive; then # check format From 32b5389786152824f0ac22bb045e3c6f8b981fe7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:46:52 +0100 Subject: [PATCH 681/702] main/log --- sh/main.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 6376e03..dbba6c3 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -31,7 +31,7 @@ _sh_ifs_pop() { unset SH_IFS } -_sh_main_log() { +_rwx_main_log() { if sh_shell_interactive; then [ ${#} -gt 0 ] || set -- "" local line @@ -99,11 +99,11 @@ rwx_main_source() { modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")" _sh_ifs_new count=0 - _sh_main_log "" \ + _rwx_main_log "" \ ". ${path}" for module in ${modules}; do count=$((count + 1)) - _sh_main_log "$(printf "%02d" "${count}") ${module%.sh}" + _rwx_main_log "$(printf "%02d" "${count}") ${module%.sh}" module="${path}/${module}" # shellcheck disable=SC1090 . "${module}" @@ -125,7 +125,7 @@ rwx_main_source() { rwx_main() { # system root if ! rwx_main_source "${SH_ROOT}"; then - _sh_main_log "Not a directory: ${SH_ROOT}" + _rwx_main_log "Not a directory: ${SH_ROOT}" return 1 fi # user root From f1192c0c58cbf4717de5d9e607df4e4d1dcf61fd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:48:21 +0100 Subject: [PATCH 682/702] shell/interactive --- sh/main.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index dbba6c3..b8ed82d 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -32,7 +32,7 @@ _sh_ifs_pop() { } _rwx_main_log() { - if sh_shell_interactive; then + if rwx_shell_interactive; then [ ${#} -gt 0 ] || set -- "" local line for line in "${@}"; do @@ -84,7 +84,7 @@ rwx_help() { } # test if active shell is in interactive mode -sh_shell_interactive() { +rwx_shell_interactive() { case "${-}" in *i*) ;; *) return 1 ;; @@ -131,7 +131,7 @@ rwx_main() { # user root rwx_main_source "${SH_USER}" # run interactive extras - if sh_shell_interactive; then + if rwx_shell_interactive; then # check format sh_log rwx_shfmt_check "${SH_ROOT}" From 04199bdfbb9be1bb9d5e7ddb602ee31773996620 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:55:34 +0100 Subject: [PATCH 683/702] rescue --- sh/rescue/common.sh | 14 +++++++------- sh/rescue/hetzner.sh | 4 ++-- sh/rescue/ovh.sh | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index d28591b..f2c9d10 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -1,4 +1,4 @@ -rescue_configure() { +rwx_rescue_configure() { local hostname="${1}" # apt / conf sh_apt_conf_write @@ -28,7 +28,7 @@ fr_FR.UTF-8 UTF-8 sh_apt_update } -rescue_install() { +rwx_rescue_install() { # update catalog sh_apt_update # disable frontend @@ -51,7 +51,7 @@ rescue_install() { "grub-efi-amd64-bin" } -rescue_upload() { +rwx_rescue_upload() { local host="${1}" local hostname="${2}" if [ -n "${hostname}" ]; then @@ -70,11 +70,11 @@ rescue_upload() { # call setup # TODO variable ssh "${user_host}" -- \ - ". \"${ENV}\" ; rescue_configure \"${hostname}\"" + ". \"${ENV}\" ; rwx_rescue_configure \"${hostname}\"" # create session ssh "${user_host}" -- byobu new-session -d # send keys - ssh "${user_host}" -- byobu send-keys "rescue_install" "C-m" + ssh "${user_host}" -- byobu send-keys "rwx_rescue_install" "C-m" # attach session mosh "${user_host}" -- byobu attach-session else @@ -83,11 +83,11 @@ rescue_upload() { fi } -rescue_wipe_1_zero() { +rwx_rescue_wipe_1_zero() { sh_fs_wipe "/dev/mapper/crypt" "512M" } -rescue_wipe_3_close() { +rwx_rescue_wipe_3_close() { umount "/media/boot" umount "/media/crypt" && cryptsetup luksClose "crypt" diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 8d4f56d..8fe73e3 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -1,4 +1,4 @@ -rescue_wipe_0_init_hetzner_8_8() { +rwx_rescue_wipe_0_init_hetzner_8_8() { local device set \ "/dev/sda" \ @@ -98,7 +98,7 @@ rescue_wipe_0_init_hetzner_8_8() { unset passphrase } -rescue_wipe_2_make_hetzner_8_8() { +rwx_rescue_wipe_2_make_hetzner_8_8() { local passphrase # close cryptsetup luksClose "crypt" diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index 0d3c860..c7d89c2 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -1,4 +1,4 @@ -rescue_wipe_0_init_ovh_vle2() { +rwx_rescue_wipe_0_init_ovh_vle2() { local device="/dev/sdb" local passphrase # read passphrase @@ -44,7 +44,7 @@ rescue_wipe_0_init_ovh_vle2() { unset passphrase } -rescue_wipe_2_make_ovh_vle2() { +rwx_rescue_wipe_2_make_ovh_vle2() { local device="/dev/sdb" local passphrase # crypt / close From 4ba9c94a4282a17b84ff3720266bc8b734c38663 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:56:59 +0100 Subject: [PATCH 684/702] gnome --- sh/gnome.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/gnome.sh b/sh/gnome.sh index ff15c10..c30e612 100644 --- a/sh/gnome.sh +++ b/sh/gnome.sh @@ -1,4 +1,4 @@ -sh_gnome_proxy() { +rwx_gnome_proxy() { local value case "${1}" in "on") value="manual" ;; @@ -7,7 +7,7 @@ sh_gnome_proxy() { gsettings set "org.gnome.system.proxy" "mode" "${value}" } -sh_gnome_workspaces_primary() { +rwx_gnome_workspaces_primary() { local bool local group="org.gnome.mutter" local name="workspaces-only-on-primary" From 7719b6a56269d9e354e84ff6fef26ccdb2a72d60 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:57:41 +0100 Subject: [PATCH 685/702] gpg --- sh/gpg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/gpg.sh b/sh/gpg.sh index 26a4e6e..a2b7f50 100644 --- a/sh/gpg.sh +++ b/sh/gpg.sh @@ -1,4 +1,4 @@ -sh_gpg_ssh_auth_sock() { +rwx_gpg_ssh_auth_sock() { local user_id user_id=$(id --user) if [ "${user_id}" -ne 0 ]; then @@ -9,4 +9,4 @@ sh_gpg_ssh_auth_sock() { fi } -sh_gpg_ssh_auth_sock +rwx_gpg_ssh_auth_sock From e811d73563fdf8b5f573a2e9b1255a66dc77713d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 18:59:56 +0100 Subject: [PATCH 686/702] fs --- sh/fs.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sh/fs.sh b/sh/fs.sh index 95965e2..ac46f6d 100644 --- a/sh/fs.sh +++ b/sh/fs.sh @@ -1,4 +1,4 @@ -sh_fs_make_btrfs() { +rwx_fs_make_btrfs() { local device="${1}" local label="${2}" local uuid="${3}" @@ -18,7 +18,7 @@ sh_fs_make_btrfs() { fi } -sh_fs_make_btrfs_swap() { +rwx_fs_make_btrfs_swap() { local path="${1}" local size="${2}" local uuid="${3}" @@ -36,7 +36,7 @@ sh_fs_make_btrfs_swap() { fi } -sh_fs_make_fat() { +rwx_fs_make_fat() { local device="${1}" local name="${2}" local volid="${3}" @@ -56,7 +56,7 @@ sh_fs_make_fat() { fi } -sh_fs_raid_create() { +rwx_fs_raid_create() { if [ -n "${4}" ]; then local name="${1}" local uuid="${2}" @@ -72,7 +72,7 @@ sh_fs_raid_create() { fi } -sh_fs_wipe() { +rwx_fs_wipe() { local device="${1}" local buffer="${2}" local count="${3}" @@ -93,7 +93,7 @@ sh_fs_wipe() { fi } -sh_fs_luks_format() { +rwx_fs_luks_format() { local passphrase="${1}" local device="${2}" local label="${3}" From 897a228614388e258a399145cea58beca492ec3e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:04:20 +0100 Subject: [PATCH 687/702] debian --- sh/debian.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sh/debian.sh b/sh/debian.sh index b544f08..88e8b01 100644 --- a/sh/debian.sh +++ b/sh/debian.sh @@ -1,14 +1,14 @@ -SH_DEBIAN_CODENAME="$( +RWX_DEBIAN_CODENAME="$( grep "VERSION_CODENAME" "/etc/os-release" | cut --delimiter "=" --fields "2" )" -sh_apt_clean() { +rwx_apt_clean() { apt-get \ clean } -sh_apt_conf_write() { +rwx_apt_conf_write() { printf "\ Acquire::AllowInsecureRepositories False; Acquire::AllowWeakRepositories False; @@ -22,55 +22,55 @@ Dpkg::Progress True; " >"/etc/apt/apt.conf.d/apt.conf" } -sh_apt_install_backports() { - sh_apt_install_target "${SH_DEBIAN_CODENAME}-backports" "${@}" +rwx_apt_install_backports() { + rwx_apt_install_target "${RWX_DEBIAN_CODENAME}-backports" "${@}" } -sh_apt_install_release() { - sh_apt_install_target "${SH_DEBIAN_CODENAME}" "${@}" +rwx_apt_install_release() { + rwx_apt_install_target "${RWX_DEBIAN_CODENAME}" "${@}" } -sh_apt_install_target() { +rwx_apt_install_target() { local target="${1}" shift local package for package in "${@}"; do - sh_log_info - sh_log_info "${package} ← ${target}" + rwx_log "" \ + "${package} ← ${target}" apt-get \ install \ --assume-yes \ --target-release "${target}" \ "${package}" - sh_apt_clean + rwx_apt_clean done } -sh_apt_sources_write() { +rwx_apt_sources_write() { printf "%s" "\ deb https://deb.debian.org/debian \ -${SH_DEBIAN_CODENAME} main non-free-firmware contrib non-free +${RWX_DEBIAN_CODENAME} main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${SH_DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free +${RWX_DEBIAN_CODENAME}-backports main non-free-firmware contrib non-free deb https://deb.debian.org/debian \ -${SH_DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free +${RWX_DEBIAN_CODENAME}-updates main non-free-firmware contrib non-free deb https://deb.debian.org/debian-security \ -${SH_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free +${RWX_DEBIAN_CODENAME}-security main non-free-firmware contrib non-free " >"/etc/apt/sources.list" } -sh_apt_update() { +rwx_apt_update() { apt-get \ update } -sh_apt_upgrade() { +rwx_apt_upgrade() { apt-get \ upgrade \ --assume-yes - sh_apt_clean + rwx_apt_clean } -sh_debian_frontend_disable() { +rwx_debian_frontend_disable() { export DEBIAN_FRONTEND="noninteractive" } From 1bae77cd6a902cf0e19daaaca4502c0ba2809e2d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:04:39 +0100 Subject: [PATCH 688/702] live --- sh/live.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/live.sh b/sh/live.sh index dc77ce5..7d82bfc 100644 --- a/sh/live.sh +++ b/sh/live.sh @@ -1,5 +1,5 @@ # remount read-only medium in read-write -sh_live_medium_remount() { +rwx_live_medium_remount() { mount \ -o "remount,rw" \ "/usr/lib/live/mount/medium" From 7b1e6b0fd5149d32292574e7d414f3b57ffae13f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:08:06 +0100 Subject: [PATCH 689/702] log --- sh/log.sh | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sh/log.sh b/sh/log.sh index 2be59e0..9b2ffc4 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -1,68 +1,68 @@ -SH_LOG_LEVEL_FATAL=0 -SH_LOG_LEVEL_ERROR=1 -SH_LOG_LEVEL_WARN=2 -SH_LOG_LEVEL_INFO=3 -SH_LOG_LEVEL_DEBUG=4 -SH_LOG_LEVEL_TRACE=5 +RWX_LOG_LEVEL_FATAL=0 +RWX_LOG_LEVEL_ERROR=1 +RWX_LOG_LEVEL_WARN=2 +RWX_LOG_LEVEL_INFO=3 +RWX_LOG_LEVEL_DEBUG=4 +RWX_LOG_LEVEL_TRACE=5 -SH_LOG_LEVEL=${SH_LOG_LEVEL_INFO} +RWX_LOG_LEVEL=${RWX_LOG_LEVEL_INFO} -sh_log() { sh_log_info "${@}"; } +rwx_log() { rwx_log_info "${@}"; } -sh_log_debug() { - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_DEBUG}" ]; then - _sh_log "[DEBUG]" "${@}" +rwx_log_debug() { + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_DEBUG}" ]; then + _rwx_log "[DEBUG]" "${@}" fi } -sh_log_error() { +rwx_log_error() { local code="${1}" shift - [ -n "${code}" ] || sh_log_fatal 1 "No error code" - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_ERROR}" ]; then - _sh_log "[ERROR]" "${@}" >&2 + [ -n "${code}" ] || rwx_log_fatal 1 "No error code" + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_ERROR}" ]; then + _rwx_log "[ERROR]" "${@}" >&2 return "${code}" fi } -sh_log_fatal() { +rwx_log_fatal() { local code="${1}" shift - [ -n "${code}" ] || sh_log_fatal 1 "No error code" - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_FATAL}" ]; then - _sh_log "[FATAL]" "${@}" >&2 + [ -n "${code}" ] || rwx_log_fatal 1 "No error code" + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_FATAL}" ]; then + _rwx_log "[FATAL]" "${@}" >&2 exit "${code}" fi } -sh_log_info() { - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_INFO}" ]; then - _sh_log "" "${@}" +rwx_log_info() { + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_INFO}" ]; then + _rwx_log "" "${@}" fi } -sh_log_trace() { - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_TRACE}" ]; then - _sh_log "[TRACE]" "${@}" +rwx_log_trace() { + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_TRACE}" ]; then + _rwx_log "[TRACE]" "${@}" fi } -sh_log_warn() { - if [ "${SH_LOG_LEVEL}" -ge "${SH_LOG_LEVEL_WARN}" ]; then - _sh_log "[ WARN]" "${@}" +rwx_log_warn() { + if [ "${RWX_LOG_LEVEL}" -ge "${RWX_LOG_LEVEL_WARN}" ]; then + _rwx_log "[ WARN]" "${@}" fi } -_sh_log() { +_rwx_log() { local prefix="${1}" shift [ ${#} -gt 0 ] || set -- "" local line for line in "${@}"; do if [ -n "${prefix}" ]; then - _sh_main_log "${prefix} ${line}" + _rwx_main_log "${prefix} ${line}" else - _sh_main_log "${line}" + _rwx_main_log "${line}" fi done } From d590bfda0c2bca688b5f6f1d8a58e3f0cf7548ce Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:14:38 +0100 Subject: [PATCH 690/702] shell --- sh/shell.sh | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/sh/shell.sh b/sh/shell.sh index 3a76cb6..a5f1b99 100644 --- a/sh/shell.sh +++ b/sh/shell.sh @@ -1,4 +1,4 @@ -_sh_shell_color() { +_rwx_shell_color() { local code="${1}" case "${SH_SHELL}" in "bash") @@ -19,18 +19,18 @@ _sh_shell_color() { ;; esac } -SH_COLOR_BROWN="$(_sh_shell_color 33)" -SH_COLOR_CYAN="$(_sh_shell_color 36)" -SH_COLOR_DEFAULT="$(_sh_shell_color)" -SH_COLOR_GREEN="$(_sh_shell_color 31)" -SH_COLOR_MAGENTA="$(_sh_shell_color 35)" -SH_COLOR_RED="$(_sh_shell_color 32)" +RWX_COLOR_BROWN="$(_rwx_shell_color 33)" +RWX_COLOR_CYAN="$(_rwx_shell_color 36)" +RWX_COLOR_DEFAULT="$(_rwx_shell_color)" +RWX_COLOR_GREEN="$(_rwx_shell_color 31)" +RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" +RWX_COLOR_RED="$(_rwx_shell_color 32)" -sh_shell_configure() { +rwx_shell_configure() { [ -n "${ENV}" ] || ENV="${SH_MAIN}" export ENV # prompt - PS1="\$(sh_shell_prompt \${?})" + PS1="\$(rwx_shell_prompt \${?})" PS2="├ " # specific case "${SH_SHELL}" in @@ -60,9 +60,9 @@ sh_shell_configure() { *) ;; esac } -sh_shell_configure +rwx_shell_configure -sh_shell_prompt() { +rwx_shell_prompt() { local date host id local code="${1}" date="$(date +%H:%M:%S)" @@ -74,50 +74,50 @@ sh_shell_prompt() { local view="└ " # code if [ "${code}" -ne 0 ]; then - view="${view}${SH_COLOR_GREEN}" + view="${view}${RWX_COLOR_GREEN}" else - view="${view}${SH_COLOR_RED}" + view="${view}${RWX_COLOR_RED}" fi view="${view}${code}" # date - view="${view}${SH_COLOR_DEFAULT} @ " - view="${view}${SH_COLOR_BROWN}${date}" + view="${view}${RWX_COLOR_DEFAULT} @ " + view="${view}${RWX_COLOR_BROWN}${date}" # git if command -v "__git_ps1" >"/dev/null"; then git="$(__git_ps1)" if [ -n "${git}" ]; then - view="${view}${SH_COLOR_DEFAULT} –${SH_COLOR_MAGENTA}${git}" + view="${view}${RWX_COLOR_DEFAULT} –${RWX_COLOR_MAGENTA}${git}" fi fi # new view="${view}\\n" # path - view="${view}${SH_COLOR_CYAN}${path}" + view="${view}${RWX_COLOR_CYAN}${path}" # new view="${view}\\n" # frame - view="${view}${SH_COLOR_DEFAULT}┌ " + view="${view}${RWX_COLOR_DEFAULT}┌ " # user if [ "${id}" -eq 0 ]; then - view="${view}${SH_COLOR_GREEN}" + view="${view}${RWX_COLOR_GREEN}" else - view="${view}${SH_COLOR_RED}" + view="${view}${RWX_COLOR_RED}" fi view="${view}${user}" # host - view="${view}${SH_COLOR_DEFAULT} @ " - view="${view}${SH_COLOR_BROWN}${host}" + view="${view}${RWX_COLOR_DEFAULT} @ " + view="${view}${RWX_COLOR_BROWN}${host}" # new view="${view}\\n" # prompt - view="${view}${SH_COLOR_DEFAULT}${PS2}" + view="${view}${RWX_COLOR_DEFAULT}${PS2}" # print printf "%b" "${view}" } -sh_shell_setup() { +rwx_shell_setup() { # shell - echo "export ENV=\"${ENV}\"" >"/etc/profile.d/sh.sh" + echo "export ENV=\"${ENV}\"" >"/etc/profile.d/${SH_NAME}.sh" # bash local file="/etc/bash.bashrc" rm --force --recursive "${file}" From 4335005aace161cb442aa03fac6be330151d34ef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:18:30 +0100 Subject: [PATCH 691/702] util --- sh/util.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sh/util.sh b/sh/util.sh index 3f1c614..7d9cc3f 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -1,10 +1,10 @@ -sh_list_block_devices() { +rwx_list_block_devices() { lsblk \ --noempty \ --output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS" } -sh_not() { +rwx_not() { case "${1}" in "false") echo "true" ;; "true") echo "false" ;; @@ -12,11 +12,11 @@ sh_not() { esac } -sh_read_passphrase() { - sh_read_secret "PassPhrase: " +rwx_read_passphrase() { + rwx_read_secret "PassPhrase: " } -sh_read_secret() { +rwx_read_secret() { local prompt="${1}" local secret printf "%s" "${prompt}" 1>&2 @@ -28,10 +28,10 @@ sh_read_secret() { unset secret } -sh_warn_wipe() { +rwx_warn_wipe() { local tmp - sh_list_block_devices + rwx_list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r tmp - sh_log_trace "${tmp}" + rwx_log_trace "${tmp}" } From 903faba54ed3121005cd3f5cbe32b0e6f22f48a1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:25:49 +0100 Subject: [PATCH 692/702] main --- sh/main.sh | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index b8ed82d..694b38b 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -16,19 +16,25 @@ SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" SH_SHELL="$(cat "/proc/${$}/comm")" SH_USER="${HOME}/${SH_NAME}" +# ╭──────────╮ +# │ internal │ +# ╰──────────╯ + +# _RWX_IFS + # ╭─────────╮ # │ private │ # ╰─────────╯ -_sh_ifs_new() { - SH_IFS="${IFS}" +rwx_ifs_set() { + _RWX_IFS="${IFS}" IFS=" " } -_sh_ifs_pop() { - IFS="${SH_IFS}" - unset SH_IFS +rwx_ifs_unset() { + IFS="${_RWX_IFS}" + unset RWX_IFS } _rwx_main_log() { @@ -46,7 +52,7 @@ _rwx_main_log() { # ╰────────╯ # find directory’s files by extension -sh_find_extension() { +rwx_find_extension() { local extension="${1}" local root="${2}" local file="${3}" @@ -64,12 +70,12 @@ sh_find_extension() { } # find directory’s sh files -sh_find_sh() { - sh_find_extension "sh" "${@}" +rwx_find_sh() { + rwx_find_extension "sh" "${@}" } # get functions from file -sh_grep_functions() { +rwx_grep_functions() { local file="${1}" grep "()" "${file}" | cut --delimiter "(" --fields 1 @@ -77,10 +83,10 @@ sh_grep_functions() { # output help message rwx_help() { - sh_log \ - "sh_… = shell functions" \ - "a__… = aliases" \ - "u__… = user" + rwx_log \ + "rwx_… = functions" \ + " a__… = aliases" \ + " u__… = user" } # test if active shell is in interactive mode @@ -96,8 +102,8 @@ rwx_main_source() { [ -d "${path}" ] || return 1 local cmd count module modules - modules="$(sh_find_sh "${path}" "${SH_MAIN_NAME}")" - _sh_ifs_new + modules="$(rwx_find_sh "${path}" "${SH_MAIN_NAME}")" + rwx_ifs_set count=0 _rwx_main_log "" \ ". ${path}" @@ -107,14 +113,14 @@ rwx_main_source() { module="${path}/${module}" # shellcheck disable=SC1090 . "${module}" - cmd="$(sh_grep_functions "${module}")" + cmd="$(rwx_grep_functions "${module}")" if [ -n "${cmd}" ]; then [ -n "${CMD}" ] && CMD="${CMD} " CMD="${CMD}${cmd}" fi done - _sh_ifs_pop + rwx_ifs_unset } # ╭──────╮ @@ -133,13 +139,13 @@ rwx_main() { # run interactive extras if rwx_shell_interactive; then # check format - sh_log + rwx_log rwx_shfmt_check "${SH_ROOT}" # check syntax - sh_log + rwx_log rwx_shellcheck_check "${SH_ROOT}" # help - sh_log + rwx_log rwx_help fi } From de22cafbd0c3d630235f7987ad59093b8416be7a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:41:07 +0100 Subject: [PATCH 693/702] main --- sh/main.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 694b38b..b2dd223 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -2,19 +2,19 @@ # │ constants │ # ╰───────────╯ -SH_MAIN_NAME="main.sh" -SH_NAME="sh" +RWX_MAIN_FILE_NAME="main.sh" +RWX_NAME="sh" -SH_ROOT="/etc/${SH_NAME}" +RWX_ROOT_SYSTEM="/etc/${RWX_NAME}" -SH_MAIN="${SH_ROOT}/${SH_MAIN_NAME}" +RWX_MAIN="${RWX_ROOT_SYSTEM}/${RWX_MAIN_FILE_NAME}" # ╭───────────╮ # │ variables │ # ╰───────────╯ -SH_SHELL="$(cat "/proc/${$}/comm")" -SH_USER="${HOME}/${SH_NAME}" +RWX_SHELL="$(cat "/proc/${$}/comm")" +RWX_ROOT_USER="${HOME}/${RWX_NAME}" # ╭──────────╮ # │ internal │ @@ -102,7 +102,7 @@ rwx_main_source() { [ -d "${path}" ] || return 1 local cmd count module modules - modules="$(rwx_find_sh "${path}" "${SH_MAIN_NAME}")" + modules="$(rwx_find_sh "${path}" "${RWX_MAIN_FILE_NAME}")" rwx_ifs_set count=0 _rwx_main_log "" \ @@ -130,20 +130,20 @@ rwx_main_source() { # run initial steps rwx_main() { # system root - if ! rwx_main_source "${SH_ROOT}"; then - _rwx_main_log "Not a directory: ${SH_ROOT}" + if ! rwx_main_source "${RWX_ROOT_SYSTEM}"; then + _rwx_main_log "Not a directory: ${RWX_ROOT_SYSTEM}" return 1 fi # user root - rwx_main_source "${SH_USER}" + rwx_main_source "${RWX_ROOT_USER}" # run interactive extras if rwx_shell_interactive; then # check format rwx_log - rwx_shfmt_check "${SH_ROOT}" + rwx_shfmt_check "${RWX_ROOT_SYSTEM}" # check syntax rwx_log - rwx_shellcheck_check "${SH_ROOT}" + rwx_shellcheck_check "${RWX_ROOT_SYSTEM}" # help rwx_log rwx_help From ecff8f16bc3cd12eb0f412f32cd12af75c6ab7cc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:43:06 +0100 Subject: [PATCH 694/702] sc/ifs --- sh/lint/shellcheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/lint/shellcheck.sh b/sh/lint/shellcheck.sh index df2c02d..61ef8d6 100644 --- a/sh/lint/shellcheck.sh +++ b/sh/lint/shellcheck.sh @@ -3,12 +3,12 @@ rwx_shellcheck_check() { local file module modules path file="$(mktemp)" modules="$(sh_find_sh "${root}")" - _sh_ifs_new + rwx_ifs_set for module in ${modules}; do path="${root}/${module}" echo ". \"${path}\"" >>"${file}" done - _sh_ifs_pop + rwx_ifs_unset shellcheck \ --check-sourced \ --enable "all" \ From dc66287ed1714973f8def7286eadf5dcea3033db Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:45:58 +0100 Subject: [PATCH 695/702] alias/overlay --- sh/alias/overlay.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sh/alias/overlay.sh b/sh/alias/overlay.sh index 307c470..6357655 100644 --- a/sh/alias/overlay.sh +++ b/sh/alias/overlay.sh @@ -3,7 +3,7 @@ a__overlay_bind_mount() { local directory for directory in "dev" "dev/pts" "proc" "sys"; do if ! mount --bind "/${directory}" "overlay/mount/${directory}"; then - sh_log_error "Unable to bind mount directory: ${directory}" + rwx_log_error "Unable to bind mount directory: ${directory}" return 1 fi done @@ -14,7 +14,7 @@ a__overlay_bind_unmount() { local directory for directory in "sys" "proc" "dev/pts" "dev"; do if ! umount --lazy "overlay/mount/${directory}"; then - sh_log_error "Unable to bind unmount directory: ${directory}" + rwx_log_error "Unable to bind unmount directory: ${directory}" return 1 fi done @@ -47,36 +47,36 @@ orm() { a__overlay_root_mount "${@}"; } a__overlay_root_mount() { local root="${1}" if [ -z "${root}" ]; then - sh_log_error "No root target directory" + rwx_log_error "No root target directory" return 1 fi root="$(realpath "${root}")" if ! mkdir "overlay"; then - sh_log_error "Unable to make overlay directory" + rwx_log_error "Unable to make overlay directory" return 2 fi ( if ! cd "overlay"; then - sh_log_error "Unable to move into overlay directory" + rwx_log_error "Unable to move into overlay directory" return 3 fi local directory for directory in "lower" "upper" "work" "mount"; do if ! mkdir --parents "${directory}"; then - sh_log_error "Unable to make directory: ${directory}" + rwx_log_error "Unable to make directory: ${directory}" return 4 fi done local file="${root}/filesystem.squashfs" if ! mount "${file}" "lower"; then - sh_log_error "Unable to lower mount: ${file}" + rwx_log_error "Unable to lower mount: ${file}" return 5 fi if ! mount \ -o "lowerdir=lower,upperdir=upper,workdir=work" \ -t "overlay" \ "overlay" "mount"; then - sh_log_error "Unable to overlay mount" + rwx_log_error "Unable to overlay mount" return 6 fi ) @@ -106,35 +106,35 @@ oru() { a__overlay_root_unmount "${@}"; } a__overlay_root_unmount() { ( if ! cd "overlay"; then - sh_log_error "Unable to move into overlay directory" + rwx_log_error "Unable to move into overlay directory" return 1 fi if ! umount "mount"; then - sh_log_error "Unable to unmount mount directory" + rwx_log_error "Unable to unmount mount directory" return 2 fi if ! rmdir "mount"; then - sh_log_error "Unable to remove mount directory" + rwx_log_error "Unable to remove mount directory" return 3 fi local directory for directory in "upper" "work"; do if ! rm --force --recursive "${directory}"; then - sh_log_error "Unable to remove directory: ${directory}" + rwx_log_error "Unable to remove directory: ${directory}" return 4 fi done if ! umount "lower"; then - sh_log_error "Unable to unmount lower directory" + rwx_log_error "Unable to unmount lower directory" return 5 fi if ! rmdir "lower"; then - sh_log_error "Unable to remove lower directory" + rwx_log_error "Unable to remove lower directory" return 6 fi ) if ! rmdir "overlay"; then - sh_log_error "Unable to remove overlay directory" + rwx_log_error "Unable to remove overlay directory" return 7 fi } From a0d487f473721e10dedc74de2de07a4000746148 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:51:23 +0100 Subject: [PATCH 696/702] rescue/common --- sh/rescue/common.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sh/rescue/common.sh b/sh/rescue/common.sh index f2c9d10..4e2684a 100644 --- a/sh/rescue/common.sh +++ b/sh/rescue/common.sh @@ -1,9 +1,9 @@ rwx_rescue_configure() { local hostname="${1}" # apt / conf - sh_apt_conf_write + rwx_apt_conf_write # apt / sources - sh_apt_sources_write + rwx_apt_sources_write # bash / rc main_link_bashrc mv "${HOME}/.bashrc" "${HOME}/.bashrc.old" @@ -17,26 +17,26 @@ fr_FR.UTF-8 UTF-8 # generate locales locale-gen # update catalog - sh_apt_update + rwx_apt_update # disable frontend - sh_debian_frontend_disable + rwx_debian_frontend_disable # install backports - sh_apt_install_backports "tmux" + rwx_apt_install_backports "tmux" # install packages - sh_apt_install_release "apt-file" "mosh" "screen" "byobu" + rwx_apt_install_release "apt-file" "mosh" "screen" "byobu" # update catalog - sh_apt_update + rwx_apt_update } rwx_rescue_install() { # update catalog - sh_apt_update + rwx_apt_update # disable frontend - sh_debian_frontend_disable + rwx_debian_frontend_disable # upgrade packages - sh_apt_upgrade + rwx_apt_upgrade # install packages - sh_apt_install_release \ + rwx_apt_install_release \ "man-db" \ "dmidecode" "efibootmgr" "lshw" "pciutils" "usbutils" \ "parted" "mdadm" "cryptsetup-bin" "lvm2" \ @@ -45,7 +45,7 @@ rwx_rescue_install() { "exa" "lf" "ncdu" "nnn" "ranger" "tree" \ "file" "htop" "iotop" "ipcalc" "libdigest-sha3-perl" "lsof" # install backports - sh_apt_install_backports \ + rwx_apt_install_backports \ "grub-pc-bin" \ \ "grub-efi-amd64-bin" @@ -84,7 +84,7 @@ rwx_rescue_upload() { } rwx_rescue_wipe_1_zero() { - sh_fs_wipe "/dev/mapper/crypt" "512M" + rwx_fs_wipe "/dev/mapper/crypt" "512M" } rwx_rescue_wipe_3_close() { From 4d64db0b70688e2fe494378e3709d2f9aa576b88 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:53:27 +0100 Subject: [PATCH 697/702] rescue/ovh --- sh/rescue/ovh.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sh/rescue/ovh.sh b/sh/rescue/ovh.sh index c7d89c2..b4120e2 100644 --- a/sh/rescue/ovh.sh +++ b/sh/rescue/ovh.sh @@ -2,9 +2,9 @@ rwx_rescue_wipe_0_init_ovh_vle2() { local device="/dev/sdb" local passphrase # read passphrase - passphrase="$(sh_read_passphrase)" + passphrase="$(rwx_read_passphrase)" # warn - sh_warn_wipe "${device}" + rwx_warn_wipe "${device}" # parted --script "${device}" \ mktable gpt \ @@ -16,27 +16,27 @@ rwx_rescue_wipe_0_init_ovh_vle2() { mkpart bios 1 2 \ set 4 bios_grub on # bios / wipe - sh_fs_wipe "${device}4" + rwx_fs_wipe "${device}4" # esp / wipe - sh_fs_wipe "${device}3" "1M" + rwx_fs_wipe "${device}3" "1M" # esp / format - sh_fs_make_fat "${device}3" "esp" "00000001" + rwx_fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp" # boot / wipe - sh_fs_wipe "${device}2" "1G" 1 + rwx_fs_wipe "${device}2" "1G" 1 # boot / format - sh_fs_make_btrfs "${device}2" "boot" \ + rwx_fs_make_btrfs "${device}2" "boot" \ "00000000-0000-0000-0000-00000000000b" # boot / mount mkdir --parents "/media/boot" mount --options "autodefrag,compress-force=zstd" \ "${device}2" "/media/boot" # crypt / wipe - sh_fs_wipe "${device}1" "1G" 1 + rwx_fs_wipe "${device}1" "1G" 1 # crypt / encrypt - sh_fs_luks_format "${passphrase}" "${device}1" + rwx_fs_luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" @@ -50,22 +50,22 @@ rwx_rescue_wipe_2_make_ovh_vle2() { # crypt / close cryptsetup luksClose "crypt" # read passphrase - passphrase="$(sh_read_passphrase)" + passphrase="$(rwx_read_passphrase)" # crypt / encrypt - sh_fs_luks_format "${passphrase}" "${device}1" + rwx_fs_luks_format "${passphrase}" "${device}1" # crypt / open echo "${passphrase}" | cryptsetup luksOpen "${device}1" "crypt" # passphrase unset passphrase # crypt / format - sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + rwx_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ "00000000-0000-0000-0000-00000000000c" # crypt / mount mkdir --parents "/media/crypt" mount --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # crypt / swap - sh_fs_make_btrfs_swap "/media/crypt/swap" "4g" \ + rwx_fs_make_btrfs_swap "/media/crypt/swap" "4g" \ "00000000-0000-0000-0000-000000000005" } From dda61e2594e9912e5b7580ffae68846f356e4fad Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:55:33 +0100 Subject: [PATCH 698/702] rescue/hetzner --- sh/rescue/hetzner.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 8fe73e3..47e8304 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -7,9 +7,9 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { local number local passphrase # read passphrase - passphrase="$(sh_read_passphrase)" + passphrase="$(rwx_read_passphrase)" # warn - sh_warn_wipe "${@}" + rwx_warn_wipe "${@}" # number=0 for device in "${@}"; do @@ -34,7 +34,7 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}4" # wipe bios - sh_fs_wipe "${device}4" + rwx_fs_wipe "${device}4" done # number=0 @@ -43,8 +43,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}3" # format esp - sh_fs_wipe "${device}3" "1M" - sh_fs_make_fat "${device}3" "esp-${number}" "0000000${number}" + rwx_fs_wipe "${device}3" "1M" + rwx_fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" mount "${device}3" "/media/esp/${number}" @@ -56,17 +56,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}2" # wipe boot - sh_fs_wipe "${device}2" "1G" 1 + rwx_fs_wipe "${device}2" "1G" 1 done # members="" for device in "${@}"; do members="${members} ${device}2" done - sh_fs_raid_create \ + rwx_fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # - sh_fs_make_btrfs "/dev/md/boot" "boot" \ + rwx_fs_make_btrfs "/dev/md/boot" "boot" \ "00000000-0000-0000-0000-00000000000b" # mount boot mkdir --parents "/media/boot" @@ -80,17 +80,17 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { echo echo "#${number}: ${device}1" # wipe crypt head - sh_fs_wipe "${device}1" "1G" 1 + rwx_fs_wipe "${device}1" "1G" 1 done # members="" for device in "${@}"; do members="${members} ${device}1" done - sh_fs_raid_create \ + rwx_fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt - sh_fs_luks_format "${passphrase}" "/dev/md/crypt" + rwx_fs_luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" @@ -103,9 +103,9 @@ rwx_rescue_wipe_2_make_hetzner_8_8() { # close cryptsetup luksClose "crypt" # read passphrase - passphrase="$(sh_read_passphrase)" + passphrase="$(rwx_read_passphrase)" # encrypt - sh_fs_luks_format "${passphrase}" "/dev/md/crypt" + rwx_fs_luks_format "${passphrase}" "/dev/md/crypt" # open echo "${passphrase}" | cryptsetup luksOpen "/dev/md/crypt" "crypt" @@ -120,6 +120,6 @@ rwx_rescue_wipe_2_make_hetzner_8_8() { --options "autodefrag,compress-force=zstd" \ "/dev/mapper/crypt" "/media/crypt" # make swap file - sh_fs_make_btrfs_swap "/media/crypt/swap" "64g" \ + rwx_fs_make_btrfs_swap "/media/crypt/swap" "64g" \ "00000000-0000-0000-0000-000000000005" } From a56aa8124f557ab70ab0b4ecbd43dc49de3263e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:58:07 +0100 Subject: [PATCH 699/702] gnome --- sh/gnome.sh | 8 ++++---- sh/rescue/hetzner.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sh/gnome.sh b/sh/gnome.sh index c30e612..11831fb 100644 --- a/sh/gnome.sh +++ b/sh/gnome.sh @@ -14,11 +14,11 @@ rwx_gnome_workspaces_primary() { local var="${group}/${name}" # get bool="$(gsettings get "${group}" "${name}")" - sh_log_debug "${var}: ${bool}" + rwx_log_debug "${var}: ${bool}" # not - bool="$(sh_not "${bool}")" - sh_log_debug "bool: ${bool}" + bool="$(rwx_not "${bool}")" + rwx_log_debug "bool: ${bool}" # set gsettings set "${group}" "${name}" "${bool}" - sh_log_info "${var}: ${bool}" + rwx_log_info "${var}: ${bool}" } diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 47e8304..9d22847 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -112,7 +112,7 @@ rwx_rescue_wipe_2_make_hetzner_8_8() { # passphrase unset passphrase # format crypt - sh_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ + rwx_fs_make_btrfs "/dev/mapper/crypt" "crypt" \ "00000000-0000-0000-0000-00000000000c" # mount crypt mkdir --parents "/media/crypt" From 2f686e3512985b29d4416ddc056d0e1adebf0764 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 19:58:38 +0100 Subject: [PATCH 700/702] lint/shellcheck --- sh/lint/shellcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/lint/shellcheck.sh b/sh/lint/shellcheck.sh index 61ef8d6..11b5b0d 100644 --- a/sh/lint/shellcheck.sh +++ b/sh/lint/shellcheck.sh @@ -2,7 +2,7 @@ rwx_shellcheck_check() { local root="${1}" local file module modules path file="$(mktemp)" - modules="$(sh_find_sh "${root}")" + modules="$(rwx_find_sh "${root}")" rwx_ifs_set for module in ${modules}; do path="${root}/${module}" From c3240b8b154fc33f4e72a6d0e7dcb53908faebc4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 20:23:01 +0100 Subject: [PATCH 701/702] =?UTF-8?q?=E2=88=92cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cs | 82 ---------------------------------------------------------- cs.old | 82 ---------------------------------------------------------- 2 files changed, 164 deletions(-) delete mode 100755 cs delete mode 100755 cs.old diff --git a/cs b/cs deleted file mode 100755 index bd9402c..0000000 --- a/cs +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/env bash -FILE="$(realpath "${BASH_SOURCE[0]}")" -NAME="$(basename "${FILE}")" - -ACTION_OPEN='open' -ACTION_CLOSE='close' - -CONTAINERS_DIRECTORY="/data/home/user/crypt" - -CONTAINERS_MAP_DIRECTORY='/dev/mapper' -CONTAINERS_MOUNT_DIRECTORY='/media' - -function main { -local action="${1}" -local pass_phrase -local container -local container_name -local container_file -local container_map_file -local container_mount_directory - -case "${action}" in - "${ACTION_OPEN}"|"${ACTION_CLOSE}") - shift - if [ "${1}" ]; then - if [ "${action}" == "${ACTION_OPEN}" ]; then - echo -n 'PassPhrase: ' - read -r -s pass_phrase - echo - fi - for container in "${@}"; do - echo - case "${container}" in - 'p') container_name='private' ;; - 's') container_name='sensitive' ;; - 'w') container_name='work' ;; - *) container_name="${container}" ;; - esac - container_file="${CONTAINERS_DIRECTORY}/${container_name}" - if [ -f "${container_file}" ]; then - container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}" - container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}" - case "${action}" in - "${ACTION_OPEN}") - echo "${container_file} → ${container_map_file}" - echo "${pass_phrase}" \ - | cryptsetup luksOpen "${container_file}" "${container_name}" - if [ ${?} -eq 0 ]; then - mkdir --parents "${container_mount_directory}" - echo "${container_map_file} → ${container_mount_directory}" - mount "${container_map_file}" "${container_mount_directory}" - fi - ;; - "${ACTION_CLOSE}") - echo "${container_map_file} ← ${container_mount_directory}" - if umount "${container_map_file}"; then - rmdir --ignore-fail-on-non-empty "${container_mount_directory}" - echo "${container_file} ← ${container_map_file}" - cryptsetup luksClose "${container_name}" - fi - ;; - esac - else - echo 'This path does not point to a file!' - fi - done - else - echo 'No container name provided!' - fi - ;; - *) - echo 'Usage:' - echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]" - echo - echo 'p = private' - echo 's = sensitive' - echo 'w = work' - ;; -esac -} - -main "${@}" diff --git a/cs.old b/cs.old deleted file mode 100755 index bd9402c..0000000 --- a/cs.old +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/env bash -FILE="$(realpath "${BASH_SOURCE[0]}")" -NAME="$(basename "${FILE}")" - -ACTION_OPEN='open' -ACTION_CLOSE='close' - -CONTAINERS_DIRECTORY="/data/home/user/crypt" - -CONTAINERS_MAP_DIRECTORY='/dev/mapper' -CONTAINERS_MOUNT_DIRECTORY='/media' - -function main { -local action="${1}" -local pass_phrase -local container -local container_name -local container_file -local container_map_file -local container_mount_directory - -case "${action}" in - "${ACTION_OPEN}"|"${ACTION_CLOSE}") - shift - if [ "${1}" ]; then - if [ "${action}" == "${ACTION_OPEN}" ]; then - echo -n 'PassPhrase: ' - read -r -s pass_phrase - echo - fi - for container in "${@}"; do - echo - case "${container}" in - 'p') container_name='private' ;; - 's') container_name='sensitive' ;; - 'w') container_name='work' ;; - *) container_name="${container}" ;; - esac - container_file="${CONTAINERS_DIRECTORY}/${container_name}" - if [ -f "${container_file}" ]; then - container_map_file="${CONTAINERS_MAP_DIRECTORY}/${container_name}" - container_mount_directory="${CONTAINERS_MOUNT_DIRECTORY}/${container_name}" - case "${action}" in - "${ACTION_OPEN}") - echo "${container_file} → ${container_map_file}" - echo "${pass_phrase}" \ - | cryptsetup luksOpen "${container_file}" "${container_name}" - if [ ${?} -eq 0 ]; then - mkdir --parents "${container_mount_directory}" - echo "${container_map_file} → ${container_mount_directory}" - mount "${container_map_file}" "${container_mount_directory}" - fi - ;; - "${ACTION_CLOSE}") - echo "${container_map_file} ← ${container_mount_directory}" - if umount "${container_map_file}"; then - rmdir --ignore-fail-on-non-empty "${container_mount_directory}" - echo "${container_file} ← ${container_map_file}" - cryptsetup luksClose "${container_name}" - fi - ;; - esac - else - echo 'This path does not point to a file!' - fi - done - else - echo 'No container name provided!' - fi - ;; - *) - echo 'Usage:' - echo "${NAME} [${ACTION_OPEN}|${ACTION_CLOSE}] [p] [s] [w]" - echo - echo 'p = private' - echo 's = sensitive' - echo 'w = work' - ;; -esac -} - -main "${@}" From 377acbd817ce94e7ffad42bd39962220c5590ce3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 21:04:02 +0100 Subject: [PATCH 702/702] =?UTF-8?q?=E2=88=92readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 readme.md diff --git a/readme.md b/readme.md deleted file mode 100644 index cbcd2bc..0000000 --- a/readme.md +++ /dev/null @@ -1,12 +0,0 @@ -# SH - -## Tasks - -* [ ] git switch signing commits & tags -* [ ] shellcheck & shfmt -* [ ] python tools -* [ ] log -* [ ] hetzner -* [ ] apt - * [ ] apt-file search | grep -* [ ] ffmpeg