Skip to content
Snippets Groups Projects
Commit 9611791c authored by Bob Mottram's avatar Bob Mottram
Browse files

Tidying

parent 940b5ab7
No related branches found
No related tags found
No related merge requests found
......@@ -511,39 +511,43 @@ function web_admin_setup_login {
fi
# if an nginx password file has not been created for web admin
if [ ! -f /etc/nginx/.webadminpasswd ]; then
# this file indicates that the setup screen is active
# and gets removed by freedombone-installer
if [ ! -f "$webadmin_install_dir/.setupscreenactive" ]; then
touch "$webadmin_install_dir/.setupscreenactive"
fi
if [ -f /etc/nginx/.webadminpasswd ]; then
return
fi
web_admin_get_hostname
webadmin_password="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
# this file indicates that the setup screen is active
# and gets removed by freedombone-installer
if [ ! -f "$webadmin_install_dir/.setupscreenactive" ]; then
touch "$webadmin_install_dir/.setupscreenactive"
fi
# create a password for users
touch /etc/nginx/.webadminpasswd
webadmin_password="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
# create a password file used by nginx
echo -n "$webadmin_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "admin"
if ! grep -q 'admin:' /etc/nginx/.webadminpasswd; then
echo $'/etc/nginx/.webadminpasswd password not created for admin'
exit 2428956
fi
# create a password for users
touch /etc/nginx/.webadminpasswd
# create a setup page with the initial password inserted
# and copy it to the index
cp "$webadmin_install_dir"/index.html "$webadmin_install_dir"/index.prev
cp "$webadmin_install_dir"/setup.html "$webadmin_install_dir"/setup.prev
cp "$webadmin_install_dir"/setup_confirm_template.html "$webadmin_install_dir"/setup_confirm.html
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup.prev"
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup_confirm.html"
cp "$webadmin_install_dir"/setup.prev "$webadmin_install_dir"/index.html
# if initial setup has not yet happened then create
# a password file
if ! grep -q 'install_final' "$COMPLETION_FILE"; then
echo -n "$webadmin_password" > /root/login.txt
fi
# create a password file used by nginx
echo -n "$webadmin_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "admin"
if ! grep -q 'admin:' /etc/nginx/.webadminpasswd; then
echo $'/etc/nginx/.webadminpasswd password not created for admin'
exit 2428956
fi
# create a setup page with the initial password inserted
# and copy it to the index
cp "$webadmin_install_dir"/index.html "$webadmin_install_dir"/index.prev
cp "$webadmin_install_dir"/setup.html "$webadmin_install_dir"/setup.prev
cp "$webadmin_install_dir"/setup_confirm_template.html "$webadmin_install_dir"/setup_confirm.html
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup.prev"
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup_confirm.html"
cp "$webadmin_install_dir"/setup.prev "$webadmin_install_dir"/index.html
# if initial setup has not yet happened then create
# a password file
if ! grep -q 'install_final' "$COMPLETION_FILE"; then
echo -n "$webadmin_password" > /root/login.txt
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment