OS Detection and System Checks¶
OS Detection — checkOS()¶
The script sources /etc/os-release and identifies the distribution. It sets the OS variable used throughout the script to select the correct package manager and paths.
For the full list of supported distributions and minimum versions, see Compatibility.
The OS variable is set to the distribution identifier used internally by the script:
| OS Variable | Distribution |
|---|---|
debian | Debian, Raspbian |
ubuntu | Ubuntu |
fedora | Fedora |
centos | CentOS Stream |
rocky | Rocky Linux |
almalinux | AlmaLinux |
oracle | Oracle Linux |
amzn | Amazon Linux |
arch | Arch Linux |
opensuse-leap | openSUSE Leap |
opensuse-tumbleweed | openSUSE Tumbleweed |
If the version is below the minimum, the script warns the user and asks for confirmation to continue.
Pre-Flight Checks — initialCheck()¶
Before any installation, four checks run in sequence:
1. Root Check — isRoot()¶
Verifies EUID == 0. The script must run as root or via sudo.
2. TUN Device — tunAvailable()¶
Checks that /dev/net/tun exists. The TUN kernel module is required for OpenVPN. If missing, the script exits with a fatal error.
3. OS Detection — checkOS()¶
Described above. Identifies the distribution and validates version support.
4. Arch Kernel Check — checkArchPendingKernelUpgrade()¶
Arch Linux specific. If the kernel was upgraded but the system hasn't rebooted:
- Running kernel modules may be deleted
- TUN module won't load after reboot
- OpenVPN will fail
The function:
- Skips if not Arch or running in a container
- Checks if running kernel modules are available on disk
- Syncs the pacman database
- Checks for pending kernel package upgrades
- Fatally exits if a reboot is needed
Version Checks¶
openvpnVersionAtLeast(version)¶
Checks the installed OpenVPN version:
Uses sort -V for semantic version comparison.
kernelVersionAtLeast(version)¶
Checks the running kernel version from uname -r:
isDCOAvailable()¶
Data Channel Offload requires both:
- OpenVPN 2.6+
- Kernel 6.16+ or the
ovpn-dcokernel module loaded