25 lines
654 B
Bash
Executable file
25 lines
654 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
if [ -x /usr/bin/wg ]; then
|
|
|
|
umask 077
|
|
mkdir -p /storage/.cache/wireguard
|
|
|
|
if [ ! -f /storage/.cache/wireguard/privatekey ]; then
|
|
wg genkey > /storage/.cache/wireguard/privatekey
|
|
fi
|
|
if [ ! -f /storage/.cache/wireguard/publickey ]; then
|
|
wg pubkey < /storage/.cache/wireguard/privatekey > /storage/.cache/wireguard/publickey
|
|
fi
|
|
if [ ! -f /storage/.cache/wireguard/preshared ]; then
|
|
wg genpsk > /storage/.cache/wireguard/preshared
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "WireGuard keys have been saved to /storage/.cache/wireguard/"
|
|
|
|
exit 0
|