Files
lenovo-gentoo/scripts/wifi-setup/README.md
Alexander Hinrichs 8de3f16ee6 chore: initialize gentoo-setup documentation repository
Add comprehensive documentation for Lenovo ThinkPad Gentoo Linux setup
including:
- Complete system configuration guides (power, Bluetooth, WiFi, audio)
- Hardware setup documentation (touchpad, touchscreen, DisplayLink)
- Management scripts with ZSH completions
- Kernel configuration (6.12.41-gentoo-x86_64)
- Lid automation and monitor management
- Battery conservation system
- User guides and troubleshooting

Repository includes .gitignore to exclude logs, temporary files, and
secrets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 18:22:51 +01:00

198 lines
4.1 KiB
Markdown

# WiFi Setup Tool
Easy WiFi connection management for Gentoo using NetworkManager.
## Prerequisites
NetworkManager must be installed and running:
```bash
sudo rc-update add NetworkManager default
sudo rc-service NetworkManager start
```
## Installation
### 1. Install the main script
```bash
sudo cp wifi-setup /usr/local/bin/wifi-setup
```
### 2. Install ZSH autocompletion
```bash
sudo mkdir -p /usr/local/share/zsh/site-functions
sudo cp _wifi-setup /usr/local/share/zsh/site-functions/_wifi-setup
```
### 3. Reload ZSH completions
```bash
# In your current shell
compinit
# Or just restart your shell
```
## Usage
### List available networks
```bash
wifi-setup
wifi-setup scan
```
### Connect to a network
```bash
wifi-setup connect "NetworkName"
```
You'll be prompted for the password if needed. The password is stored securely by NetworkManager in an encrypted keyring.
### Show current connection status
```bash
wifi-setup status
```
### Disconnect from WiFi
```bash
wifi-setup disconnect
```
### List saved connections
```bash
wifi-setup list-saved
```
### Forget a saved network
```bash
wifi-setup forget "NetworkName"
```
### Get help
```bash
wifi-setup help
```
## ZSH Autocompletion
The completion script provides:
- Tab completion for all commands
- Tab completion for available network names when using `connect`
- Tab completion for saved connections when using `forget`
Example:
```bash
# Press TAB to see all commands
wifi-setup <TAB>
# Press TAB to see available networks
wifi-setup connect <TAB>
# Press TAB to see saved connections
wifi-setup forget <TAB>
```
## Security
### Password Storage
- Passwords are stored securely by NetworkManager in `/etc/NetworkManager/system-connections/`
- Files are encrypted and only readable by root
- The script uses `--ask` flag to prompt for passwords interactively
- No passwords are logged or stored in plain text
### Network Permissions
- Network configuration requires root privileges
- NetworkManager handles authentication securely
- Saved connections auto-connect on boot by default
## Auto-Connect on Boot
By default, NetworkManager will automatically connect to saved networks when they're in range. To verify or change this behavior:
```bash
# Check if auto-connect is enabled for a connection
nmcli connection show "NetworkName" | grep autoconnect
# Disable auto-connect for a specific network
nmcli connection modify "NetworkName" connection.autoconnect no
# Enable auto-connect
nmcli connection modify "NetworkName" connection.autoconnect yes
```
## Hardware Information
**WiFi Adapter**: MediaTek Wi-Fi 7 MT7925 2x2 BE + Bluetooth 5.4
**Interface**: wlp194s0
**Driver**: mt7925e (kernel module)
## Troubleshooting
### WiFi interface not showing up
```bash
# Check if driver is loaded
lsmod | grep mt7925
# Check kernel messages
dmesg | grep mt7925
# Check interface status
ip link show wlp194s0
```
### NetworkManager not running
```bash
# Check service status
rc-service NetworkManager status
# Start service
sudo rc-service NetworkManager start
```
### Can't connect to network
```bash
# Check if the network is in range
wifi-setup scan
# Try connecting with verbose output
nmcli --ask device wifi connect "NetworkName"
# Check NetworkManager logs
journalctl -u NetworkManager
# Or on OpenRC:
tail -f /var/log/messages | grep NetworkManager
```
### Reset a problematic connection
```bash
# Forget the network
wifi-setup forget "NetworkName"
# Reconnect from scratch
wifi-setup connect "NetworkName"
```
## Technical Details
### Script Features
- Color-coded terminal output for readability
- Automatic SSID detection from NetworkManager
- Support for saved connections (no re-entering passwords)
- Secure password prompting using NetworkManager's `--ask` flag
- Network signal strength display
- Current IP address display when connected
### Dependencies
- `nmcli` (NetworkManager command-line client)
- `grep`, `awk`, `cut` (standard text processing tools)
- `ip` (network configuration tool)
- ZSH (for autocompletion)
## Files in This Directory
- `wifi-setup` - Main WiFi management script
- `_wifi-setup` - ZSH completion script
- `README.md` - This documentation