Files
devdesk/debian/devdesk.postinst
T

23 lines
635 B
Bash
Raw Permalink Normal View History

#!/bin/sh
set -e
case "$1" in
configure)
# Credential ttyd requires; NPM injects it as an Authorization header.
if [ ! -s /etc/devdesk/secret.env ]; then
umask 077
secret=$(od -An -tx1 -N24 /dev/urandom | tr -d ' \n')
printf 'DEVDESK_CREDENTIAL=devdesk:%s\n' "$secret" >/etc/devdesk/secret.env
fi
chmod 600 /etc/devdesk/secret.env
# Apply tmux.conf changes to a running server without restarting it.
if [ -S /run/devdesk/tmux.sock ]; then
tmux -N -S /run/devdesk/tmux.sock source-file /usr/share/devdesk/tmux.conf >/dev/null 2>&1 || true
fi
;;
esac
#DEBHELPER#
exit 0