feat: remove unused bins

This commit is contained in:
AngeD 2023-09-26 20:28:54 +02:00
parent 4d87709fef
commit a41e5ffe66
8 changed files with 42 additions and 176 deletions

View File

@ -1,17 +1,19 @@
if [ "$XDG_VTNR" = 1 ]; then
[ "$XDG_VTNR" = 1 ] && {
GUILOG="$HOME/.local/share/gui.log"
mkdir -p "$(dirname "$GUILOG")"
mv "$GUILOG" "$GUILOG.old" 2> /dev/null
XDG_CURRENT_DESKTOP=Unity exec startx > "$GUILOG" 2>&1
#SDL_VIDEODRIVER=wayland \
export XDG_CURRENT_DESKTOP=Unity
exec startx > "$GUILOG" 2>&1
#export SDL_VIDEODRIVER=wayland \
# _JAVA_AWT_WM_NONREPARENTING=1 \
# QT_QPA_PLATFORM=wayland \
# XDG_CURRENT_DESKTOP=sway \
# XDG_SESSION_DESKTOP=sway \
# MOZ_ENABLE_WAYLAND=1
#exec sway > "$GUILOG" 2>&1
fi
}
# vim: ft=zsh

View File

@ -2,6 +2,8 @@
alias update='sudo pacman -Syu && config submodule update --remote --recursive --init'
alias pac='sudo pacman'
alias vi='$EDITOR'
alias qcp='qmv -o tabsize=4'
alias qmv='qmv -o tabsize=4'
# conf
alias config='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'

View File

@ -4,7 +4,7 @@
#(i3status | while read line; do xsetroot -name "$line"; done) &
# startup
. <(ssh-agent)
eval "$(ssh-agent)"
wallpaper &
xss-lock -n screensaver -- lock &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 || # arch

View File

@ -2,16 +2,13 @@
CRI=(podman)
IMG=ghcr.io/epitech/coding-style-checker
TAG=latest
REPORTS="$(mktemp -d)"
LOGS="$REPORTS/coding-style-reports.log"
"${CRI[@]}" run --rm \
-v "$PWD:/mnt/delivery" \
-v "$REPORTS:/mnt/reports" \
"$IMG:$TAG" \
ghcr.io/epitech/coding-style-checker:latest \
/mnt/delivery /mnt/reports
cat "$LOGS"

View File

@ -1,118 +0,0 @@
#!/bin/bash -e
function usage() {
cat << EOF
Usage: ${0##*/} [-hcCviInar]
Prune ${CRI##*/} resources.
If no option provided, defaults to -Cvn
Options:
-h Show this help and exits
-c Remove stopped containers
-C Remove all containers
-v Remove unused volumes
-i Remove build images
-I Remove unused images
-n Remove unused networks
-a All of the above, equivalent of -CvIn
-r Run docker as root
EOF
exit 0
}
function add_opt() {
local RESULT
RESULT="$1"
for o in "$@"; do
if [ "$((RESULT & o))" == 0 ]; then
RESULT="$((RESULT + o))"
fi
done
echo "$RESULT"
}
CRI="${CRI-"$(command -v podman || command -v docker)"}"
c=1
# C=2
v=4
i=8
# I=16
n=32
# a="$((c + C + v + I + n))"
CLEAN=0
while getopts hcCviInar o; do
case "$o" in
h)
usage
;;
c)
CLEAN="$(add_opt "$CLEAN" "$c")"
;;
C)
CLEAN="$(add_opt "$CLEAN" "$c")"
CON_OPT='-f'
;;
v)
CLEAN="$(add_opt "$CLEAN" "$v")"
;;
i)
CLEAN="$(add_opt "$CLEAN" "$i")"
;;
I)
CLEAN="$(add_opt "$CLEAN" "$i")"
IMG_OPT='-a'
;;
n)
CLEAN="$(add_opt "$CLEAN" "$n")"
;;
a)
CLEAN="$(add_opt "$CLEAN" "$c" "$v" "$i" "$n")"
CON_OPT='-f'
IMG_OPT='-a'
;;
r)
exec sudo CRI="$(command -v docker)" -- "$0" "${@/r/}"
;;
*)
exit 1
;;
esac
done
if [ "$CLEAN" == 0 ]; then
CLEAN="$((c + v + n))"
CON_OPT="-f"
fi
VALUES=(
"$((c + i + v + n))"
"$((c + i + n))"
"$v"
"$i"
"$n"
)
CON='container'
PRUNE='prune -f'
COMMANDS=(
"$CRI system $PRUNE $IMG_OPT --volumes"
"$CRI system $PRUNE $IMG_OPT"
"$CRI volume $PRUNE"
"$CRI image $PRUNE $IMG_OPT"
"$CRI network $PRUNE"
)
if [ "$((CLEAN & "$c"))" == "$c" ]; then
$CRI "$CON" ls -aq | xargs "$CRI" "$CON" rm "$CON_OPT" 2> /dev/null || true
fi
for idx in "${!VALUES[@]}"; do
mask="${VALUES[$idx]}"
if [ "$((CLEAN & mask))" == "$mask" ]; then
bash -c "${COMMANDS[$idx]}"
CLEAN="$((CLEAN - mask))"
fi
done

View File

@ -1,25 +1,29 @@
#!/bin/bash -e
CRI=(podman)
CRI_OPT=()
IMG='docker.io/epitechcontent/epitest-docker'
TAG=latest
if [ -z "$WAYLAND_DISPLAY" ]; then
CRI_OPT+=(
--network=host
-e XAUTHORITY=/app/.Xauthority
-v "$XAUTHORITY:/app/.Xauthority:ro"
)
fi
if ! "${CRI[@]}" container start epitest > /dev/null 2>&1; then
"${CRI[@]}" run --rm -d --name epitest \
--network host \
"${CRI[@]}" run --rm -it --name epitest \
"${CRI_OPT[@]}" \
--ipc=host \
--device /dev/dri/ \
-e DISPLAY \
-e XDG_RUNTIME_DIR \
-e XAUTHORITY=/app/.Xauthority \
-e MAKEFLAGS \
-e CFLAGS=-g3 \
-e CXXFLAGS=-g3 \
-v /dev/shm/:/dev/shm/ \
-v "$XAUTHORITY:/app/.Xauthority:ro" \
-v "$XDG_RUNTIME_DIR" \
-v "$HOME:$HOME" \
"$IMG:$TAG" sleep infinity > /dev/null
fi
"${CRI[@]}" exec -it -w "$PWD" epitest "$@"
-v /tmp/.X11-unix/:/tmp/.X11-unix/ \
-v "$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR" \
-v /usr/share/fonts/:/usr/share/fonts/:ro \
-v "$PWD:$PWD" \
-w "$PWD" \
docker.io/epitechcontent/epitest-docker:latest \
"$@"

View File

@ -1,2 +0,0 @@
#!/bin/sh
firefox -P music

View File

@ -1,19 +0,0 @@
#!/bin/bash
usage() {
echo "Usage: $0 /dev/pts/{tty_nb}"
exit 0
}
if [ -z "$1" ]; then
set "$(tty)"
elif ! [ -w "$1" ]; then
usage
fi
(set -e
asciiquarium &
cmatrix -abo &
while true; do sl; done &
) | lolcat > "$1"