Reorganize repository structure and refresh READMEs

This commit is contained in:
WickedYoda committed 2026-04-08 14:57:07 -05:00
1 parent 2270530d9e
commit a8b7ccbf2a
170 files changed
+616 -1391

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
# repo_automation
## Overview
This category contains repository update helpers, cron setup scripts, permission reset helpers, and other maintenance automation.
## Contents
- `cron-job-setup-files`
- `git_clone_setup`
- `reset_perms`
- `update-from_repo.py`
- `update-from_repo.sh`
- `updates_scripts`
## Usage
Use these folders for recurring maintenance, update workflows, and repository housekeeping tasks.
## Notes
Several scripts here are designed to be scheduled or run repeatedly, so confirm paths, credentials, and privilege requirements first.
@@ -0,0 +1,26 @@
MAILTO="alert@tyates.one"
0 */6 * * * root apt-get update && apt install upgrade -y && apt-get -y -d full-upgrade && apt-get autoremove -y
#* */4 * * * /home/pi/Desktop/sync.sh
# sudo apt-get update
# sudo apt-get upgrade -y
#https://crontab-generator.org/
#apt-get install cron-apt -y
#https://www.techrepublic.com/article/automatically-update-your-ubuntu-system-with-cron-apt/
#https://www.linuxfordevices.com/tutorials/linux/automatic-updates-cronjob
#[minute] [hour] [day_of_month] [month] [day_of_week] [user] [command_to_run]
#0 0 * * 0 root (apt-get update && apt-get -y -d upgrade)
sudo apt install cron cron-apt -y
sudo systemctl enable cron
sudo nano /etc/crontab
#MAILTO="alerts@tyates.one"
#0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y
#sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt autoremove -y
@@ -0,0 +1,15 @@
# cron-job-setup-files
## Overview
Scripts and notes for installing recurring update jobs through cron.
## Contents
- `CronUpdates-readme.txt`
- `setup_cron_job_updates-nomount.sh`
- `setup_cron_job_updates.sh`
## Usage
Use these files when scheduling periodic maintenance or update workflows.
## Notes
Confirm the target script paths and logging destinations before deploying a cron job.
@@ -0,0 +1,27 @@
#!/bin/bash
# Script: setup_auto_updates.sh
# Description: Configure automatic system updates via cron on Debian 12
# Exit immediately on error
set -e
# Update package lists and install cron
sudo apt update
sudo apt install -y cron
# Enable and start the cron service
sudo systemctl enable cron
sudo systemctl restart cron
# Write the cron job to /etc/cron.d/auto_updates properly using EOF
sudo tee /etc/cron.d/auto_updates > /dev/null << 'EOF'
MAILTO="alerts@tyates.one"
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && apt-get clean -y && apt-get purge -y
EOF
# Set proper permissions
sudo chmod 644 /etc/cron.d/auto_updates
sudo chown root:root /etc/cron.d/auto_updates
echo "[✓] Auto update cron job installed. Runs every 6 hours."
@@ -0,0 +1,28 @@
#!/bin/bash
# Script: setup_auto_updates.sh
# Description: Script to set up automatic system updates using cron
# Update package lists and install cron
sudo apt update
sudo apt install cron -y
# Enable and start the cron service
sudo systemctl enable cron
sudo systemctl start cron
# Stop the cron service to make changes
sudo systemctl stop cron
# Add the update and upgrade cron job to /etc/cron.d/
# Old line that doesnt work
# echo 'MAILTO="alerts@tyates.one"
# 0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y' | sudo tee /etc/cron.d/auto_updates
# Add the update and upgrade cron job to /etc/cron.d/auto_updates
echo 'MAILTO="alerts@tyates.one"
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y
0 */1 * * * root mount -a' | sudo tee /etc/cron.d/auto_updates
# Restart the cron service to apply the new cron job
sudo systemctl start cron
@@ -0,0 +1,5 @@
git init
git remote add origin https://github.com/wickedyoda/public-setupfiles
git fetch
git checkout main
To remove "rm -rf .git"
+13
View File
@@ -0,0 +1,13 @@
# git_clone_setup
## Overview
Notes for cloning repositories and performing local checkout workflows.
## Contents
- `Git_clone_local_checkout.md`
## Usage
Use this folder as reference when setting up a local repository clone workflow.
## Notes
This folder is primarily documentation-oriented rather than a large script collection.
+14
View File
@@ -0,0 +1,14 @@
# reset_perms
## Overview
Scripts for resetting file or directory permissions.
## Contents
- `reset_perms 1.sh`
- `reset_perms.sh`
## Usage
Use these scripts carefully when permissions have drifted and need to be normalized.
## Notes
Permission changes can have broad effects, so confirm ownership and target paths first.
Whitespace-only changes.
@@ -0,0 +1,38 @@
#!/bin/bash
# Define mount points and devices
declare -A mounts=(
["/mnt/public"]="/dev/sdc1"
["/mnt/public-bk"]="/dev/sde1"
["/mnt/public2"]="/dev/sdd1"
["/mnt/public2-bk"]="/dev/sdb1"
)
# Ensure mount folders exist
for dir in "${!mounts[@]}"; do
echo "Creating $dir if needed..."
mkdir -p "$dir"
done
# Mount each device to its folder
for dir in "${!mounts[@]}"; do
device="${mounts[$dir]}"
echo "Mounting $device to $dir..."
mount "$device" "$dir"
done
# Bind mount for timeshift folders
echo "Creating timeshift bind mounts..."
mkdir -p /mnt/timeshift /mnt/timeshift1
mount --bind /mnt/public2 /mnt/timeshift
mount --bind /mnt/public2-bk /mnt/timeshift1
# Apply root ownership and full permissions
echo "Setting root:root ownership and chmod 777..."
for path in /mnt/public /mnt/public-bk /mnt/public2 /mnt/public2-bk /mnt/timeshift /mnt/timeshift1; do
echo "Processing $path..."
chown -R root:root "$path"
chmod -R 777 "$path"
done
echo "All mounts and permissions applied successfully."
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
import subprocess
subprocess.run(["apt", "install", "python", "python3", "-y"])
# run apt update to make sure the system has the latest repo files
subprocess.run(["apt", "update", "-y"])
# Check if git is installed
try:
subprocess.run(["git", "--version"], check=True)
except subprocess.CalledProcessError:
# Install git
subprocess.run(["apt-get", "install", "git", "-y"])
# Specify the remote repository URL
remote_repo = "https://github.com/wickedyoda/public-setupfiles.git"
# Specify the local file path
local_file = "./pubic-setupfiles"
# Check if the local file path exists and is not empty
import os
if os.path.isdir(local_file) and os.listdir(local_file):
# Delete the existing directory
subprocess.run(["sudo", "rm", "-rf", local_file])
# Clone the remote repository to the local file pathh
subprocess.run(["git", "clone", remote_repo, local_file])
# Make all files executable and public ownership
subprocess.run(["sudo", "chmod", "777", "-R", local_file])
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# Ensure script is run as root or with sudo
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Use sudo."
exit 1
fi
# Verify Git is installed
if ! command -v git &> /dev/null; then
echo "Error: Git is not installed. Please install Git manually and re-run the script."
exit 1
fi
# Specify the remote repository URL
REMOTE_REPO="https://github.com/wickedyoda/public-setupfiles.git"
# Specify the local directory for the repository
LOCAL_DIR="./public-setupfiles"
# Check if the local directory exists and is not empty
if [ -d "$LOCAL_DIR" ] && [ -n "$(ls -A $LOCAL_DIR 2>/dev/null)" ]; then
echo "Existing directory detected. Deleting $LOCAL_DIR..."
rm -rf "$LOCAL_DIR"
fi
# Clone the remote repository to the local directory
echo "Cloning repository from $REMOTE_REPO to $LOCAL_DIR..."
git clone "$REMOTE_REPO" "$LOCAL_DIR"
# Ensure all files have proper execution permissions
echo "Setting permissions for $LOCAL_DIR..."
chmod -R 755 "$LOCAL_DIR"
echo "Script execution completed successfully!"
+17
View File
@@ -0,0 +1,17 @@
# updates_scripts
## Overview
General update and maintenance scripts, including distro updates and service-specific fixes.
## Contents
- `docker-run-netdata-install.sh`
- `fix_apt_influx.sh`
- `kali-updates.sh`
- `updates.py`
- `updates.sh`
## Usage
Use these scripts for recurring maintenance or one-off update actions after validating the target platform.
## Notes
Update automation should be tested before unattended use because package and service behavior changes over time.
@@ -0,0 +1,23 @@
docker run -d \
--name netdata \
--hostname docker3 \
--pid host \
--network host \
--restart unless-stopped \
--cap-add SYS_PTRACE \
--cap-add SYS_ADMIN \
--security-opt apparmor=unconfined \
-v /root/docker/netdata/config:/etc/netdata \
-v /root/docker/netdata/lib:/var/lib/netdata \
-v /root/docker/netdata/cache:/var/cache/netdata \
-v /:/host/root:ro,rslave \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /etc/os-release:/host/etc/os-release:ro \
-v /var/log:/host/var/log:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /run/dbus:/run/dbus:ro \
netdata/netdata
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
echo "==> Fixing APT repository keys and stale indexes on Debian Bookworm"
# Make sure basic tools exist
sudo apt-get update
sudo apt-get install -y ca-certificates curl gpg
# Create keyring directory if missing
sudo mkdir -p /etc/apt/keyrings
echo "==> Fixing InfluxData repo key"
curl --silent --location -o /tmp/influxdata-archive.key https://repos.influxdata.com/influxdata-archive.key
# Verify official InfluxData fingerprint before installing key
gpg --show-keys --with-fingerprint --with-colons /tmp/influxdata-archive.key 2>&1 \
| grep -q '^fpr:\+24C975CBA61A024EE1B631787C3D57159FC2F927:$'
gpg --dearmor < /tmp/influxdata-archive.key | sudo tee /etc/apt/keyrings/influxdata-archive.gpg >/dev/null
echo "deb [signed-by=/etc/apt/keyrings/influxdata-archive.gpg] https://repos.influxdata.com/debian stable main" \
| sudo tee /etc/apt/sources.list.d/influxdata.list >/dev/null
echo "==> Fixing Sury PHP repo key"
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb
echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ bookworm main" \
| sudo tee /etc/apt/sources.list.d/php.list >/dev/null
echo "==> Cleaning stale APT metadata"
sudo rm -f /var/lib/apt/lists/*InRelease /var/lib/apt/lists/*Release /var/lib/apt/lists/*Packages
sudo apt-get clean
echo "==> Rebuilding package lists"
sudo apt-get update
echo "==> Repairing any partial package state"
sudo dpkg --configure -a
sudo apt-get install -f -y
echo "==> Running full upgrade"
sudo apt-get upgrade -y
sudo apt-get full-upgrade -y
sudo apt-get autoremove -y
echo "==> Done"
@@ -0,0 +1,110 @@
#!/bin/bash
set -euo pipefail
SUDO=""
if [[ $EUID -ne 0 ]]; then
if command -v sudo >/dev/null 2>&1; then
SUDO="sudo "
else
echo "This script must be run as root or have sudo installed."
exit 1
fi
fi
${SUDO}apt update
${SUDO}apt upgrade -y
${SUDO}apt full-upgrade -y
declare -A TOOL_MAP=(
[1]=kali-tools-identify
[2]=kali-tools-protect
[3]=kali-tools-detect
[4]=kali-tools-respond
[5]=kali-tools-recover
)
add_packages() {
local pkg
for pkg in "$@"; do
if [[ -z "${PACKAGE_SEEN[$pkg]:-}" ]]; then
INSTALL_PKGS+=("$pkg")
PACKAGE_SEEN[$pkg]=1
fi
done
}
INSTALL_PKGS=()
declare -A PACKAGE_SEEN=()
echo
echo "Select Kali tool categories to install (comma-separated numbers, or 'all'):"
echo " 1) Identify -> kali-tools-identify"
echo " 2) Protect -> kali-tools-protect"
echo " 3) Detect -> kali-tools-detect"
echo " 4) Respond -> kali-tools-respond"
echo " 5) Recover -> kali-tools-recover"
echo " Enter numbers (e.g. 1,3), 'all' or 'a' to install all. Leave empty to skip."
read -r -p "Selection: " selection
selection="${selection,,}"
selection="${selection//[[:space:]]/}"
if [[ -z "$selection" ]]; then
echo "No tools selected. Skipping Kali tool installation."
elif [[ "$selection" == "all" || "$selection" == "a" ]]; then
add_packages "${TOOL_MAP[@]}"
else
IFS=',' read -ra choices <<< "$selection"
for c in "${choices[@]}"; do
if [[ "$c" == "all" || "$c" == "a" ]]; then
add_packages "${TOOL_MAP[@]}"
break
elif [[ -n "${TOOL_MAP[$c]:-}" ]]; then
add_packages "${TOOL_MAP[$c]}"
else
echo "Warning: invalid choice '$c' ignored."
fi
done
fi
echo
echo "Kali Purple installation options:"
echo " 1) Kali Purple tools (identify/protect/detect/respond/recover)"
echo " 2) Kali Purple experience (kali-themes-purple, kali-menu, kali-wallpapers-legacy)"
echo " 3) All Kali Purple options"
echo " 4) Continue without Kali Purple installation"
read -r -p "Selection [4]: " purple_selection
purple_selection="${purple_selection,,}"
purple_selection="${purple_selection//[[:space:]]/}"
case "$purple_selection" in
1)
add_packages ${TOOL_MAP[@]}
;;
2)
add_packages kali-themes-purple kali-menu kali-wallpapers-legacy
;;
3|all|a)
add_packages ${TOOL_MAP[@]} kali-themes-purple kali-menu kali-wallpapers-legacy
;;
""|4|skip)
echo "Skipping Kali Purple installation."
;;
*)
echo "Unrecognized choice. Skipping Kali Purple installation."
;;
esac
if [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
echo "Installing selected packages: ${INSTALL_PKGS[*]}"
${SUDO}apt install -y "${INSTALL_PKGS[@]}"
echo "Selected packages installed."
else
echo "No optional Kali packages selected for installation."
fi
${SUDO}apt autoremove -y
${SUDO}apt clean -y
echo "System update and cleanup complete!"
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
import subprocess
# Run 'sudo apt update'
subprocess.run(['sudo', 'apt', 'update'])
# Run 'sudo apt upgrade -y'
subprocess.run(['sudo', 'apt', 'upgrade', '-y'])
# Run 'sudo apt full-upgrade -y'
subprocess.run(['sudo', 'apt', 'full-upgrade', '-y'])
# Run 'sudo apt dist-upgrade -y'
subprocess.run(['sudo', 'apt', 'dist-upgrade', '-y'])
# Run 'sudo apt autoremove -y'
subprocess.run(['sudo', 'apt', 'autoremove', '-y'])
# Run 'sudo apt clean -y'
subprocess.run(['sudo', 'apt', 'clean', '-y'])
# Run 'sudo apt purge -y'
subprocess.run(['sudo', 'apt', 'purge', '-y'])
@@ -0,0 +1,9 @@
sudo ./fix_apt_influx.sh
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo apt clean -y
sudo apt purge -y
echo "System update and cleanup complete!"