op-packages/momo/files/uci-defaults/init.sh
github-actions[bot] c2374cbb98 🎨 Sync 2026-04-10 15:34:26
2026-04-10 15:34:26 +08:00

22 lines
470 B
Bash

#!/bin/sh
. "$IPKG_INSTROOT/etc/momo/scripts/include.sh"
# check momo.config.init
init=$(uci -q get momo.config.init); [ -z "$init" ] && return
# generate random string for api secret and authentication password
random=$(awk 'BEGIN{srand(); printf "%06d", int(rand() * 1000000)}')
# set momo.mixin.api_secret
uci set momo.mixin.external_control_api_secret="$random"
# remove momo.config.init
uci del momo.config.init
# commit
uci commit momo
# exit with 0
exit 0