.git broken, restart

This commit is contained in:
dangerboot
2026-01-23 08:55:18 +01:00
commit d1be8ebdca
206 changed files with 8431 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
set -eux
ISO_URL="https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/x86_64/alpine-virt-3.22.2-x86_64.iso"
# from vm to make a shared folder
if [ $# -lt 1 ] ; then
echo """
ISO=${1:-$(basename $ISO_URL)}
IMG=${2:-disc_alpine.qcow2}
SIZE=${3:-16G}
RAM=${4:-2G}
CPUS=${5:-2}
SHARE=${6:-$PWD/share}
"""
echo "cheat sheet: mount -t 9p -o trans=virtio hostshare /mnt"
fi
# --- Configurable defaults ---
ISO=${1:-$(basename $ISO_URL)}
IMG=${2:-disc_alpine.qcow2}
SIZE=${3:-16G}
RAM=${4:-2G}
CPUS=${5:-2}
SHARE=${6:-$PWD/share}
# --- Setup ---
mkdir -p "$SHARE"
echo "iso = $ISO"
[ -f "$ISO" ] || wget "$ISO_URL"
[ -f "$IMG" ] || qemu-img create -o nocow=on -f qcow2 "$IMG" "$SIZE"
# --- Optional install script ---
# Drop any file named install.sh in ./share to execute it inside the VM later:
# e.g. `bash /mnt/share/install.sh` after mounting
qemu-system-x86_64 \
-m $RAM \
-boot once=d \
-cdrom $ISO \
-drive file=$IMG \
-device virtio-vga \
-enable-kvm \
-display default,show-cursor=on \
-nic user,hostfwd=tcp::2222-:22 \
-virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare
## --- Run QEMU with graphics + shared folder ---
#qemu-system-x86_64 \
# -enable-kvm \
# -m "$RAM" \
# -cpu host \
# -smp "$CPUS" \
# -boot d \
# -cdrom "$ISO" \
# -drive file="$IMG",format=qcow2 \
# -device virtio-vga \
# -display default,show-cursor=on \
# -nic user,hostfwd=tcp::2222-:22 \
# -virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
set -eux
# from vm to make a shared folder
echo "cheat sheet: mount -t 9p -o trans=virtio hostshare /mnt"
# --- Configurable defaults ---
ISO_URL="https://mirror.arizona.edu/archlinux/iso/latest/archlinux-x86_64.iso"
ISO=${1:-$(basename $ISO_URL)}
IMG=${2:-disk_qemu.qcow2}
SIZE=${3:-16G}
RAM=${4:-2G}
CPUS=${5:-2}
SHARE=${6:-$PWD/share}
# --- Setup ---
mkdir -p "$SHARE"
echo "iso = $ISO"
[ -f "$ISO" ] || wget "$ISO_URL"
[ -f "$IMG" ] || qemu-img create -o nocow=on -f qcow2 "$IMG" "$SIZE"
# --- Optional install script ---
# Drop any file named install.sh in ./share to execute it inside the VM later:
# e.g. `bash /mnt/share/install.sh` after mounting
# --- Run QEMU with graphics + shared folder ---
qemu-system-x86_64 \
-enable-kvm \
-m "$RAM" \
-cpu host \
-smp "$CPUS" \
-boot d \
-cdrom "$ISO" \
-drive file="$IMG",format=qcow2 \
-device virtio-vga \
-display default,show-cursor=on \
-nic user,hostfwd=tcp::2222-:22 \
-virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare
Executable
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/bash
if [ "$#" -lt 1 ] || [ "$#" -gt 1 ]; then
echo "Usage: $0 alias"
exit 1
fi
F=$(which "$1")
if [ ! -f "$F" ]; then
F="$BIN_DIR/$1"
cp $MACHINE_DIR/usr/home/.vim/templates/template.sh $F
fi
vim "$F"
chmod +x $F
cd $BIN_DIR
git pull
gitaddcommit
git push
cd -
exit 0
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/bash
if [ "$#" -lt 1 ] || [ "$#" -gt 1 ]; then
echo "Usage: $0 alias"
exit 1
fi
F=$(which "$1")
if [ ! -f "$F" ]; then
F="$SBIN_DIR/$1"
cp $MACHINE_DIR/usr/home/.vim/templates/template.sh $F
fi
vim "$F"
chmod +x $F
cd $SBIN_DIR
git pull
gitaddcommit
git push
cd -
exit 0
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/bash
set -e
vim $BLACKLIST
bash $NFT_RESET
Executable
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
set -e
MACHINE_DIR=${1:$MACHINE_DIR}
MACHINE_DIR=${MACHINE_DIR:-"/svr"}
F_NAME=".bashrc";
cd "$MACHINE_DIR/usr/home";
commit_if_modified "$F_NAME"
cp -f $F_NAME /home/$F_NAME;
cd -
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/bash
mkdir certs
cd certs
openssl genrsa -out ca.key 4096
openssl req -x509 -new -sha256 -days 356000 -nodes -subj "/CN=LibreWolf CA/" -key ca.key -out ca.crt
openssl genrsa -out librewolf.key 2048
openssl req -new -key librewolf.key -out librewolf.csr -subj '/CN=librewolf.local'
echo "subjectAltName = DNS:librewolf.local,IP:127.0.0.1" > librewolf.ext
openssl x509 -req -in librewolf.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out librewolf.crt -days 365 -sha256 -extfile librewolf.ext
cd -
cp -r certs /srv/appdata/librewolf/config/
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/bash
if [ "$#" -ne 1 ] ; then
echo "Usage: $0 .iso"
exit 1
fi
ISO="$1"
WORKDIR=iso_edit
NEWISO=custom.iso
mkdir -p "$WORKDIR"
mount -o loop "$ISO" "$WORKDIR"
echo "[*] Enter chroot (bind mounts first)"
mount --bind /dev "$WORKDIR/dev"
mount --bind /sys "$WORKDIR/sys"
mount --bind /proc "$WORKDIR/proc"
chroot "$WORKDIR" /bin/bash
echo """
run:
post-chroot-iso
"""
# sudo umount "$WORKDIR"/{proc,sys,dev}
# genisoimage -o "$NEWISO" -V "CUSTOM" -R -J "$WORKDIR"
# note : from cdrkit package
exit 0
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
commit_if_modified ()
{
local F_NAME=$1;
local DEL=$2;
#git pull;
vim + $F_NAME;
git add $F_NAME;
git commit
if [ $? -eq 0 ] ; then
echo -n "[no modifications]";
if [ -n "$DEL" ]; then
rm $F_NAME;
echo -n " -> deleted";
return 1;
fi;
fi;
return 0
}
commit_if_modified "$@"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
gitaddcommit ()
{
gitadd;
if [ -n "$1" ]; then
git commit -m "$1";
else
git commit;
fi
}
gitaddcommit "$@"
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
journalctl_prettyfy ()
{
SIZE=${1:-"100"};
UNIQ_MIN=${2:-"1"};
BOOT=${3:-"0"};
local TMP="/tmp/journalctl_prettyf.tmp";
_FILE=${4:-"$TMP"};
CMD="sudo journalctl -b ${BOOT} | tail -n $SIZE";
CMD_SORTED="${CMD} | cut -d\: -f 4- | sort | uniq -c | sort -n";
rm -f "$TMP";
append_cmd "$CMD" "$TMP";
append_cmd "$CMD_SORTED" "$TMP";
grep --color=auto -vE " +[0-${UNIQ_MIN}] " $TMP >> "$_FILE";
if ! $#; then
cat $_FILE;
fi;
rm "$TMP"
}
journalctl_prettyfy "$@"
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/bash
#if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
# echo "Usage: mount the last sdx in dmesg"
# exit 1
#fi
SDX=${1:-$(dmesg | tail -1 | grep -Eo "sd[^ ]")}
SDX1=${SDX}1
MNT_PT=/mnt/$SDX1
mkdir -p $MNT_PT
mount /dev/${SDX1} $MNT_PT
cd $MNT_PT
exit 0
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/bash
sudo -E bash $NETWORK_DIR/nft_setup.sh
exit 0
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
export DATE=$(date +"%y%m%d");
export TIME=$(date +"%T")
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/bash
USER=${1:-"presko"}
groupadd $MACHINE
useradd -k $HOMESKEL_DIR -m -G sudo,$MACHINE $1
usermod -aG $MACHINE $USER
Executable
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/bash
DIR=${1:-"$LOG_CONN_DIR"}
SUB_DIR=${2:-$(date "+%y%m%d")}
DIR="$DIR/$SUB_DIR"
NAME=${2:-"dflt"}
NAME=$(echo $(date +"%y%m%d")-$(date +"%T").$NAME | sed "s/:/_/g")
FILE=$DIR/$NAME
echo "File at $FILE"
if [ "$#" -lt 1 ] ; then
echo "usage $0 filename"
echo "File at $FILE"
exit 1
fi
mkdir -p $DIR
echo "File at $FILE"
#DEVICE=$(ip addr | grep -v DOWN | grep -E "^[0-9]" | awk -F':' '{print $2}' | grep -v lo)
#NB_DEVICES="$(echo ${DEVICE} | awk '{print NF}')"
#
#if [ $NB_DEVICES -lt "1" ] ; then
# echo no device
# echo $DEVICE
# exit 1
#elif [ $NB_DEVICES -gt "1" ] ; then
# echo several devices, precise it using '$2':
# echo $DEVICE
# exit 1
#fi
echo 'DEVICE='$DEVICE
echo
tcpdump -n | tee -a $FILE.log
tcpdump -w $FILE.pcap
exit 1
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 /dev/sdb"
exit 1
fi
#!/bin/sh
# partitionne /dev/sdb en une partition unique FAT32 montable Win/Linux
dev=$1
# créer table de partition MBR et 1 partition FAT32
fdisk "$dev" <<EOF
o
n
p
1
t
c
w
EOF
echo """
# nouvelle table DOS
# nouvelle partition
# primaire
# numéro
# début par défaut
# fin par défaut
# changer type
# W95 FAT32 (LBA)
# écrire
"""
mkfs.vfat -F32 ${dev}1 -n STORAGE
echo "note: mkfs.vfat in dosfstools package"
exit 0
Executable
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/bash
cat $MACHINE_DIR/usr/etc/openvpn/.pot.swp
#openvpn /etc/openvpn/client/ch-free-2.protonvpn.tcp.ovpn
#openvpn /etc/openvpn/client/ch-free-4.protonvpn.tcp.ovpn
openvpn /etc/openvpn/client/ch-free-6.protonvpn.tcp.ovpn
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/bash
set -e
vim $WHITELIST
bash $NFT_RESET