devshell: add ghaf-flash to devshell, improve readability#1613
devshell: add ghaf-flash to devshell, improve readability#1613brianmcgillion merged 1 commit intotiiuae:mainfrom
Conversation
brianmcgillion
left a comment
There was a problem hiding this comment.
fairly big wrapper for
zstdcat result/disk1.raw.zst | sudo dd of=/dev/sda bs=32M status=progress conv=sync oflag=direct iflag=fullblock
:) :)
Haha indeed |
adef30e to
abe80ec
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a user-friendly ghaf-flash command to the development shell and significantly improves the flash script's usability with colored output, progress indicators, and better error messaging.
Key Changes:
- Adds
ghaf-flashcommand alias to devshell for easier access to the flash script - Enhances flash.sh with colored output, progress bars (using
pv), and interactive confirmation - Fixes typo in package description ("Flashingscript" → "Flashing script")
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
packages/pkgs-by-name/flash-script/package.nix |
Adds pv dependency for progress display and fixes description typo |
packages/pkgs-by-name/flash-script/flash.sh |
Major UX improvements: adds colored output, progress bars, better help text, force flag, and user confirmation prompts |
nix/devshell.nix |
Adds ghaf-flash command to devshell builder category for convenient access |
Comments suppressed due to low confidence (1)
packages/pkgs-by-name/flash-script/flash.sh:181
- Using
evalwith user-controlled variable$FILENAMEembedded inPV_CMDcan lead to command injection vulnerabilities. While the filename is validated earlier, it's safer to avoidevalaltogether. Instead, construct the command directly:
if [[ -n $IMGSIZE ]]; then
zstdcat "$FILENAME" | pv -tpreb -N "$FILENAME" -s "$IMGSIZE" | dd of="$DEVICE" bs=32M conv=fsync oflag=direct iflag=fullblock status=none
else
zstdcat "$FILENAME" | pv -tpreb -N "$FILENAME" | dd of="$DEVICE" bs=32M conv=fsync oflag=direct iflag=fullblock status=none
fi PV_CMD="pv -tpreb -N \"$FILENAME\""
if [[ -n $IMGSIZE ]]; then
PV_CMD="$PV_CMD -s $IMGSIZE"
fi
set +e
zstdcat "$FILENAME" | eval "$PV_CMD" | dd of="$DEVICE" bs=32M conv=fsync oflag=direct iflag=fullblock status=none
abe80ec to
d4598f0
Compare
Signed-off-by: Kajus Naujokaitis <kajus.naujokaitis@unikie.com>
d4598f0 to
b9bc3ce
Compare
|
Adjusted some parts based on copilot notes. Ready for review. |
Description of Changes
Added
flash-scriptasghaf-flashto ghaf devshell.Some improvements:
pvis available)-fflagType of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify: