From 47499b1261b88431488c4e705accfb6888d948a3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Jul 2021 12:57:42 +0300 Subject: [PATCH] eiwd: add back iwd_passphrase --- extra/eiwd/build | 2 ++ extra/eiwd/checksums | 1 + extra/eiwd/files/iwd_passphrase | 34 +++++++++++++++++++++++++++++++++ extra/eiwd/sources | 1 + 4 files changed, 38 insertions(+) create mode 100755 extra/eiwd/files/iwd_passphrase diff --git a/extra/eiwd/build b/extra/eiwd/build index 810b52b1..35139ff3 100755 --- a/extra/eiwd/build +++ b/extra/eiwd/build @@ -9,6 +9,8 @@ make make install +cp -f iwd_passphrase "$1/usr/bin" + # Install runit service. mkdir -p "$1/etc/sv/eiwd" cp -f eiwd.run "$1/etc/sv/eiwd/run" diff --git a/extra/eiwd/checksums b/extra/eiwd/checksums index 29a005f6..b36837d8 100644 --- a/extra/eiwd/checksums +++ b/extra/eiwd/checksums @@ -1,2 +1,3 @@ 3f0ceb79c662050325034dcd8a7b5cdf0d7e80560b65ca5f16bce7e115247a8e 9798194395fbc26a1ad8465bab7ac9c9e94c3a51edaf5987a414037c34169e63 +bf22ccc74ff06d56f8525e3d41361eb413de56e5eaccbf9cfdfb1bf5491dbf40 diff --git a/extra/eiwd/files/iwd_passphrase b/extra/eiwd/files/iwd_passphrase new file mode 100755 index 00000000..cf100dd4 --- /dev/null +++ b/extra/eiwd/files/iwd_passphrase @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Simple script to generate iwd network files. + +[ "$1" ] || { + printf '%s\n' "usage: printf pass | ${0##*/} ssid" >&2 + exit 1 +} + +# Read the password from 'stdin'. +read -r pass; [ "$pass" ] || exit 1 + +# Consider all characters as single-byte. +export LC_CTYPE=C + +# The SSID appears verbatim in the name if it contains +# only alphanumeric characters, spaces, underscores or +# minus signs. Otherwise it is encoded as an equal sign +# followed by the lower-case hex encoding of the name. +case $1 in + *[!A-Za-z0-9_' '-]*) + ssid="=$(printf %s "$1" | od -vA n -t x1 | tr -d '\n ')" + ;; + + *) + ssid=$1 + ;; +esac + +printf '%s\n\n' "Save this output to /var/lib/iwd/$ssid.psk" >&2 +printf '[Security]\n' +printf 'Passphrase=%s\n' "$pass" +printf '\nTIP: You can use this output directly as the\n' >&2 +printf ' help messages are printed to stderr.\n' >&2 diff --git a/extra/eiwd/sources b/extra/eiwd/sources index bd75fbca..24093efd 100644 --- a/extra/eiwd/sources +++ b/extra/eiwd/sources @@ -1,2 +1,3 @@ https://github.com/illiliti/eiwd/releases/download/VERSION-1/iwd-MAJOR.MINOR.tar.xz files/eiwd.run +files/iwd_passphrase