Skip to content

Commit

Permalink
cachyos-bugreport: Bring back write permission check
Browse files Browse the repository at this point in the history
Initially I thought it wasn't a concern since the script runs under
root, but in some “edge cases” like being inside /proc it's still
needed.

Signed-off-by: Vasiliy Stelmachenok <[email protected]>
  • Loading branch information
ventureoo committed Nov 6, 2024
1 parent 936fcd6 commit a18ca0a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions usr/bin/cachyos-bugreport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ check_oldlog() {
}


check_wpermission() {
if ! touch "$LOG_FILENAME" 2>/dev/null; then
cat << EOF >&2
ERROR: Working directory is not writable; please cd to a directory
where you have write permission so that the $LOG_FILENAME
file can be written.
EOF
exit 1
fi
}

bugreport() {
echo "Starting with bugreport"

Expand Down Expand Up @@ -77,5 +90,6 @@ upload() {

check_root
check_oldlog
check_wpermission
bugreport
upload

0 comments on commit a18ca0a

Please sign in to comment.