This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -eux | |
| cleanup() { | |
| sudo umount /mnt/flasher | |
| sudo losetup -d "${loopback_device:-}" | |
| } | |
| trap cleanup EXIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Pull alpine image for the correct platform (avoid pulling the wrong platform on Pi Zero) | |
| balena pull alpine --platform linux/arm/v6 | |
| # Run inotifywatch to gather filesystem access statistics for 5m | |
| balena run --rm -it -v /mnt/data:/mnt/data:ro alpine sh -c \ | |
| 'apk add --no-cache inotify-tools && /usr/bin/inotifywatch -v -t 300 -r /mnt/data' | |
| # Run iostat with 5 min intervals | |
| balena run --rm --privileged alpine iostat -z -k -t -d 300 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| GH_TOKEN="$(<"${HOME}/.github_pat")" | |
| github_org="balena-os" | |
| repo_yaml_match="yocto-based OS image" | |
| clone_root_path="src" # Set the root repository clone path here | |
| # known_branches=("pyro" "rocko" "sumo" "thud" "warrior" "zeus" "dunfell" "honister" "kirkstone" "master" "main") # Add your list of known branches here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for file in .github/repos/*.yml; do | |
| # delete custom merge settings | |
| yq e 'del(.repository)' -i "$file" | |
| # delete required approving review count as we use policy-bot instead | |
| yq e 'del(.branches[].protection.required_pull_request_reviews.required_approving_review_count)' -i "$file" | |
| if [ "$(yq e '.branches[].protection.required_pull_request_reviews' "$file")" = "{}" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // update_gitmodules.mjs | |
| import fs from 'fs/promises'; | |
| import path from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| import readline from 'readline'; | |
| import { parse } from 'ini'; | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // update_gitmodules.mjs | |
| import fs from 'fs/promises'; | |
| import path from 'path'; | |
| import { fileURLToPath } from 'url'; | |
| import readline from 'readline'; | |
| import { parse, stringify } from 'ini'; | |
| import simpleGit from 'simple-git'; | |
| import { createPatch } from 'diff'; | |
| const __filename = fileURLToPath(import.meta.url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # dhcp-to-static.sh - Safely migrate balenaOS between DHCP and static IP | |
| # | |
| # Uses a "dead man's switch" rollback pattern: a background timer will | |
| # automatically revert to the previous configuration unless explicitly | |
| # cancelled after successful connectivity verification. | |
| # | |
| # Usage: | |
| # ./dhcp-to-static.sh [--dry-run] [--force] # DHCP -> static |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Generate a NetworkManager .nmconnection keyfile for a Hetzner dedicated server. | |
| # Queries the Hetzner Robot API for network details and writes keyfile to stdout. | |
| # | |
| # Usage: ROBOT_USER=xxx ROBOT_PASS=xxx ./hetzner-nmconnection.sh <server-number> | |
| # | |
| # Dependencies: curl, jq | |
| # Output: .nmconnection keyfile on stdout; progress/errors on stderr | |
| set -euo pipefail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Test an .nmconnection keyfile and always revert. Writes result to /tmp/nm-test-result. | |
| # | |
| # Usage: ./test-nmconnection.sh <path-to.nmconnection> | |
| # | |
| # Designed to work with hetzner-nmconnection.sh: | |
| # ./hetzner-nmconnection.sh 12345 > static.nmconnection | |
| # ./test-nmconnection.sh static.nmconnection | |
| set -euo pipefail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Generate a NetworkManager .nmconnection keyfile for a Leaseweb dedicated server. | |
| # Queries the Leaseweb API for network details and writes keyfile to stdout. | |
| # | |
| # Usage: LSW_API_KEY=xxx ./leaseweb-nmconnection.sh <server-id> | |
| # | |
| # Dependencies: curl, jq | |
| # Output: .nmconnection keyfile on stdout; progress/errors on stderr | |
| set -euo pipefail |
OlderNewer