Skip to content

Instantly share code, notes, and snippets.

View gr1f's full-sized avatar

J. Griffin gr1f

View GitHub Profile
@gr1f
gr1f / README.md
Created October 7, 2025 16:19
Arch Linux - BTRFS compression, cryptosetup, automounting

Arch Linux Advanced Setup Assistant: A Comprehensive Guide

This document provides a detailed explanation for the arch_setup_assistant.sh script, a tool designed to safely automate two powerful but complex configurations on an Arch Linux system: setting up a Btrfs filesystem for efficient snapshots and configuring an encrypted secondary drive for automatic mounting at boot.

The script is intended for users who are comfortable with the command line but want to ensure these advanced procedures are performed correctly and safely, incorporating best practices and automated checks to prevent common errors.

WARNING: These operations make significant changes to your system's core configuration. While this script is built with numerous safeguards, you are strongly encouraged to have a complete backup of your important data before proceeding.

How to Use the Script

@gr1f
gr1f / bootmail.service
Created August 16, 2023 20:02
Startup/shutdown e-mail notification service (requires postfix, mailx/mailutils, and systemd)
[Unit]
Description=Run Scripts at Start and Stop
Before=shutdown.target network.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash -c '/path/to/bootmail.sh startup'
ExecStop=/bin/bash -c '/path/to/bootmail.sh shutdown'
TimeoutStopSec=60
@gr1f
gr1f / setup.sh
Created August 16, 2023 19:38
Install, configure, and test postfix fast (Debian)
#s/domain\.tld/yourdomain
#s/username/yourusername
sudo apt install postfix mailutils #s/apt/dnf/ & s/utils/x if on RHEL systems
postconf -e 'relayhost = smtp-server.domain.tld' #add smtp relay/server
postconf -e 'smtp_header_checks = regexp:/etc/postfix/header_check'
echo '/^From:.*/ REPLACE From: hostname@domain.tld' > /etc/postfix/header_check
systemctl restart postfix
echo "`date`" | mailx -s "TEST" username@domain.tld
#Depending on need, force postfix to send to a specific e-mail address:
#!/bin/bash
# To run this script in one line without downloading to storage:
# curl GISTRAWURL | sudo bash -
if [[ $UID -ne 0 ]]; then
echo "Please run with sudo"
exit 1
fi
function install_auditd_rules() {
systemctl enable auditd