void-packages/srcpkgs/spreed-webrtc/INSTALL
2017-10-25 21:02:51 -04:00

16 lines
732 B
Text

case "${ACTION}" in
post)
# Do not be confused. This has no effect on whether or not the package is edited
# That honour rests on the <SESSION_SECRET> string and it's companions.
if [ "${UPDATE}" != "yes" ]; then
sessionSecret=$(tr -dc [:xdigit:] < /dev/urandom | tr [:upper:] [:lower:] | head -c128)
encryptionSecret=$(tr -dc [:xdigit:] < /dev/urandom | tr [:upper:] [:lower:] | head -c64)
# The following is a public value but randomness should be fine
serverToken=$(tr -dc [:xdigit:] < /dev/urandom | tr [:upper:] [:lower:] | head -c64)
sed -i etc/spreed/webrtc.conf \
-e "s!<SESSION_SECRET>!$sessionSecret!" \
-e "s!<ENCRYPTION_SECRET>!$encryptionSecret!" \
-e "s!<SERVER_TOKEN>!$serverToken!"
fi
;;
esac