mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-12 13:42:59 +00:00
fix: Improve /tmp permission handling and non-interactive mode detection
Improve handling of /tmp permissions and non-interactive mode:
1. /tmp permissions fix:
- Check current permissions before attempting to fix
- Display warning when fixing incorrect permissions (2775 -> 1777)
- Verify /tmp has permissions 1777 (sticky bit + world writable)
2. Non-interactive mode detection:
- Redirect stdin from /dev/null when running via sudo to prevent
read commands from hanging when stdin is not a TTY
- Add better error message in first_time_install.sh when non-interactive
mode is detected but ASSUME_YES is not set
- Check if stdin is a TTY before attempting interactive read
This fixes the issues identified in diagnostic output:
- /tmp permissions 2775 causing APT write failures
- read -p failing when stdin is not a TTY (curl | bash)
Fixes installation failures when running one-shot install via curl | bash.
This commit is contained in:
@@ -239,11 +239,20 @@ echo ""
|
||||
if [ "$ASSUME_YES" = "1" ]; then
|
||||
echo "Non-interactive mode: proceeding with installation."
|
||||
else
|
||||
read -p "Do you want to proceed with the installation? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Installation cancelled."
|
||||
exit 0
|
||||
# Check if stdin is available (not running via pipe/curl)
|
||||
if [ -t 0 ]; then
|
||||
read -p "Do you want to proceed with the installation? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Installation cancelled."
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
# Non-interactive mode but ASSUME_YES not set - exit with error
|
||||
echo "✗ Non-interactive mode detected but ASSUME_YES not set." >&2
|
||||
echo " Please run with -y flag or set LEDMATRIX_ASSUME_YES=1" >&2
|
||||
echo " Example: sudo ./first_time_install.sh -y" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user