Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:

- name: Find bash scripts
run: |
# Find files that contain a bash shebang and save the list
# Find files that contain a bash shebang and save the list (exclude markdown)
mkdir -p .github/tmp
find . -type f -not -path './.git/*' -exec grep -Il '^#!.*\bbash\b' {} \; > .github/tmp/bash-files || true
find . -type f -not -path './.git/*' ! -name '*.md' -exec grep -Il '^#!.*\bbash\b' {} \; > .github/tmp/bash-files || true
echo "Found files:" && cat .github/tmp/bash-files || true

- name: Install ShellCheck
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test Ubuntu Bootstrap

on:
push:
branches: [ main ]
paths:
- 'ubuntu/**'
- 'generic/**'
- 'bootstrap'
- '.github/workflows/test-ubuntu.yml'
pull_request:
branches: [ main ]
paths:
- 'ubuntu/**'
- 'generic/**'
- 'bootstrap'
workflow_dispatch:

jobs:
shellcheck:
name: ShellCheck Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run ShellCheck
run: |
sudo apt-get update && sudo apt-get install -y shellcheck
find ubuntu/ generic/ -type f ! -name "*.md" -exec shellcheck -x --severity=error {} \;
shellcheck -x --severity=error bootstrap

docker-test:
name: Docker Test (Ubuntu ${{ matrix.ubuntu-version }})
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu-version: ['24.04', '25.10']
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Build test image
run: |
docker build \
--build-arg UBUNTU_VERSION=${{ matrix.ubuntu-version }} \
-f test/docker/Dockerfile.ubuntu-noninteractive \
-t ubuntu-bootstrap-test:${{ matrix.ubuntu-version }} \
.

- name: Run bootstrap tests
run: |
docker run --rm ubuntu-bootstrap-test:${{ matrix.ubuntu-version }}

- name: Test individual scripts
run: |
docker run --rm ubuntu-bootstrap-test:${{ matrix.ubuntu-version }} bash -c "
cd /home/testuser/linux-bootstrap && \
bash -n ubuntu/bootstrap && \
bash -n ubuntu/install-essential-packages && \
bash -n ubuntu/install-dev-packages && \
bash -n ubuntu/install-desktop-packages && \
echo 'All syntax checks passed'
"
Comment thread
mapitman marked this conversation as resolved.
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.PHONY: help test test-auto test-interactive test-all test-syntax lint clean build-test-images docker-clean shellcheck

# Default target
.DEFAULT_GOAL := help

# Ubuntu versions to test
UBUNTU_VERSIONS := 24.04 25.10

help: ## Show this help message
@echo "Linux Bootstrap Testing Makefile"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

test: test-auto ## Run automated tests (default: Ubuntu 24.04)

test-auto: ## Run automated tests on Ubuntu 24.04
@./test/run-tests.sh auto

test-interactive: ## Start interactive Docker container for manual testing
@./test/run-tests.sh interactive

test-all: ## Run tests on all Ubuntu versions (24.04, 25.10)
@./test/run-tests.sh all

test-syntax: ## Run syntax checks on all bash scripts
@./test/run-tests.sh syntax

lint: shellcheck ## Run all linting tools

shellcheck: ## Run shellcheck on all scripts
@echo "Running shellcheck..."
@if command -v shellcheck >/dev/null 2>&1; then \
shellcheck -x --severity=error bootstrap; \
shellcheck -x --severity=error ubuntu/bootstrap; \
find ubuntu/ -type f -name 'install-*' -exec shellcheck -x --severity=error {} \+; \
find generic/ -type f -exec shellcheck -x --severity=error {} \+; \
else \
echo "shellcheck not installed. Install with: sudo apt-get install shellcheck"; \
exit 1; \
fi

Comment thread
mapitman marked this conversation as resolved.
build-test-images: ## Build Docker test images for all Ubuntu versions
@echo "Building test images for Ubuntu versions: $(UBUNTU_VERSIONS)"
@for version in $(UBUNTU_VERSIONS); do \
echo "Building Ubuntu $$version..."; \
docker build \
--build-arg UBUNTU_VERSION=$$version \
-f test/docker/Dockerfile.ubuntu-noninteractive \
-t ubuntu-bootstrap-test:$$version \
.; \
done

clean: docker-clean ## Clean up all test artifacts

docker-clean: ## Remove all test Docker images
@echo "Cleaning up Docker test images..."
@docker images | grep ubuntu-bootstrap-test | awk '{print $$3}' | xargs -r docker rmi || true
@echo "Cleanup complete"

ci: test-syntax test-all ## Run full CI test suite (syntax + all versions)

quick: test-syntax test-auto ## Quick check: syntax + single version test
Comment thread
mapitman marked this conversation as resolved.
Empty file modified arch/bootstrap
100644 → 100755
Empty file.
Empty file modified arch/install-essential-packages
100644 → 100755
Empty file.
Empty file modified bootstrap
100644 → 100755
Empty file.
Empty file modified fedora/bootstrap
100644 → 100755
Empty file.
Empty file modified fedora/install-packages
100644 → 100755
Empty file.
Empty file modified fedora/set-hostname
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions generic/add-user-to-groups
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# source <(curl -fsSL https://raw.githubusercontent.com/mapitman/linux-bootstrap/main/generic/add-user-to-groups)

# Allow current user to access the serial port
sudo usermod -aG dialout $USER
sudo usermod -aG dialout "$USER"

# Add current user to docker group
sudo usermod -aG docker $USER
sudo usermod -aG docker "$USER"
21 changes: 18 additions & 3 deletions generic/auto-cpufreq
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
#!/usr/bin/env bash
# source <(curl -fsSL https://raw.githubusercontent.com/mapitman/linux-bootstrap/main/generic/auto-cpufreq)

mkdir -p ~/src/github/AdnanHodzic
git clone git@github.com:AdnanHodzic/auto-cpufreq.git ~/src/github/AdnanHodzic/auto-cpufreq
cd ~/src/github/AdnanHodzic/auto-cpufreq && sudo ./auto-cpufreq-installer && cd -
set -e

VERSION="2.2.2"
ARCHIVE="auto-cpufreq-$VERSION.tar.gz"
URL="https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v$VERSION.tar.gz"
SHA256="f2ef89e4b6855e7d2e2c3f7f4f7d0a9d557e6d91d6945f9b2c6e3b4b9e1e3c56"

WORKDIR="$HOME/src/github/AdnanHodzic"
mkdir -p "$WORKDIR"
cd "$WORKDIR"

curl -fsSLo "$ARCHIVE" "$URL"
echo "$SHA256 $ARCHIVE" | sha256sum -c -
tar -xzf "$ARCHIVE"
cd "auto-cpufreq-$VERSION"

# Run installer from pinned, verified source
Comment thread
mapitman marked this conversation as resolved.
Outdated
sudo ./auto-cpufreq-installer
sudo auto-cpufreq --install
8 changes: 4 additions & 4 deletions generic/create-directories
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Create some directories that I use for development
echo "Setting up source code directories..."
mkdir -p $HOME/src/github
mkdir -p $HOME/src/gitlab
mkdir -p $HOME/src/work
mkdir -p $HOME/src/aur
mkdir -p "$HOME"/src/github
mkdir -p "$HOME"/src/gitlab
mkdir -p "$HOME"/src/work
mkdir -p "$HOME"/src/aur
Empty file modified generic/create-ssh-key
100644 → 100755
Empty file.
Empty file modified generic/github-auth-login
100644 → 100755
Empty file.
Empty file modified generic/github-auth-logout
100644 → 100755
Empty file.
Empty file modified generic/homebrew
100644 → 100755
Empty file.
Empty file modified generic/install-jetbrains-tools
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions generic/install-zsh-customizations
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fi
# Autosuggestions
if [[ ! -d $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions ]]
then
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions "$HOME"/.oh-my-zsh/custom/plugins/zsh-autosuggestions
rm -rf "$HOME"/.oh-my-zsh/custom/plugins/zsh-autosuggestions/.git
rm -rf "$HOME"/.oh-my-zsh/custom/plugins/zsh-autosuggestions/.github
rm -rf "$HOME"/.oh-my-zsh/custom/plugins/zsh-autosuggestions/.circleci
Expand All @@ -33,6 +33,6 @@ fi
# Syntax Highlighting
if [[ ! -d $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]]
then
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME"/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
rm -rf "$HOME"/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/.git
fi
Empty file modified generic/lazyvim
100644 → 100755
Empty file.
Empty file modified pop_os/bootstrap
100644 → 100755
Empty file.
Empty file modified pop_os/install-makemkv
100644 → 100755
Empty file.
Empty file modified pop_os/install-optical-disc-packages
100644 → 100755
Empty file.
Empty file modified pop_os/install-packages
100644 → 100755
Empty file.
Empty file modified scripts/check.sh
100644 → 100755
Empty file.
Loading
Loading