don't do first run if no admin user set

This commit is contained in:
paukstelis
2023-01-02 09:25:28 -05:00
parent b1aefac8fe
commit fe0a13f9fe

View File

@@ -11,7 +11,7 @@ if [ $SUDO_USER ]; then
user=$SUDO_USER
else
echo "You should not run this script as root. Use sudo as a normal user"
exit
exit
fi
if [ "$user" == root ]; then
@@ -982,37 +982,39 @@ firstrun() {
echo "Admin password: $OCTOPASS"
$OCTOEXEC user add $OCTOADMIN --password $OCTOPASS --admin | log
fi
echo
echo
echo "The script can complete the first run wizards now. For more information on these, see the OctoPrint website."
echo "It is standard to accept these, as no identifying information is exposed through their usage."
echo
echo
if prompt_confirm "Do first run wizards now?"; then
$OCTOEXEC config set server.firstRun false --bool | log
$OCTOEXEC config set server.seenWizards.backup null | log
$OCTOEXEC config set server.seenWizards.corewizard 4 --int | log
if prompt_confirm "Enable online connectivity check?"; then
$OCTOEXEC config set server.onlineCheck.enabled true --bool
else
$OCTOEXEC config set server.onlineCheck.enabled false --bool
fi
if prompt_confirm "Enable plugin blacklisting?"; then
$OCTOEXEC config set server.pluginBlacklist.enabled true --bool
else
$OCTOEXEC config set server.pluginBlacklist.enabled false --bool
fi
if prompt_confirm "Enable anonymous usage tracking?"; then
$OCTOEXEC config set plugins.tracking.enabled true --bool
else
$OCTOEXEC config set plugins.tracking.enabled false --bool
fi
if prompt_confirm "Use default printer (can be changed later)?"; then
$OCTOEXEC config set printerProfiles.default _default
if [ -n "$OCTOADMIN" ]; then
echo
echo
echo "The script can complete the first run wizards now. For more information on these, see the OctoPrint website."
echo "It is standard to accept these, as no identifying information is exposed through their usage."
echo
echo
if prompt_confirm "Do first run wizards now?"; then
$OCTOEXEC config set server.firstRun false --bool | log
$OCTOEXEC config set server.seenWizards.backup null | log
$OCTOEXEC config set server.seenWizards.corewizard 4 --int | log
if prompt_confirm "Enable online connectivity check?"; then
$OCTOEXEC config set server.onlineCheck.enabled true --bool
else
$OCTOEXEC config set server.onlineCheck.enabled false --bool
fi
if prompt_confirm "Enable plugin blacklisting?"; then
$OCTOEXEC config set server.pluginBlacklist.enabled true --bool
else
$OCTOEXEC config set server.pluginBlacklist.enabled false --bool
fi
if prompt_confirm "Enable anonymous usage tracking?"; then
$OCTOEXEC config set plugins.tracking.enabled true --bool
else
$OCTOEXEC config set plugins.tracking.enabled false --bool
fi
if prompt_confirm "Use default printer (can be changed later)?"; then
$OCTOEXEC config set printerProfiles.default _default
fi
fi
fi