This commit is contained in:
Mike McFetridge
2026-07-20 09:23:17 -04:00
parent c1315882da
commit 72272e4006
3179 changed files with 562960 additions and 14 deletions
@@ -0,0 +1,33 @@
---
tags:
- Scirpts
- Desktop
---
# 🚀 System Preparation: APT Package Management Guide
This guide outlines the mandatory, standard procedure for updating and upgrading all packages on a Debian/Ubuntu based system using the **Advanced Package Tool (APT)**. Maintaining updated repositories is foundational to system security and stability.
## Process Overview
The process requires two distinct steps: first refreshing the package index, and second, applying the actual updates.
### 1\. Update Local Package List (`apt update`)
This command contacts the configured repository servers and downloads the latest available package lists. **It does not install any packages.** It only ensures *knowing* what is available.
```bash
sudo apt update
```
### 2\. Full System Upgrade (`apt upgrade` or `apt full-upgrade`)
After verifying the index, you must run one of these commands:
* **`sudo apt upgrade`**: Recommended for routine maintenance. It performs an in-place upgrade of all installed packages to their newest versions, while generally respecting current package dependencies and avoiding large system changes.
* **`sudo apt full-upgrade` (Recommended for major changes)**: Use this when upgrading between major OS releases or when a core dependency update might require the installation/removal of related packages. This gives more "freedom" to upgrade beyond simple minor patch levels.
## Important Troubleshooting Steps
If an upgrade fails, it is almost always due to:
1. **Broken Dependencies:** A package required by another service has been removed or updated incompatibly.
2. **Repository Interruption:** Network connectivity issues prevented the full index update.
In such cases, check the specific error logs provided by `apt` and search official Ubuntu/Debian documentation for known dependency conflicts involving those packages.
> [!NOTE] Modernized Workflow
For managed environments (like Container Orchestration, e.g., Kubernetes), direct host package management should be minimized. Instead of running `apt upgrade` on the host OS itself, it is best practice to **define dependencies strictly within your Dockerfile or application manifests**. This ensures that every deployment unit carries its tested environment dependencies, guaranteeing consistency across development, staging, and production stacks.
@@ -0,0 +1,14 @@
---
tags:
- Scirpts
- Desktop
---
curl -fsSL [https://eddie.website/repository/keys/eddie\_maintainer\_gpg.key](https://eddie.website/repository/keys/eddie_maintainer_gpg.key) | sudo tee /usr/share/keyrings/eddie.website-keyring.asc > /dev/null
echo "deb \[signed-by=/usr/share/keyrings/eddie.website-keyring.asc\] [http://eddie.website/repository/apt](http://eddie.website/repository/apt) stable main" | sudo tee /etc/apt/sources.list.d/eddie.website.list
sudo apt update
sudo apt install eddie-ui
+11
View File
@@ -0,0 +1,11 @@
---
tags:
- Scirpts
- Desktop
---
sudo apt update
sudo apt install -y gpg
sudo mkdir -p /etc/apt/keyrings wget -qO- [https://raw.githubusercontent.com/eza-community/eza/main/deb.asc](https://raw.githubusercontent.com/eza-community/eza/main/deb.asc) | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg echo "deb \[signed-by=/etc/apt/keyrings/gierens.gpg\] [http://deb.gierens.de](http://deb.gierens.de) stable main" | sudo tee /etc/apt/sources.list.d/gierens.list sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list sudo apt update sudo apt install -y eza
+29
View File
@@ -0,0 +1,29 @@
---
tags:
- Scirpts
- Desktop
---
```
#!/bin/bash
set -euo pipefail
fonts_dir="$HOME/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "$@"; do
zip_file="$font.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$zip_file"
echo "Downloading $download_url"
wget -O "/tmp/$zip_file" "$download_url"
unzip "/tmp/$zip_file" -d "/tmp/$font/"
mv /tmp/$font/*.ttf $fonts_dir
rm "/tmp/$zip_file"
rm "/tmp/$font/" -rf
done
fc-cache -fv
```
@@ -0,0 +1,12 @@
---
tags:
- Scirpts
- Desktop
---
curl -sS [https://starship.rs/install.sh](https://starship.rs/install.sh) | sh
eval "$(starship init bash)"
eval "$(starship init zsh)"
@@ -0,0 +1,8 @@
---
tags:
- Scirpts
- Desktop
---
flatpak install flathub com.github.zadam.trilium -y
@@ -0,0 +1,9 @@
---
tags:
- Scirpts
- Desktop
---
chmod 700 /home/miker/.ssh
chmod 644 /home/miker/.ssh/*.pub
chmod 600 /home/miker/.ssh/id_rsa
@@ -0,0 +1,30 @@
---
tags:
- Scirpts
- Desktop
---
# 📚 Scripts Directory Best Practices Index
**Purpose:** This document serves as the mandatory quality gate index for all shell scripts, configuration guides, and setup manuals (`*.md`/`*.sh`) residing in this directory. Every script must adhere to these updated standards.
## Mandates of Modern Scripting (Version v2.0)
All standalone scripts should follow a template emphasizing security, idempotency, and clear execution logic.
### 1\. Structure and Readability
* **Headers:** Must start with a `#` title and include an executive summary stating **WHO**, **WHAT** the script does, and **WHY** it is necessary (the problem it solves).
* **Dependencies:** The first section must clearly list all required external tools (`# Requires: sudo, curl, docker-compose`).
### 2\. Execution Practices
* **Idempotency Check:** Scripts should aim for idempotent operations. If step N fails, running the *exact same script* on a machine that subsequently fixed step N should not fail again due to intermediate artifacts.
* **Error Handling:** Use `set -euo pipefail` at the top of every shell script. This ensures that:
* `-e`: The script will exit immediately if any command fails.
* `-u`: Unset variables are treated as an error.
* `-o pipefail`: Pipelines fail if *any* command in the pipeline fails, not just the last one.
### 3\. Deployment & Automation Best Practices (The 'Modern' Way)
For production environments or CI/CD:
1. **DO NOT rely solely on simple shell scripts.** For complex workflows involving multi-step deployments, utilize **Ansible Playbooks** or **Docker Compose**. These tools manage state and dependencies far more reliably than manual scripting.
2. If a script *must* be used (e.g., for one-off cleanup), it should minimally rely on `sudo` and include instructions to run the subsequent necessary user permission changes (`sudo usermod...`).
> [!NOTE] Modernized Workflow
Moving forward, any new scripting requirement that involves setup or deployment logic must first be modeled as a **declarative configuration** (Ansible Playbook) before being written as an imperative script. Shell scripts should be relegated to simple file execution wrappers only.
@@ -0,0 +1,158 @@
---
tags:
- Scirpts
- Desktop
---
This file is used in conjunction with run_once_install_ansible.sh. This file should be placed in the home/.local/dot_bootstrap directory.
``` yaml
- name: Install applications on Ubuntu
hosts: all
become: yes
tasks:
- name: Update and upgrade apt packages
apt:
update_cache: yes
upgrade: dist
# Install APT Applications
- name: Install Apt packages
apt:
name: "{{ item }}"
state: present
loop:
- curl
- wget
- git
- bat
- vim
- zsh
- build-essential
- autoconf
- make
- libssl-dev
- ca-certificates
- htop
- firefox
- blender
- vlc
- filezilla
- inotify-tools
- eza
- zoxide
- fzf
- docker-compose
# Installing Flatpak and Applications
- name: Install Flatpak applications
community.general.flatpak:
name: "{{ item }}" # Use the item from the loop as the Flatpak application name
state: present
remote: flathub # Specify the Flathub remote for installation
# - name: Install Flatpak packages
# command: "flatpak install {{ item }}" -y
loop:
- com.obsproject.Studio
- org.tenacityaudio.Tenacity
- md.obsidian.Obsidian
- org.gimp.GIMP
- com.github.zadam.trilium
- com.spotify.Client
- io.github.shiftey.Desktop
- com.brave.Browser
- com.visualstudio.code
- org.qbittorrent.qBittorrent
- org.wezfurlong.wezterm
register: result # Register the result of the command
failed_when: result.rc != 0 # Fail if return code is not 0
retries: 3 # Add retries in case of transient network issues
delay: 5 # Wait a few seconds between retries
until: result.rc == 0
tags: flatpak # Tagging for potential skipping
# Install Terraform
- name: Add HashiCorp GPG key
ansible.builtin.shell: |
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
args:
creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg
when: ansible_os_family == "Debian" # Only run on Debian-based systems
- name: Add HashiCorp APT repository
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main"
state: present
filename: hashicorp
when: ansible_os_family == "Debian"
- name: Update apt cache again after adding repository
ansible.builtin.apt:
update_cache: yes
when: ansible_os_family == "Debian"
- name: Install Terraform
ansible.builtin.apt:
name: terraform
state: present
when: ansible_os_family == "Debian"
# --- Zsh Completion ---
- name: Install zsh (if not already installed)
ansible.builtin.apt:
name: zsh
state: present
# Install flyctl
- name: Ensure zsh is installed
ansible.builtin.apt:
name: zsh
state: present
- name: Download flyctl installation script
ansible.builtin.get_url:
url: https://fly.io/install.sh
dest: /tmp/install.sh
mode: '0755' # Make the script executable
- name: Run flyctl installation script
ansible.builtin.shell: /tmp/install.sh
args:
creates: /usr/local/bin/flyctl # Prevents rerunning if flyctl is already installed
# Install PowerLine10k and Oh-My-Zsh
- name: Install Oh My Zsh
shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
args:
creates: "/home/miker/.oh-my-zsh"
- name: Add zsh-autosuggestions plugin
git:
repo: 'https://github.com/zsh-users/zsh-autosuggestions.git'
dest: "/home/miker/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
depth: 1
- name: Add zsh-syntax-highlighting plugin
git:
repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
dest: "/home/miker/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
depth: 1
- name: Enable zsh-autosuggestions and zsh-syntax-highlighting plugins
lineinfile:
path: "/home/miker/.zshrc"
regexp: '^plugins=\((.*)\)$'
line: 'plugins=(git zsh-autosuggestions zsh-syntax-highlighting)' # You can customize the plugins list
backup: yes
# To run - run the following command. ansible-playbook -i inventory install_apps.yml
```
@@ -0,0 +1,44 @@
---
tags:
- Scirpts
- Desktop
---
# 🐳 Docker Engine Installation Guide (`install-docker.sh`)
This script automates and guides the installation of Docker CLI, Docker Engine, and necessary dependencies on a Linux host system. **WARNING: Running this script requires elevated privileges (`sudo`).** Always run from a secure, non-production machine initially.
## 🗺️ Prerequisites
Before running any provisioning script, ensure the following are in place:
* A functional `curl` client is installed.
* The user executing the command has appropriate permissions (system administrator level rights).
## Execution Protocol
The process follows three critical, distinct steps to ensure the entire stack is correctly configured and operational:
### Step 1: Download the Official Installation Script
Use `curl` to fetch the latest official installation manifest from Docker.
```bash
# Execute this command in your shell terminal
curl -fsSL https://get.docker.com -o install-docker.sh
```
### Step 2: Run the Installation Script
Execute the downloaded script with elevated permissions. This step pulls and configures all necessary binaries and services.
```bash
sudo sh install-docker.sh
```
*Wait for the output to confirm successful installation across all components.*
### Step 3: Configure User Permissions (Non-negotiable)
Docker commands require administrative access by default. To run Docker without prefixing every command with `sudo`, you must add your current user (`$USER`) to the `docker` group.
```bash
sudo usermod -aG docker $USER
```
***Note: You must log out and log back in for this group change to take effect.***
> [!NOTE] Modernized Workflow
For automated, production deployment (CI/CD), **avoid standalone shell scripts like this.** Best practice dictates using infrastructure-as-code tools such as **Ansible** or **Terraform**. These platforms manage dependencies and state much better than a sequential script execution, allowing you to define the *desired final state* of Docker rather than merely listing steps to achieve it. Always prefer declarative configuration over imperative scripts where possible.
+20
View File
@@ -0,0 +1,20 @@
---
tags:
- Scirpts
- Desktop
---
cvt 1920 1080
-------------
#!/bin/bash
xrandr --newmode "1920x1080\_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync xrandr --newmode "1600x900\_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
xrandr --addmode eDP-1 1920x1080\_60.00 xrandr --addmode eDP-1 1600x900\_60.00
xrandr --output eDP-1 --mode 1600x900\_60.00 #xrandr --output eDP-1 --mode 1920x1080\_60.00
Mount my One drive from Microsoft
---------------------------------
rclone --vfs-cache-mode writes mount OneDrive: /home/miker/Documents/OneDrive &
@@ -0,0 +1,155 @@
---
tags:
- Scirpts
- Desktop
---
Copy this is a local sh (shell) file.
```
#!/bin/sh
# Software Installation Script
# Installs: AirVPN Eddie, EZA, Starship, VSCodium, Docker, Powerlevel10k, Trilium, Zoxide, FZF
set -e # Exit on any error
# Get current user
CURRENT_USER=$(whoami)
USER_HOME="/home/$CURRENT_USER"
echo "Starting software installation for user: $CURRENT_USER"
echo "###############################################"
echo "###############################################"
echo "Installing AirVPN Eddie..."
echo "###############################################"
echo "###############################################"
curl -fsSL https://eddie.website/repository/keys/eddie_maintainer_gpg.key | sudo tee /usr/share/keyrings/eddie.website-keyring.asc > /dev/null
echo "deb [signed-by=/usr/share/keyrings/eddie.website-keyring.asc] http://eddie.website/repository/apt stable main" | sudo tee /etc/apt/sources.list.d/eddie.website.list
sudo apt update
sudo apt install eddie-ui -y
echo "###############################################"
echo "###############################################"
echo "Installing EZA..."
echo "###############################################"
echo "###############################################"
sudo apt update
sudo apt install -y gpg
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
echo "###############################################"
echo "###############################################"
echo "Reset SSH directory permissions (if SSH directory exists)"
echo "###############################################"
echo "###############################################"
if [ -d "$USER_HOME/.ssh" ]; then
echo "Setting SSH permissions..."
chmod 700 "$USER_HOME/.ssh"
if ls "$USER_HOME/.ssh"/*.pub 1> /dev/null 2>&1; then
chmod 644 "$USER_HOME/.ssh"/*.pub
fi
if [ -f "$USER_HOME/.ssh/id_rsa" ]; then
chmod 600 "$USER_HOME/.ssh/id_rsa"
fi
fi
echo "###############################################"
echo "###############################################"
echo "Installing Zoxide..."
echo "###############################################"
echo "###############################################"
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
echo "Add zoxide init to shell configs if they exist"
if [ -f "$USER_HOME/.zshrc" ]; then
if ! grep -q "zoxide init zsh" "$USER_HOME/.zshrc"; then
echo 'eval "$(zoxide init zsh)"' >> "$USER_HOME/.zshrc"
fi
fi
if [ -f "$USER_HOME/.bashrc" ]; then
if ! grep -q "zoxide init bash" "$USER_HOME/.bashrc"; then
echo 'eval "$(zoxide init bash)"' >> "$USER_HOME/.bashrc"
fi
fi
echo "###############################################"
echo "###############################################"
echo "Installing fastfetch"
echo "###############################################"
echo "###############################################"
sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
sudo apt update
sudo apt install fastfetch
echo "###############################################"
echo "###############################################"
echo "Installing Alacritty"
echo "###############################################"
echo "###############################################"
sudo apt install snapd
sudo snap install alacritty --classic
echo "###############################################"
echo "###############################################"
echo "Performing system cleanup..."
echo "###############################################"
echo "###############################################"
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt autoclean -y
echo "###############################################"
echo "###############################################"
echo "Installing Starship..."
echo "###############################################"
echo "###############################################"
curl -sS https://starship.rs/install.sh | sh
echo "###############################################"
echo "###############################################"
echo "Installing Powerlevel10k..."
echo "###############################################"
echo "###############################################"
sudo apt install git wget curl -y
if [ ! -d "$USER_HOME/powerlevel10k" ]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$USER_HOME/powerlevel10k"
fi
# Only add to .zshrc if it exists and line isn't already there
if [ -f "$USER_HOME/.zshrc" ]; then
if ! grep -q "powerlevel10k.zsh-theme" "$USER_HOME/.zshrc"; then
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >> "$USER_HOME/.zshrc"
fi
else
echo "Warning: .zshrc not found. Powerlevel10k source line not added."
fi
echo "###############################################"
echo "###############################################"
echo "Installation complete!"
echo "###############################################"
echo "###############################################"
echo "Note: You may need to log out and back in for Docker group membership to take effect."
echo "Note: Restart your shell or source your shell config files to use new tools."
echo ""
echo "Please install the following apps manually"
echo "Install Terraform autocomplete for Zsh"
echo "Add flyctl completion to .zshrc"
```
@@ -0,0 +1,52 @@
---
tags:
- Scirpts
- Desktop
---
Copy this to a local sh (shell) file.
```
#!/bin/bash
install_on_fedora() {
sudo dnf install -y ansible
}
install_on_ubuntu() {
sudo apt-get update
sudo apt-get install -y ansible
}
install_on_mac() {
brew install ansible
}
OS="$(uname -s)"
case "${OS}" in
Linux*)
if [ -f /etc/fedora-release ]; then
install_on_fedora
elif [ -f /etc/lsb-release ]; then
install_on_ubuntu
else
echo "Unsupported Linux distribution"
exit 1
fi
;;
Darwin*)
install_on_mac
;;
*)
echo "Unsupported operating system: ${OS}"
exit 1
;;
esac
# ansible-playbook ~/.bootstrap/setup.yml --ask-become-pass
ansible-playbook -i ~/.bootstrap/inventory ~/.bootstrap/install-all-apps.yaml --ask-become-pass
echo "Ansible installation complete."
```
@@ -0,0 +1,30 @@
---
tags:
- Scirpts
- Desktop
- Wireguard
---
^^^ This is all you need to add a wireguard config file. ^^^
If for some reason you still want to use the GUI
Here is my original tutorial
1. Install `nm-connection-editor` via your package manager.
2. Open the Advanced Network Configuration GUI, add a new connection & select WireGuard
![Screenshot from 2023-04-05 18-33-00](https://forum.manjaro.org/uploads/default/original/3X/f/d/fd94540395cf56a59e110db06603faeaf850bd2d.png)
![Screenshot from 2023-04-05 18-33-20](https://forum.manjaro.org/uploads/default/original/3X/6/3/63aa2136115143db16d66cde327087f92b089721.png)
3. Use the following diagram to translate your WireGuard client config file to the Advanced Network Configuration GUI.
[![HowTo](https://forum.manjaro.org/uploads/default/optimized/3X/1/7/177682f37daed1b4e8283f836fd57af349bc4852_2_690x388.jpeg)
HowTo1920×1080 114 KB
](https://forum.manjaro.org/uploads/default/original/3X/1/7/177682f37daed1b4e8283f836fd57af349bc4852.jpeg "HowTo")
Enjoy your WireGuard VPN integrated into the OS!
Note: the “Listen port” will **not** be in your WireGuard client config. I used 58909 & that worked for me.
@@ -0,0 +1,9 @@
---
tags:
- Scirpts
- Desktop
- Wireguard
---
Script to stop the wire-guard connection.
sudo wg-quick down wg0
@@ -0,0 +1,27 @@
---
tags:
- Scirpts
- Desktop
- Wireguard
---
# WireGuard Activation Script (`wg-up.sh`)
This script initializes and activates the configured WireGuard tunnel using `wg-quick`. **Always ensure you have appropriate network permissions (sudo) to run this.**
## Execution Steps
To bring the WireGuard interface online, execute the following command in a privileged shell session:
```bash
sudo wg-quick up wg0
```
### Verification
After running this script, verify the connection status and IP assignment using:
* **Check Tunnel Status:** `wg show`
* **Verify Connectivity:** Attempt to ping an internal service endpoint.
> [!NOTE] Modernized Workflow
While using `sudo wg-quick up wg0` is functional, for system-level automation or service management (e.g., in Docker/Kubernetes), it is best practice to define a corresponding **systemd unit file**. This ensures the connection attempts to start automatically on boot and can be managed via `systemctl status`, providing robust logging and dependency handling beyond simple script execution.
@@ -0,0 +1,30 @@
---
tags:
- Scirpts
- Desktop
- Wireguard
---
# WireGuard VPN Client Configuration (`wg0.conf`)
This file contains the complete configuration for the specified WireGuard tunnel connection (`wg0`). This config must be stored in the appropriate directory (e.g., `/etc/wireguard/wg0.conf` on Linux). **Never share this file** as it contains sensitive private keys and tunnel endpoints.
## Configuration Details
The following parameters define the local interface and peer requirements for a secure connection:
```config
[Interface]
PrivateKey = eEfE3hyySaaXj2FDF0RTty2Y4+5HickA7Ksx9oN+9n4=
Address = 10.0.0.2/32
MTU = 1420
DNS = 192.168.2.9
[Peer]
PublicKey = hVUB9ytn1Fr4hXK45g1UeCnGEtcd3rAXcDM2iPo66Bc=
AllowedIPs = 0.0.0.0/0
Endpoint = wg2.mikemcfetridge.com:51820
PersistentKeepalive = 21
```
> [!NOTE] Modernized Workflow
The process of storing private keys and server configurations in dedicated, secure secrets managers (like HashiCorp Vault) is the modern best practice. Instead of modifying plain text files, consider scripting automatic fetching or injecting these secrets at runtime to reduce exposure risk.