You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- avoid set -euo pipefail - instead focus on thorough testing, validation and error handling.
5
+
- ideally error handling should be considered holistically but per function is acceptable.
6
+
- changes and recommendations should be simple, modular, focused on the requirement of the prompt.
7
+
- never make generalized changes that are not specifically required for the prompt.
8
+
- don't over complicated the solution or pollute it with noisy or complex solutions.
9
+
- Always makes changes in stages, a modular approach.
10
+
- use Google style guide for formatting of bash scripts - https://google.github.io/styleguide/shellguide.html
11
+
- Always use `#!/bin/bash` as the shebang.
12
+
- Use `printf '%s'` for printing strings and `printf '%b'` for escape sequences. **Avoid using `echo`.**
13
+
- Comment code to explain changes and logic.
14
+
- always prefer readability of code over complex one lines. Unless that foramt is promoted by the style guide.
15
+
- For Bash/shell questions, consult [mywiki.wooledge.org](https://mywiki.wooledge.org) or [BashFAQ](https://mywiki.wooledge.org/BashFAQ) first. **Provide a source link when possible.**
16
+
17
+
# GitHub Workflows - All repos
18
+
19
+
- In reusable workflows, jobs that use outputs from other jobs **must** include those jobs in their `needs` section to avoid null variables.
20
+
- Do not use outdated GitHub Actions in workflow code. Always check the version recommended is the current version
21
+
- The `gh` CLI cannot get the ID of a workflow it started with `gh run workflow`; you must list runs after and extract the ID.
22
+
23
+
# If repo = *-musl-cross-make
24
+
GCC / Binutils
25
+
- Use both `-static` and `--static` to create static toolchain binaries. Using `-static` alone can cause errors (e.g., missing POSIX threads).
26
+
- When working with `../config.mak`, always load options from both `../gcc-configure-options.md` and `../gcc-configure-options-recursive.md`.
27
+
- The binutils gold linker is deprecated. Use `ld=default` and `--disable-gold`.
28
+
- For fully static toolchains linked to musl:
29
+
- Do **not** use `-flto` or `-fuse-linker-plugin` (LTO is not supported; plugins require dynamic loading).
30
+
- Do **not** add any LTO settings.
31
+
- Only set linker options like `LDFLAGS` when linking, **not** when building libraries.
32
+
- GNU libtool redefines `-static`; to ensure static linking, use `--static` or `-Wl,-static` in `LDFLAGS` (possibly with `-static`).
33
+
- When building OpenSSL statically, do **not** use `openssl -static` (it disables threads, PIE, PIC). For `-static-pie` binaries with musl/Alpine, use the correct flags.
34
+
- Do **not** suggest glibc-only flags or glibcisms for musl toolchains.
35
+
36
+
# Debugging with qemu
37
+
38
+
- To debug with QEMU:
39
+
Run `qemu -g <port> <binary>` (e.g., `qemu -g 1234 ./qbt-nox-static`), then connect with `gdb ./qbt-nox-static` in another terminal.
40
+
41
+
# If repo = * qbittorrent-nox-static
42
+
43
+
## qi.bash script
44
+
45
+
General features
46
+
- Always use `#!/bin/bash` as the shebang.
47
+
- this script is focused on being a simple installer that verifies installation and binaries.
48
+
49
+
basic check for supported os
50
+
- use source /etc/os-release
51
+
- if ID = alpine of debian or if the or if ID_LIKE=debian is debian like we can proceed.
52
+
- if not supported os exit with reason.
53
+
54
+
basic check for wget or curl, default to curl if present.
55
+
- if no tools exit with reason.
56
+
- wget or curl must have, curl default if present but use wget if there.
57
+
- check if gh cli is available to use but no required.
58
+
59
+
basic check of which arch using
60
+
- alpine use apk --print-arch
61
+
- debian like use dpkg --print-architecture
62
+
- all arches are the same except armhf. on debian this is armv7 and alpine armv6
63
+
- if not valid arch exit with reason.
64
+
65
+
create download function based on arch checks.
66
+
- configure download url based on arch.
67
+
- creates sha256 of download.
68
+
69
+
gh cli function
70
+
- if gh cli exists and is usable use it to very the binaries downloaded
71
+
- if gh attestation verify <INSTALL_PATH> --repo <REPO> 2> /dev/null; then ...
72
+
73
+
error handling
74
+
- there should be a error handling function to test commands exit the script with helpful explanations when a command or function fails.
75
+
76
+
ouputs
77
+
- there should be a function to handle printing outputs.
78
+
- It should handle [INFO] (blue) [WARNING] (yellow) [ERROR] (red) [SUCCESS] (Green) [FAILURE] (magenta)
79
+
- Use `printf '%s'` for printing strings and `printf '%b'` for escape sequences. **Avoid using `echo`.**
80
+
- this function will provide end user information understanding or troubleshooting script outcomes.
81
+
- it should be succinct unless there is an error or failure, then it should be verbose enough to help.
0 commit comments