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 { ...@@ -511,39 +511,43 @@ function web_admin_setup_login {
fi fi
# if an nginx password file has not been created for web admin # if an nginx password file has not been created for web admin
if [ ! -f /etc/nginx/.webadminpasswd ]; then if [ -f /etc/nginx/.webadminpasswd ]; then
# this file indicates that the setup screen is active return
# and gets removed by freedombone-installer fi
if [ ! -f "$webadmin_install_dir/.setupscreenactive" ]; then
touch "$webadmin_install_dir/.setupscreenactive" web_admin_get_hostname
fi
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 webadmin_password="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
touch /etc/nginx/.webadminpasswd
# create a password file used by nginx # create a password for users
echo -n "$webadmin_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "admin" touch /etc/nginx/.webadminpasswd
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 # create a password file used by nginx
# and copy it to the index echo -n "$webadmin_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "admin"
cp "$webadmin_install_dir"/index.html "$webadmin_install_dir"/index.prev if ! grep -q 'admin:' /etc/nginx/.webadminpasswd; then
cp "$webadmin_install_dir"/setup.html "$webadmin_install_dir"/setup.prev echo $'/etc/nginx/.webadminpasswd password not created for admin'
cp "$webadmin_install_dir"/setup_confirm_template.html "$webadmin_install_dir"/setup_confirm.html exit 2428956
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup.prev" fi
sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup_confirm.html"
cp "$webadmin_install_dir"/setup.prev "$webadmin_install_dir"/index.html # create a setup page with the initial password inserted
# and copy it to the index
# if initial setup has not yet happened then create cp "$webadmin_install_dir"/index.html "$webadmin_install_dir"/index.prev
# a password file cp "$webadmin_install_dir"/setup.html "$webadmin_install_dir"/setup.prev
if ! grep -q 'install_final' "$COMPLETION_FILE"; then cp "$webadmin_install_dir"/setup_confirm_template.html "$webadmin_install_dir"/setup_confirm.html
echo -n "$webadmin_password" > /root/login.txt sed -i "s|WEBADMINPASSWORD|${webadmin_password}|g" "$webadmin_install_dir/setup.prev"
fi 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 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