Remaniement : ré-écriture de updateall

This commit is contained in:
Hippolyte Chauvin 2023-06-04 19:38:42 +02:00
parent 05bd37c8e4
commit 8e59d066dc
5 changed files with 27 additions and 20 deletions

42
bin/updateall Executable file → Normal file
View file

@ -1,28 +1,32 @@
#!/bin/bash #!/bin/bash
# Variable # Variables
commands_d="${HOME}/.local/share/updateall/commands.d" realpath="$(readlink -f "$0")"
# Function # cd
# Create a clear separator, adapts to the screen size cd "$(dirname "$realpath")/../share/$(basename "$realpath")" || exit
function separator { unset realpath
local separator=""
local name="$1" ; shift # Fonction pour fabriquer une ligne de la longueur d'un tiers du terminal
local char="${1:-=}"; shift makeline() {
(( cols = $(tput cols) / 3 )) local cols line
cols="$(($(tput cols) / 3))"
while [[ ${#separator} -le "$cols" ]]; do while [ "${#line}" -lt "$cols" ]; do
separator+="$char" line="${line}${1}"
done done
printf %s "$line"
printf '\n%s\n\t%s\n%s\n' "$separator" "$name" "$separator"
} }
# Loop # Fonction pour afficher un séparateur
for pm in "${commands_d}/"*; do separator() {
separator "$(basename "$pm")" local line
# shellcheck source=/dev/null line="$(makeline '=')"
source "$pm" printf '\n%s\n\t%s\n%s\n' "$line" "$*" "$line"
}
# Procédure principale
for i in ./commands.d/*; do
separator "$(basename "$i")"
"$i"
done done

View file

@ -1,3 +1,4 @@
#!/bin/sh
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get autoremove sudo apt-get autoremove

View file

@ -1,3 +1,3 @@
#!/bin/sh
sudo docker images --format '{{.Repository}}' | xargs -L 1 sudo docker pull sudo docker images --format '{{.Repository}}' | xargs -L 1 sudo docker pull
sudo docker image prune

View file

@ -1,3 +1,4 @@
#!/bin/sh
if pushd ~/Git; then if pushd ~/Git; then
for repo in *; do for repo in *; do
pushd "$repo" pushd "$repo"

View file

@ -1,2 +1,3 @@
#!/bin/sh
yay -Fy yay -Fy
yay yay