update scripts and work on server setup
This commit is contained in:
66
scripts/disk-array
Executable file
66
scripts/disk-array
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Variables (edit these as needed)
|
||||
ARRAY_NAME="md0"
|
||||
MOUNT_POINT="/mnt/md0"
|
||||
MDADM_CONF="/etc/mdadm/mdadm.conf"
|
||||
|
||||
# Colors
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
YELLOW="\e[33m"
|
||||
MAGENTA="\e[35m"
|
||||
CYAN="\e[36m"
|
||||
BOLD="\e[1m"
|
||||
NC="\e[0m"
|
||||
|
||||
echo "${CYAN}${BOLD}=== RAID Array Setup Script ===${NC}"
|
||||
|
||||
if ! sudo mdadm --help >/dev/null 2>&1; then
|
||||
echo "${YELLOW}[+]${NC} Installing mdadm package..."
|
||||
sudo apt install mdadm -y
|
||||
echo "${GREEN}[✓]${NC} mdadm installed successfully"
|
||||
else
|
||||
echo "${GREEN}[✓]${NC} mdadm is already installed"
|
||||
fi
|
||||
|
||||
# Check if array is already assembled
|
||||
if [ "/dev/${ARRAY_NAME}" ]; then
|
||||
echo "${GREEN}[✓]${NC} Array /dev/${ARRAY_NAME} exists."
|
||||
sudo mdadm --detail "/dev/${ARRAY_NAME}"
|
||||
cat /proc/mdstat
|
||||
|
||||
# Check if array is degraded
|
||||
if sudo mdadm --detail "/dev/${ARRAY_NAME}" | grep -q "degraded"; then
|
||||
echo "${RED}[!] WARNING:${NC} Array is degraded! Check which drives need to be re-added."
|
||||
echo "${YELLOW}[i]${NC} You may need to run: ${CYAN}sudo mdadm --manage /dev/${ARRAY_NAME} --re-add <missing_drive>${NC}"
|
||||
fi
|
||||
else
|
||||
echo "${YELLOW}[+]${NC} Assembling RAID array..."
|
||||
sudo mdadm --assemble --scan
|
||||
fi
|
||||
|
||||
# Optionally update mdadm.conf
|
||||
if ! grep -q "/dev/${ARRAY_NAME}" "$MDADM_CONF"; then
|
||||
echo "${YELLOW}[+]${NC} Updating $MDADM_CONF..."
|
||||
sudo mdadm --detail --scan | sudo tee -a "$MDADM_CONF"
|
||||
fi
|
||||
|
||||
# Mount the array
|
||||
if [ ! -d "$MOUNT_POINT" ]; then
|
||||
sudo mkdir -p "$MOUNT_POINT"
|
||||
echo "${GREEN}[✓]${NC} Mount point created"
|
||||
fi
|
||||
|
||||
if ! mountpoint -q "$MOUNT_POINT"; then
|
||||
echo "${YELLOW}[+]${NC} Mounting /dev/${ARRAY_NAME} to $MOUNT_POINT..."
|
||||
sudo mount "/dev/${ARRAY_NAME}" "$MOUNT_POINT"
|
||||
echo "${GREEN}[✓]${NC} Array mounted successfully at $MOUNT_POINT"
|
||||
else
|
||||
echo "${GREEN}[✓]${NC} Array is already mounted at $MOUNT_POINT"
|
||||
fi
|
||||
|
||||
echo "${CYAN}${BOLD}=== Setup Complete ===${NC}"
|
||||
echo "${CYAN}[i]${NC} Array device: ${CYAN}/dev/${ARRAY_NAME}${NC}"
|
||||
echo "${CYAN}[i]${NC} Mount point: ${CYAN}$MOUNT_POINT${NC}"
|
||||
|
||||
61
scripts/install-docker
Executable file
61
scripts/install-docker
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Colors
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
YELLOW="\e[33m"
|
||||
MAGENTA="\e[35m"
|
||||
CYAN="\e[36m"
|
||||
GRAY="\e[90m"
|
||||
BOLD="\e[1m"
|
||||
NC="\e[0m"
|
||||
|
||||
echo "${CYAN}${BOLD}=== Docker Installation Script ===${NC}"
|
||||
|
||||
echo "${YELLOW}[+]${NC} Updating APT..."
|
||||
echo "${GRAY}"
|
||||
sudo apt-get update
|
||||
echo "${NC}"
|
||||
|
||||
echo "${YELLOW}[+]${NC} Installing required packages..."
|
||||
echo "${GRAY}"
|
||||
sudo apt-get install -y ca-certificates curl gnupg lsb-release
|
||||
echo "${NC}"
|
||||
|
||||
echo "${YELLOW}[+]${NC} Adding Docker's official GPG key..."
|
||||
echo "${GRAY}"
|
||||
sudo mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL "https://download.docker.com/linux/$(
|
||||
. /etc/os-release
|
||||
echo "$ID"
|
||||
)/gpg" | sudo gpg --dearmor >/tmp/docker.gpg
|
||||
sudo mv /tmp/docker.gpg /etc/apt/keyrings/docker.gpg
|
||||
sudo chmod 644 /etc/apt/keyrings/docker.gpg
|
||||
|
||||
echo "${YELLOW}[+]${NC} Setting up the Docker repository..."
|
||||
echo "${GRAY}"
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
OS_ID=$(awk -F= '/^ID=/{gsub(/\"/, "", $2); print $2}' /etc/os-release)
|
||||
RELEASE=$(lsb_release -cs)
|
||||
echo "deb [arch=$ARCH signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$OS_ID $RELEASE stable" |
|
||||
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
|
||||
|
||||
echo "${YELLOW}[+]${NC} Updating APT..."
|
||||
echo "${GRAY}"
|
||||
sudo apt-get update
|
||||
echo "${NC}"
|
||||
|
||||
echo "${YELLOW}[+]${NC} Installing Docker Engine..."
|
||||
echo "${GRAY}"
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
echo "${GREEN}[✓]${NC} Docker installation complete!"
|
||||
echo "${GRAY}"
|
||||
docker --version
|
||||
echo "${NC}"
|
||||
|
||||
echo "${YELLOW}[+]${NC} Allowing Docker use without sudo..."
|
||||
echo "${GRAY}"
|
||||
sudo usermod -aG docker ${USER}
|
||||
exec sg docker newgrp
|
||||
echo "${NC}${GREEN}[✓]${NC} User added to docker group"
|
||||
@@ -1,14 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This script is a temporary solution to a GNOME bug where the cursor leaves the game window instead of being locked to the screen.
|
||||
|
||||
sudo apt install gamescope
|
||||
flatpak install com.valvesoftware.Steam
|
||||
flatpak install org.freedesktop.Platform.VulkanLayer.gamescope
|
||||
echo
|
||||
echo
|
||||
echo 'If the cursor escapes the screen in a game, enable gamescope with the launch arguments: `gamescope -- %command%`.'
|
||||
echo 'Add the `--force-grab-cursor` flag if the issue persists.'
|
||||
echo 'Add the `-f` flag to launch in fullscreen.'
|
||||
echo 'Add the `-h 720 -H 1440 -F fsr` flags to upscale the game (change the values accordingly).'
|
||||
echo 'You can use gamescope outside of Steam as well. Replace `%command%` with the launch command for your game.'
|
||||
@@ -1,17 +1,33 @@
|
||||
#! /bin/sh
|
||||
|
||||
YELLOW="\e[33m"
|
||||
GRAY="\e[90m"
|
||||
NC="\e[0m"
|
||||
|
||||
printf "%b\n" "${YELLOW}Updating apt...${NC}"
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt full-upgrade
|
||||
sudo apt autoremove
|
||||
sudo apt autoclean
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Updating repos..."
|
||||
printf "%b" "${GRAY}"
|
||||
sudo apt-get update
|
||||
printf "%b" "${NC}"
|
||||
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Upgrading packages..."
|
||||
printf "%b" "${GRAY}"
|
||||
sudo apt-get full-upgrade
|
||||
printf "%b" "${NC}"
|
||||
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..."
|
||||
printf "%b" "${GRAY}"
|
||||
sudo apt-get autoremove
|
||||
printf "%b" "${NC}"
|
||||
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Cleaning up..."
|
||||
printf "%b" "${GRAY}"
|
||||
sudo apt-get autoclean
|
||||
printf "%b" "${NC}"
|
||||
|
||||
if command -v flatpak >/dev/null 2>&1; then
|
||||
printf "%b\n" "${YELLOW}Updating flatpak...${NC}"
|
||||
printf "%b\n" "${YELLOW}[+]${NC} Updating flatpak packages..."
|
||||
printf "%b" "${GRAY}"
|
||||
flatpak update
|
||||
flatpak uninstall --unused --delete-data
|
||||
printf "%b" "${NC}"
|
||||
fi
|
||||
|
||||
9
scripts/upnpc-close
Executable file
9
scripts/upnpc-close
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Close all upnpc ports
|
||||
|
||||
sudo apt install miniupnpc -y
|
||||
|
||||
upnpc -l | sed -n 's/^[[:space:]]*[0-9]\+\s\+\(TCP\|UDP\)\s\+\([0-9]\+\).*/\1 \2/p' | while read proto port; do
|
||||
upnpc -d "$port" "$proto"
|
||||
done
|
||||
Reference in New Issue
Block a user