mirror of
https://codeberg.org/knightsub9/lxcafe.git
synced 2026-07-19 19:30:16 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1f7c675c6 | ||
|
|
63e26040fa | ||
|
|
fb40815e6c | ||
|
|
b9693a455a | ||
|
|
5bffe8f68f | ||
|
|
c3828b8112 | ||
|
|
3c014a480c |
+103
-132
@@ -1,169 +1,140 @@
|
|||||||
AGENTS
|
# AGENTS.md
|
||||||
|
|
||||||
I created this `AGENTS.md` to help agentic coding assistants work in this repository. It contains
|
Guidelines for agentic coding assistants working in this repository.
|
||||||
1) Build / lint / test commands (including how to run a single test) and
|
|
||||||
2) Code style guidelines and conventions to follow when editing code here.
|
|
||||||
|
|
||||||
Repository state
|
## Repository Overview
|
||||||
- This repository contains shell scripts for Linux Mint XFCE post-installation setup.
|
|
||||||
- Main scripts are located in `post_installation_script/` directory.
|
|
||||||
- Testing infrastructure is in `post_installation_script_test/` (Docker/Podman test containers).
|
|
||||||
- No build system, package.json, Makefile, or language-specific project files were detected.
|
|
||||||
- There are no Cursor rules or Copilot instruction files in the repo (checked paths below).
|
|
||||||
- `.cursor/rules/` : not found
|
|
||||||
- `.cursorrules` : not found
|
|
||||||
- `.github/copilot-instructions.md` : not found
|
|
||||||
|
|
||||||
If you add new code (Go, Python, Node, Rust, Java, etc.), follow the per-ecosystem quick commands below.
|
- **Type**: Shell script project for Linux Mint XFCE post-installation setup
|
||||||
|
- **Main scripts**: `post_installation_script/` - Linux Mint XFCE post-installation automation
|
||||||
|
- **Testing**: `post_installation_script_test/` - Docker/Podman container-based testing
|
||||||
|
- **No build system**: Pure shell scripts, no package.json/Makefile/Cargo.toml
|
||||||
|
|
||||||
1) Build / Lint / Test commands
|
---
|
||||||
|
|
||||||
- General notes
|
## 1) Build / Lint / Test Commands
|
||||||
- Run commands from the repository root unless a submodule or service has its own README.
|
|
||||||
- Prefer local, repo-scoped toolchains (venv, node_modules/.bin, go modules, cargo) to avoid global state.
|
|
||||||
|
|
||||||
- Shell scripts
|
### Shell Scripts
|
||||||
- Quick check: `shellcheck scripts/*.sh` (install `shellcheck` first).
|
|
||||||
- Run an individual script: `bash path/to/script.sh` or `./script.sh` (ensure executable bit set).
|
|
||||||
- Syntax check: `bash -n path/to/script.sh`
|
|
||||||
- Trace execution: `bash -x path/to/script.sh` (shows each command as it runs)
|
|
||||||
|
|
||||||
- Testing shell scripts
|
```bash
|
||||||
- See `post_installation_script_test/README.md` for detailed container-based testing instructions.
|
# Syntax check only (no execution)
|
||||||
- Quick start:
|
bash -n path/to/script.sh
|
||||||
- Build image: `./post_installation_script_test/01_create_image.sh`
|
|
||||||
- Start container: `./post_installation_script_test/02_start_container_with_image.sh`
|
|
||||||
|
|
||||||
- Python (if added)
|
# Trace execution (shows each command as it runs)
|
||||||
- Install: `python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt`
|
bash -x path/to/script.sh
|
||||||
- Lint: `ruff .` or `flake8 .`
|
|
||||||
- Format: `black .`
|
|
||||||
- Test all: `pytest -q`
|
|
||||||
- Run a single test: `pytest path/to/test_file.py::TestClass::test_method -q`
|
|
||||||
|
|
||||||
- Node / JavaScript / TypeScript (if added)
|
# Lint with shellcheck (install with: apt install shellcheck)
|
||||||
- Install: `npm ci` or `pnpm install` / `yarn install`
|
shellcheck post_installation_script/*.sh
|
||||||
- Lint: `npm run lint` (or `npx eslint .`)
|
|
||||||
- Format: `npx prettier --write .`
|
|
||||||
- Test all: `npm test` (or `npx vitest` / `npx jest`)
|
|
||||||
- Run a single test:
|
|
||||||
- Jest: `npx jest path/to/file.test.js -t "test name regex"`
|
|
||||||
- Vitest: `npx vitest run path/to/file.spec.ts -t "test name"`
|
|
||||||
|
|
||||||
- Go (if added)
|
# Run individual script
|
||||||
- Build: `go build ./...`
|
bash path/to/script.sh
|
||||||
- Lint: `golangci-lint run` (if configured)
|
./script.sh # requires executable bit: chmod +x script.sh
|
||||||
- Test all: `go test ./...`
|
```
|
||||||
- Run a single test: `go test ./pkg/name -run TestFunctionName`
|
|
||||||
|
|
||||||
- Rust (if added)
|
### Container-Based Testing
|
||||||
- Build: `cargo build`
|
|
||||||
- Lint: `cargo clippy`
|
|
||||||
- Test all: `cargo test`
|
|
||||||
- Run a single test: `cargo test test_name -- --exact`
|
|
||||||
|
|
||||||
- Java / Maven (if added)
|
```bash
|
||||||
- Build: `mvn -DskipTests package`
|
# Build test image (Ubuntu 22.04 with useful utilities)
|
||||||
- Lint/format: use `spotless`/`checkstyle` if configured
|
cd post_installation_script_test
|
||||||
- Test all: `mvn test`
|
bash 01_create_image.sh
|
||||||
- Run a single test: `mvn -Dtest=ClassName#methodName test`
|
|
||||||
|
|
||||||
- .NET (if added)
|
# Start interactive container (auto-removed on exit)
|
||||||
- Build: `dotnet build`
|
bash 02_start_container_with_image.sh
|
||||||
- Test all: `dotnet test`
|
|
||||||
- Run a single test: `dotnet test --filter FullyQualifiedName~Namespace.ClassName.MethodName`
|
|
||||||
|
|
||||||
- CI / Automation
|
# Inside container - source scripts mounted at /workspace:
|
||||||
- If you add GitHub Actions, keep workflows idempotent and cache dependencies carefully.
|
bash /workspace/<scriptName>.sh
|
||||||
- Avoid secrets in workflows; read sensitive values from repository/organization secrets.
|
```
|
||||||
|
|
||||||
2) Code style guidelines
|
### Single Test Commands (for future languages)
|
||||||
|
|
||||||
The guidance below is intentionally general and focuses on consistency, readability and safety so
|
```bash
|
||||||
agentic tools can make changes predictably across multiple languages.
|
# Python: pytest path/to/test.py::TestClass::test_method -q
|
||||||
|
# Node/Jest: npx jest path/to/file.test.js -t "test name regex"
|
||||||
|
# Node/Vitest: npx vitest run path/to/file.spec.ts -t "test name"
|
||||||
|
# Go: go test ./pkg/name -run TestFunctionName
|
||||||
|
# Rust: cargo test test_name -- --exact
|
||||||
|
# Java/Maven: mvn -Dtest=ClassName#methodName test
|
||||||
|
# .NET: dotnet test --filter FullyQualifiedName~Namespace.ClassName.MethodName
|
||||||
|
```
|
||||||
|
|
||||||
- Formatting
|
---
|
||||||
- Use an automated formatter for the language (Black for Python, Prettier for JS/TS, gofmt/gofmt -s for Go,
|
|
||||||
rustfmt for Rust). Commit formatted code only.
|
|
||||||
- Use an editorconfig file for basic whitespace/indentation rules when possible.
|
|
||||||
|
|
||||||
- Imports / dependencies
|
## 2) Code Style Guidelines
|
||||||
- Keep imports explicit and minimal: import only what you use.
|
|
||||||
- Group imports in a logical order (language default + third-party + local project). Leave a blank line between groups.
|
|
||||||
- Don’t commit unused dependencies; remove them from lock files / manifests and run the linter.
|
|
||||||
|
|
||||||
- Types / typing
|
### Shell Scripts (Primary Language)
|
||||||
- Prefer explicit types where the language supports them (TypeScript types, Python type hints, Go static types).
|
|
||||||
- Add types for public interfaces and complex logic; internal simple helper functions may rely on inference.
|
|
||||||
|
|
||||||
- Naming conventions
|
- **Shebang**: Use `#!/bin/bash` (not `/bin/sh`) for bash-specific features
|
||||||
- Use clear, descriptive names. Prefer `calculate_total`, `prepare_connection`, `user_id` style for snake_case languages.
|
- **Safety**: Use `set -euo pipefail` at script start
|
||||||
- For camelCase languages (JS/TS): `calculateTotal`, `prepareConnection`.
|
- **Quotes**: Always use double quotes for variable expansion: `"$VAR"`, never bare `$VAR`
|
||||||
- Types and classes: use PascalCase/UpperCamelCase: `UserService`, `HttpClient`.
|
- **Conditionals**: Use `[[ ]]` for tests, not `[ ]`
|
||||||
- Constants: use UPPER_SNAKE_CASE or language-specific constant conventions.
|
- **Variables**: Use `readonly` for constants, `local` for function-scoped variables
|
||||||
|
- **Performance**: Prefer functions over subshells when possible
|
||||||
|
- **Naming**: Use descriptive function names: `install_fonts()`, `configure_panel()`, `prompt_user()`
|
||||||
|
- **Errors**: Write to stderr: `echo "Error: $msg" >&2`
|
||||||
|
- **Exit codes**: 0=success, 1=general error, 2=invalid usage
|
||||||
|
- **Comments**: Avoid unless explaining non-obvious behavior
|
||||||
|
- **Constants**: Define at top of script, UPPER_SNAKE_CASE
|
||||||
|
|
||||||
- Functions and modules
|
### General Conventions
|
||||||
- Keep functions small (ideally < 40 lines) and single-responsibility.
|
|
||||||
- Prefer pure functions where possible; keep side effects explicit and isolated.
|
|
||||||
- Organize modules by feature/domain, not solely by type (avoid monolithic god-modules).
|
|
||||||
|
|
||||||
- Error handling
|
- **Formatting**: Use automated formatters (Black/Prettier/gofmt/rustfmt) - commit formatted code
|
||||||
- Fail fast and return/raise errors with context (message + cause) rather than swallowing them.
|
- **Types**: Prefer explicit typing (TypeScript types, Python type hints, Go static types)
|
||||||
- Avoid logging raw errors in library code; return errors to callers and let the application layer decide logging.
|
- **Naming**:
|
||||||
- Use typed error types when the language supports it (Go error types, custom exceptions in Python/JS).
|
- snake_case: variables, functions (`user_id`, `calculate_total`)
|
||||||
- Clean up resources with `finally`/`defer` equivalents to avoid leaks.
|
- PascalCase: types/classes (`UserService`, `HttpClient`)
|
||||||
|
- UPPER_SNAKE_CASE: constants (`MAX_RETRIES`, `API_BASE_URL`)
|
||||||
|
- **Imports**: Keep minimal, group logically (stdlib → third-party → local), blank line between groups
|
||||||
|
- **Functions**: Keep small (<40 lines), single responsibility, pure where possible
|
||||||
|
- **Error handling**: Fail fast with context, avoid silent failures, use typed errors where supported
|
||||||
|
- **Tests**: Deterministic, mock external I/O, explicit names like `test_should_return_400_when_missing_field`
|
||||||
|
- **Resources**: Always clean up with `finally`/`defer` equivalents
|
||||||
|
|
||||||
- Tests
|
---
|
||||||
- Prefer small, deterministic unit tests. Mock external IO and network where reasonable.
|
|
||||||
- Use explicit fixtures and avoid implicit global state between tests.
|
|
||||||
- Name tests with the behavior they assert: `test_calculate_total_with_discounts` or `shouldReturn400WhenMissingField`.
|
|
||||||
|
|
||||||
- Logging and observability
|
## 3) Security
|
||||||
- Use structured logging where available (JSON structured logs for services).
|
|
||||||
- Avoid printing raw stack traces to stdout in production code; include them at debug level.
|
|
||||||
|
|
||||||
- Security and secrets
|
- Never commit secrets, API keys, credentials, or tokens
|
||||||
- Never commit secrets, API keys, or credentials. Use environment variables and vaults.
|
- Use environment variables for sensitive values
|
||||||
- Validate and sanitize external input at the boundaries of the system.
|
- Validate and sanitize all external input
|
||||||
|
- Run linting (`shellcheck`) before committing shell scripts
|
||||||
|
|
||||||
- Performance
|
---
|
||||||
- Measure before optimizing. Prefer clarity over micro-optimizations unless a hotspot is identified.
|
|
||||||
|
|
||||||
3) Code review / commit guidance for agents
|
## 4) Commit Guidelines
|
||||||
|
|
||||||
- Make small, focused commits and include a one-line summary plus a short description of the why.
|
- Make small, focused commits with descriptive messages
|
||||||
- When changing behavior, add or update tests that verify the new/changed behavior.
|
- Include formatter command in commit message if auto-formatting
|
||||||
- If you reformat files automatically, include the formatter command in the commit message to make CI reproduction easy.
|
- When changing behavior, add or update tests
|
||||||
|
- Run full test suite before opening PRs
|
||||||
|
|
||||||
4) Repo housekeeping checks (recommended for agents)
|
---
|
||||||
|
|
||||||
- When adding a new language or framework, add an entry to this file with the exact commands required to build/test.
|
## 5) Cursor / Copilot Rules
|
||||||
- Add CI workflows to run lint + tests on PRs and enable branch protection rules if this becomes a shared repo.
|
|
||||||
- **Session storage**: Store session logs and working notes in `.agents/sessions/` folder for future reference. Use descriptive filenames (e.g., `session-<date>-<topic>.md`).
|
|
||||||
|
|
||||||
5) Cursor / Copilot rules
|
- `.cursor/rules/`: Not present
|
||||||
|
- `.cursorrules`: Not present
|
||||||
|
- `.github/copilot-instructions.md`: Not present
|
||||||
|
|
||||||
- Cursor rules: none present at `.cursor/rules/` or `.cursorrules` in this repository.
|
---
|
||||||
- GitHub Copilot instructions: none present at `.github/copilot-instructions.md`.
|
|
||||||
|
|
||||||
If you add any of these files, update this document and include the exact file path and relevant sections for agents to follow.
|
## 6) Repo Housekeeping
|
||||||
|
|
||||||
Quick checklist for an agent making changes
|
- Store session logs in `.agents/sessions/` for reference
|
||||||
- Run local linter/formatter configured for the language before opening a PR.
|
- When adding new languages, update this file with exact build/test commands
|
||||||
- Run the test suite and the single-test command for any tests you added/changed.
|
|
||||||
- Do not add secrets to the tree; use placeholders and document required environment variables.
|
|
||||||
|
|
||||||
Next steps (recommended)
|
---
|
||||||
1) Add a minimal `Makefile` or `package.json` scripts for common tasks so agents can run `make test` / `npm test`.
|
|
||||||
2) If the project will contain multiple services, add per-service README files and CI workflows.
|
|
||||||
3) Add EditorConfig + language-specific formatter configs (pyproject.toml, .prettierrc, rustfmt.toml) to lock formatting rules.
|
|
||||||
|
|
||||||
Files referenced
|
## Files Referenced
|
||||||
- Root `README.md`
|
|
||||||
- `post_installation_script/README.md` - main script usage
|
|
||||||
- `post_installation_script_test/README.md` - testing instructions
|
|
||||||
- `.cursor/rules/` (not present)
|
|
||||||
- `.cursorrules` (not present)
|
|
||||||
- `.github/copilot-instructions.md` (not present)
|
|
||||||
|
|
||||||
If anything in this file needs to be stricter or you want another style (for example a fully opinionated TS style), say which language or style and I will update `AGENTS.md` accordingly.
|
- `README.md` - Project overview
|
||||||
|
- `post_installation_script/README.md` - Script usage and details
|
||||||
|
- `post_installation_script_test/README.md` - Container testing instructions
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Checklist for Changes
|
||||||
|
|
||||||
|
- [ ] Run `shellcheck` on shell scripts before committing
|
||||||
|
- [ ] Verify `bash -n` syntax check passes
|
||||||
|
- [ ] Test script changes in container first
|
||||||
|
- [ ] No secrets in code - use environment variables
|
||||||
|
- [ ] Run tests if added for new functionality
|
||||||
|
|||||||
Executable
+128
@@ -0,0 +1,128 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
question_answered_with_yes() {
|
||||||
|
local prompt="$1"
|
||||||
|
local ans
|
||||||
|
printf '%b\n Enter y or n and press Enter,\n abort with any other key ... [y/N]: ' "$prompt"
|
||||||
|
read -r ans
|
||||||
|
case "$ans" in
|
||||||
|
y|Y) return 0 ;;
|
||||||
|
n|N|"") return 1 ;;
|
||||||
|
*) echo "Aborted."; exit 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
echo "Error: You have uncommitted local changes."
|
||||||
|
echo "Please commit or stash them before releasing."
|
||||||
|
echo ""
|
||||||
|
echo "Uncommitted files:"
|
||||||
|
git status --short
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Fetching latest changes..."
|
||||||
|
git fetch origin
|
||||||
|
|
||||||
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
if [ "$CURRENT_BRANCH" = "main" ]; then
|
||||||
|
echo "Pulling latest from main..."
|
||||||
|
git pull origin main || true
|
||||||
|
else
|
||||||
|
echo "Error: You must be on the main branch to create a release."
|
||||||
|
echo "Current branch: $CURRENT_BRANCH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION_FILE="VERSION"
|
||||||
|
SCRIPT_FILE="post_installation_script/Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh"
|
||||||
|
|
||||||
|
if [ ! -f "$VERSION_FILE" ]; then
|
||||||
|
echo "Error: $VERSION_FILE not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_VERSION=$(cat "$VERSION_FILE" | tr -d '\n')
|
||||||
|
|
||||||
|
if [ ! -f "$SCRIPT_FILE" ]; then
|
||||||
|
echo "Error: $SCRIPT_FILE not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_MAJOR=${CURRENT_VERSION#v}
|
||||||
|
|
||||||
|
if ! [[ "$CURRENT_VERSION" =~ ^v[0-9]+$ ]]; then
|
||||||
|
echo "Error: Invalid version format in $VERSION_FILE. Expected v0, v1, v2, etc."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NEXT_VERSION=$((CURRENT_MAJOR + 1))
|
||||||
|
NEXT_VERSION_STR="v$NEXT_VERSION"
|
||||||
|
|
||||||
|
RELEASE_BRANCH="release/$NEXT_VERSION_STR"
|
||||||
|
|
||||||
|
if git ls-remote --heads origin "$RELEASE_BRANCH" 2>/dev/null | grep -q .; then
|
||||||
|
echo "Error: Branch $RELEASE_BRANCH already exists on remote."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git rev-parse "$RELEASE_BRANCH" >/dev/null 2>&1; then
|
||||||
|
echo "Branch $RELEASE_BRANCH exists locally."
|
||||||
|
if question_answered_with_yes "Delete local branch and continue?"; then
|
||||||
|
git branch -D "$RELEASE_BRANCH"
|
||||||
|
else
|
||||||
|
echo "Release aborted."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Current version: $CURRENT_VERSION"
|
||||||
|
echo "Proposed version: $NEXT_VERSION_STR"
|
||||||
|
echo "Release branch: $RELEASE_BRANCH"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if ! question_answered_with_yes "Confirm release version $NEXT_VERSION_STR?"; then
|
||||||
|
echo "Release aborted."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Creating release branch $RELEASE_BRANCH..."
|
||||||
|
git checkout -b "$RELEASE_BRANCH"
|
||||||
|
|
||||||
|
echo "$NEXT_VERSION_STR" > "$VERSION_FILE"
|
||||||
|
|
||||||
|
sed -i.bak "s/^SCRIPT_VERSION=.*/SCRIPT_VERSION=\"$NEXT_VERSION_STR\"/" "$SCRIPT_FILE"
|
||||||
|
if [ -f "${SCRIPT_FILE}.bak" ]; then
|
||||||
|
rm "${SCRIPT_FILE}.bak"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add "$VERSION_FILE" "$SCRIPT_FILE"
|
||||||
|
git commit -m "Release $NEXT_VERSION_STR"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Release $NEXT_VERSION_STR prepared on branch $RELEASE_BRANCH."
|
||||||
|
if question_answered_with_yes "Push release branch to origin?"; then
|
||||||
|
git push -u origin "$RELEASE_BRANCH"
|
||||||
|
echo ""
|
||||||
|
echo "Branch pushed to origin."
|
||||||
|
echo ""
|
||||||
|
echo "Next steps:"
|
||||||
|
echo "1. Create a PR from $RELEASE_BRANCH to main"
|
||||||
|
echo " - Via web: Go to your git hosting and create a PR"
|
||||||
|
echo " - Or: gh pr create --base main --head $RELEASE_BRANCH"
|
||||||
|
echo ""
|
||||||
|
echo "2. After PR is merged, create a tag:"
|
||||||
|
echo " git checkout main && git pull"
|
||||||
|
echo " git tag -a $NEXT_VERSION_STR -m \"Release $NEXT_VERSION_STR\""
|
||||||
|
echo " git push origin $NEXT_VERSION_STR"
|
||||||
|
echo ""
|
||||||
|
echo "3. Gitea will create a release from the tag"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Release prepared locally. Push manually with:"
|
||||||
|
echo " git push -u origin $RELEASE_BRANCH"
|
||||||
|
echo ""
|
||||||
|
echo "Then create a PR to main via your git hosting."
|
||||||
|
fi
|
||||||
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
question_answered_with_yes() {
|
||||||
|
local prompt="$1"
|
||||||
|
local ans
|
||||||
|
printf '%b\n Enter y or n and press Enter,\n abort with any other key ... [y/N]: ' "$prompt"
|
||||||
|
read -r ans
|
||||||
|
case "$ans" in
|
||||||
|
y|Y) return 0 ;;
|
||||||
|
n|N|"") return 1 ;;
|
||||||
|
*) echo "Aborted."; exit 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Fetching latest from origin..."
|
||||||
|
git fetch origin
|
||||||
|
git checkout main
|
||||||
|
git pull origin main
|
||||||
|
|
||||||
|
VERSION_FILE="VERSION"
|
||||||
|
CURRENT_VERSION=$(cat "$VERSION_FILE" | tr -d '\n')
|
||||||
|
|
||||||
|
echo "Finalising release of version: $CURRENT_VERSION"
|
||||||
|
|
||||||
|
if ! question_answered_with_yes "Create tag $CURRENT_VERSION on main?"; then
|
||||||
|
echo "Tag creation aborted."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git tag -a "$CURRENT_VERSION" -m "Release $CURRENT_VERSION"
|
||||||
|
|
||||||
|
if question_answered_with_yes "Push tag to origin?"; then
|
||||||
|
git push origin "$CURRENT_VERSION"
|
||||||
|
echo ""
|
||||||
|
echo "Tag $CURRENT_VERSION pushed to origin."
|
||||||
|
echo "Gitea will create a release from the tag."
|
||||||
|
else
|
||||||
|
echo "Tag created locally. Push manually with:"
|
||||||
|
echo " git push origin $CURRENT_VERSION"
|
||||||
|
fi
|
||||||
@@ -20,30 +20,39 @@ This way you can test the script multiple times without needing to reinstall Lin
|
|||||||
|
|
||||||
## Release Process
|
## Release Process
|
||||||
|
|
||||||
This project uses a simple release process based on git tags.
|
This project uses a two-step release process.
|
||||||
|
|
||||||
### Versioning
|
### Versioning
|
||||||
- Version is stored in `VERSION` file (format: v0, v1, v2, ...)
|
- Version is stored in `VERSION` file (format: v0, v1, v2, ...)
|
||||||
- Major version increments only (major-bugfix scheme)
|
- Major version increments only
|
||||||
- Script version is also stored in `SCRIPT_VERSION` variable within the main script to display version during script execution
|
- Script version stored in `SCRIPT_VERSION` variable
|
||||||
|
|
||||||
### Creating a Release
|
### Step 1: Prepare Release
|
||||||
Run the release script from the repository root:
|
- Make sure you are on main branch with no local changes. Script will abort otherwise
|
||||||
|
Run from repository root:
|
||||||
```bash
|
```bash
|
||||||
./release.sh
|
./01_prepare_release.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
The script will:
|
The script will:
|
||||||
1. Check for uncommitted local changes (exits if any exist)
|
- Update VERSION file and SCRIPT_VERSION in the script
|
||||||
2. Show current version and propose next version
|
- Create a release branch (e.g., `release/v1`)
|
||||||
3. Prompt for confirmation
|
- Push the release branch
|
||||||
4. Update VERSION file and SCRIPT_VERSION in the script
|
|
||||||
5. Create a git commit
|
|
||||||
6. Create an annotated tag
|
|
||||||
7. Prompt to push to origin (including tags)
|
|
||||||
|
|
||||||
### Gitea Integration
|
### After step 1 (manual)
|
||||||
When a tag is pushed to the remote, Gitea automatically creates a release from it.
|
- Create and merge PR from release branch to main
|
||||||
|
|
||||||
|
### Step 2: Finalize Release (After PR Merged)
|
||||||
|
Run from repository root:
|
||||||
|
```bash
|
||||||
|
./02_finalise_release.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The script will:
|
||||||
|
- Create and push tag for release version to main
|
||||||
|
|
||||||
|
### After step 2 (manual)
|
||||||
|
- Create a release in gitea
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
- Clean working tree (no uncommitted changes)
|
- Clean working tree (no uncommitted changes)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_VERSION="v9"
|
SCRIPT_VERSION="v10"
|
||||||
|
|
||||||
bIsVlcInstalled=false
|
bIsVlcInstalled=false
|
||||||
|
|
||||||
@@ -31,9 +31,7 @@ echo "
|
|||||||
# Das Skript bietet -teilweise interaktiv- die Installation von zusätzlichen Programmen an, die Linux Mint XFCE nicht standardmässig mitbringt.
|
# Das Skript bietet -teilweise interaktiv- die Installation von zusätzlichen Programmen an, die Linux Mint XFCE nicht standardmässig mitbringt.
|
||||||
#
|
#
|
||||||
# Folgende Dateien werden aus dem Skript referenziert und werden im selben Verzeichnis wie dieses Skript erwartet
|
# Folgende Dateien werden aus dem Skript referenziert und werden im selben Verzeichnis wie dieses Skript erwartet
|
||||||
## - Microsoft Aptos Fonts.zip
|
## - xfce4-panel-profiles.tar.bz2
|
||||||
## - google-fonts.tar.gz
|
|
||||||
## - xfce4-panel.xml
|
|
||||||
#
|
#
|
||||||
# Zu Beginn werden die folgenden zusätzlichen Programme in einem Schritt installiert:
|
# Zu Beginn werden die folgenden zusätzlichen Programme in einem Schritt installiert:
|
||||||
#
|
#
|
||||||
@@ -115,63 +113,58 @@ if question_answered_with_yes " ### Installiere Aptos Schriften? ###"; then
|
|||||||
echo
|
echo
|
||||||
echo "### Aptos Schriften ###"
|
echo "### Aptos Schriften ###"
|
||||||
|
|
||||||
_aptos_zip="Microsoft Aptos Fonts.zip"
|
_aptos_zip="/tmp/Microsoft Aptos Fonts.zip"
|
||||||
if [ ! -f "$_aptos_zip" ]; then
|
_aptos_url="https://download.microsoft.com/download/8/6/0/860a94fa-7feb-44ef-ac79-c072d9113d69/Microsoft%20Aptos%20Fonts.zip"
|
||||||
echo ""
|
|
||||||
echo "$_aptos_zip nicht gefunden."
|
echo "Lade Aptos Schriften herunter..."
|
||||||
echo "Bitte laden Sie die Datei von Microsoft herunter und legen Sie sie im selben Verzeichnis wie dieses Skript ab."
|
wget "$_aptos_url" -O "$_aptos_zip"
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "Entpacke das Archiv..."
|
echo "Entpacke das Archiv..."
|
||||||
unzip -o "$_aptos_zip"
|
unzip -o "$_aptos_zip" -d /tmp/aptos_fonts
|
||||||
echo "Erstelle /usr/share/fonts/truetype/aptos/"
|
echo "Erstelle /usr/share/fonts/truetype/aptos/"
|
||||||
sudo mkdir -p /usr/share/fonts/truetype/aptos
|
sudo mkdir -p /usr/share/fonts/truetype/aptos
|
||||||
echo "Installiere alle .ttf Schriften..."
|
echo "Installiere alle .ttf Schriften..."
|
||||||
find . -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/aptos/ \; 2>/dev/null || true
|
find /tmp/aptos_fonts -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/aptos/ \; 2>/dev/null || true
|
||||||
echo "Aktualisiere den Font-Cache"
|
echo "Aktualisiere den Font-Cache"
|
||||||
fc-cache -f
|
fc-cache -f
|
||||||
echo "Fertig! Aptos Schriftarten sind installiert."
|
echo "Fertig! Aptos Schriftarten sind installiert."
|
||||||
fi
|
|
||||||
|
echo "Entferne temporäre Dateien..."
|
||||||
|
rm -rf "$_aptos_zip" /tmp/aptos_fonts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo " ## freie Google-Schriften als Ersatz für aktuelle MS-Standardschriften installieren:"
|
echo " ## freie Google-Schriften"
|
||||||
if question_answered_with_yes " ### Installiere Google Schriften? ###"; then
|
if question_answered_with_yes " ### Installiere Google Schriften? ###"; then
|
||||||
echo
|
echo
|
||||||
echo "### Google Schriften ###"
|
echo "### Google Schriften ###"
|
||||||
|
|
||||||
_gf="google-fonts"
|
_google_fonts_dir="/usr/share/fonts/truetype/google-fonts"
|
||||||
fGoogleSchriften=./$_gf".tar.gz"
|
_google_fonts_url_base="https://gwfh.mranftl.com/api/fonts"
|
||||||
if [ ! -f "$fGoogleSchriften" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "$fGoogleSchriften nicht gefunden."
|
|
||||||
echo " soll das Archiv "google-fonts.tar.gz" von Github heruntergeladen werden? Es ist ca. 1,4GB gross! "
|
|
||||||
if question_answered_with_yes " ### Download Google Schriften ###"; then
|
|
||||||
_wgeturl="https://github.com/google/fonts/archive/main.tar.gz"
|
|
||||||
echo "Connecting to Github server to download fonts..."
|
|
||||||
wget "$_wgeturl" -O "$_gf.tar.gz"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -f "$fGoogleSchriften" ]; then
|
|
||||||
echo
|
|
||||||
echo "Extracting the downloaded archive..."
|
|
||||||
tar -zxvf "$_gf.tar.gz"
|
|
||||||
echo "Creating the /usr/share/fonts/truetype/$_gf folder"
|
|
||||||
sudo mkdir -p /usr/share/fonts/truetype/$_gf
|
|
||||||
echo "Installing all .ttf fonts in /usr/share/fonts/truetype/$_gf"
|
|
||||||
find "$PWD/fonts-main/" -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/google-fonts/ \; || echo "An error occured, please run this script again."
|
|
||||||
echo "Updating the font cache"
|
|
||||||
fc-cache -f
|
|
||||||
echo "Done. Now you can delete the tarball file $_gf.tar.gz if you wish."
|
|
||||||
|
|
||||||
echo "Temporärer Fontordner wird gelöscht"
|
_google_fonts="arimo carlito caladea inconsolata cousine libre-franklin neuton cabin oswald crimson-text lustria tinos league-spartan pt-sans"
|
||||||
rm -r fonts-main
|
|
||||||
echo "Google-Schriften sind installiert. Die Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office muss manuell erfolgen, falls gewünscht."
|
sudo mkdir -p "$_google_fonts_dir"
|
||||||
|
|
||||||
|
for _font in $_google_fonts; do
|
||||||
|
echo "Lade $_font herunter..."
|
||||||
|
curl -s -o /tmp/"$_font".zip "${_google_fonts_url_base}/$_font?download=zip&subsets=latin,latin-ext&variants=regular,700"
|
||||||
|
if [ -s /tmp/"$_font".zip ] && head -c 2 /tmp/"$_font".zip | grep -q "PK"; then
|
||||||
|
unzip -o /tmp/"$_font".zip -d /tmp/"$_font"_fonts
|
||||||
|
sudo cp /tmp/"$_font"_fonts/fonts/"$_font"/* "$_google_fonts_dir/" 2>/dev/null || \
|
||||||
|
sudo cp /tmp/"$_font"_fonts/* "$_google_fonts_dir/" 2>/dev/null || true
|
||||||
|
rm -rf /tmp/"$_font".zip /tmp/"$_font"_fonts
|
||||||
else
|
else
|
||||||
echo "Schriften Fehlen immer noch. Manuell herunterladen und installieren"
|
echo "Fehler: Download von $_font fehlgeschlagen, überspringe..."
|
||||||
|
rm -f /tmp/"$_font".zip
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Aktualisiere den Font-Cache"
|
||||||
|
fc-cache -f
|
||||||
|
echo "Fertig! Google Schriftarten sind installiert."
|
||||||
|
echo "Die Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office muss manuell erfolgen, falls gewünscht."
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ This directory contains files belonging to the Linux Mint XFCE post-installation
|
|||||||
- Linux Mint XFCE installed and running
|
- Linux Mint XFCE installed and running
|
||||||
- Internet connection for downloading packages and updates
|
- Internet connection for downloading packages and updates
|
||||||
- Script file: `Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh` copied to Desktop
|
- Script file: `Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh` copied to Desktop
|
||||||
- External files are referenced by the script, please check header comments in the script
|
|
||||||
|
No external files need to be pre-downloaded.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|||||||
-85
@@ -1,85 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
|
||||||
echo "Error: You have uncommitted local changes."
|
|
||||||
echo "Please commit or stash them before releasing."
|
|
||||||
echo ""
|
|
||||||
echo "Uncommitted files:"
|
|
||||||
git status --short
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION_FILE="VERSION"
|
|
||||||
SCRIPT_FILE="post_installation_script/Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh"
|
|
||||||
|
|
||||||
if [ ! -f "$VERSION_FILE" ]; then
|
|
||||||
echo "Error: $VERSION_FILE not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
CURRENT_VERSION=$(cat "$VERSION_FILE" | tr -d '\n')
|
|
||||||
|
|
||||||
if [ ! -f "$SCRIPT_FILE" ]; then
|
|
||||||
echo "Error: $SCRIPT_FILE not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
CURRENT_MAJOR=${CURRENT_VERSION#v}
|
|
||||||
|
|
||||||
if ! [[ "$CURRENT_VERSION" =~ ^v[0-9]+$ ]]; then
|
|
||||||
echo "Error: Invalid version format in $VERSION_FILE. Expected v0, v1, v2, etc."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
NEXT_VERSION=$((CURRENT_MAJOR + 1))
|
|
||||||
NEXT_VERSION_STR="v$NEXT_VERSION"
|
|
||||||
|
|
||||||
if git rev-parse "refs/tags/$NEXT_VERSION_STR" >/dev/null 2>&1; then
|
|
||||||
echo "Error: Tag $NEXT_VERSION_STR already exists locally."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if git remote get-url origin >/dev/null 2>&1; then
|
|
||||||
if git ls-remote --tags origin "$NEXT_VERSION_STR" 2>/dev/null | grep -q "$NEXT_VERSION_STR"; then
|
|
||||||
echo "Error: Tag $NEXT_VERSION_STR already exists on remote."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Warning: No remote configured. You can still create the release locally."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Current version: $CURRENT_VERSION"
|
|
||||||
echo "Proposed version: $NEXT_VERSION_STR"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
read -p "Confirm release version $NEXT_VERSION_STR? [y/N]: " confirm
|
|
||||||
|
|
||||||
if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then
|
|
||||||
echo "Release aborted."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$NEXT_VERSION_STR" > "$VERSION_FILE"
|
|
||||||
|
|
||||||
sed -i.bak "s/^SCRIPT_VERSION=.*/SCRIPT_VERSION=\"$NEXT_VERSION_STR\"/" "$SCRIPT_FILE"
|
|
||||||
if [ -f "${SCRIPT_FILE}.bak" ]; then
|
|
||||||
rm "${SCRIPT_FILE}.bak"
|
|
||||||
fi
|
|
||||||
|
|
||||||
git add "$VERSION_FILE" "$SCRIPT_FILE"
|
|
||||||
git commit -m "Release $NEXT_VERSION_STR"
|
|
||||||
|
|
||||||
git tag -a "$NEXT_VERSION_STR" -m "Release $NEXT_VERSION_STR"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Tag $NEXT_VERSION_STR created locally."
|
|
||||||
read -p "Push to origin (includes tags)? [y/N]: " push_confirm
|
|
||||||
|
|
||||||
if [[ "$push_confirm" == "y" || "$push_confirm" == "Y" ]]; then
|
|
||||||
git push origin --tags
|
|
||||||
echo "Done! Gitea will create release from tag $NEXT_VERSION_STR"
|
|
||||||
else
|
|
||||||
echo "Release prepared locally. Push manually with: git push origin --tags"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user