Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
10ffe09c
Commit
10ffe09c
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Setting up web admin during image builds
parent
13f68361
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-image-customise
+1
-0
1 addition, 0 deletions
src/freedombone-image-customise
src/freedombone-utils-webadmin
+88
-6
88 additions, 6 deletions
src/freedombone-utils-webadmin
with
89 additions
and
6 deletions
src/freedombone-image-customise
+
1
−
0
View file @
10ffe09c
...
...
@@ -2373,6 +2373,7 @@ configure_wifi
configure_user_interface
image_setup_utils
image_install_inadyn
image_install_web_admin
image_install_pleroma
image_preinstall_repos
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-utils-webadmin
+
88
−
6
View file @
10ffe09c
...
...
@@ -34,8 +34,14 @@
WEBADMIN_LOGIN_TEXT=$"Welcome to ${PROJECT_NAME}"
function web_admin_get_hostname {
# get the local name (usually freedombone.local) from avahi config
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
# shellcheck disable=SC2154
if [ ! "$rootdir" ]; then
# get the local name (usually freedombone.local) from avahi config
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
else
local_hostname=${PROJECT_NAME}.local
fi
# where the web admin files are
webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
}
...
...
@@ -498,10 +504,11 @@ function web_admin_onion_only {
# In onion only mode domain names or ddns codes
# don't need to be provided
web_admin_get_hostname
sed -i '/freedns_code/d' "$webadmin_install_dir/app_add_template.html"
sed -i '/install_domain/d' "$webadmin_install_dir/app_add_template.html"
sed -i 's|onion_only=false;|onion_only=true;|g' "$webadmin_install_dir/installapp.php"
sed -i 's|setup_domain.html|setup_installing.html|g' "$webadmin_install_dir/setupconfirm.php"
# shellcheck disable=SC2154
sed -i '/freedns_code/d' "$rootdir$webadmin_install_dir/app_add_template.html"
sed -i '/install_domain/d' "$rootdir$webadmin_install_dir/app_add_template.html"
sed -i 's|onion_only=false;|onion_only=true;|g' "$rootdir$webadmin_install_dir/installapp.php"
sed -i 's|setup_domain.html|setup_installing.html|g' "$rootdir$webadmin_install_dir/setupconfirm.php"
}
function web_admin_reset {
...
...
@@ -566,6 +573,81 @@ function web_admin_setup_login {
fi
}
function image_install_web_admin {
if [ "$INSTALLING_MESH" ]; then
return
fi
language_subdir=$(web_admin_get_language_subdir)
web_admin_get_hostname
# shellcheck disable=SC2154
mkdir -p "$rootdir$webadmin_install_dir"
cp -r "$rootdir/usr/share/${PROJECT_NAME}/webadmin"/* "$rootdir$webadmin_install_dir"
cp "$rootdir/usr/share/${PROJECT_NAME}/webadmin/${language_subdir}"/*.html "$rootdir$webadmin_install_dir"
cp "$rootdir$webadmin_install_dir"/index.html "$rootdir$webadmin_install_dir"/index.prev
if [[ "$ONION_ONLY" != 'no' ]]; then
web_admin_onion_only
fi
touch "$rootdir$webadmin_install_dir/setup.txt"
touch "$rootdir$webadmin_install_dir/.setupscreenactive"
nginx_file=${rootdir}/etc/nginx/sites-available/${local_hostname}
{ echo 'server {';
echo ' listen 80 default_server;';
echo ' #listen [::]:80;';
echo " server_name ${local_hostname};";
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;';
echo '';
echo ' access_log /dev/null;';
echo ' error_log /dev/null;';
echo '';
echo ' location ^~ /admin {';
echo " #auth_basic \"${WEBADMIN_LOGIN_TEXT}\";";
echo " #auth_basic_user_file /etc/nginx/.webadminpasswd;";
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;';
echo " error_page 405 = \$uri;";
echo ' location ~ \.php {';
echo ' include snippets/fastcgi-php.conf;';
echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
echo ' fastcgi_read_timeout 30;';
echo ' }';
echo ' }';
echo '';
echo ' location /icons {';
echo ' autoindex on;';
echo ' break;';
echo ' }';
echo '';
echo ' rewrite ^/plinth/(.*)$ /api.json last;';
echo '';
echo ' location / {';
echo " root /var/www/${local_hostname}/htdocs/plinth;";
echo ' index api.json /api.json;';
echo " error_page 405 = \$uri;";
echo ' }';
echo '}'; } > "$nginx_file"
chroot "$rootdir" nginx_ensite "${local_hostname}"
chroot "$rootdir" chown -R www-data:www-data "/etc/nginx/sites-available/${local_hostname}"
{ echo '[Unit]';
echo 'Description=Installer daemon for web admin';
echo 'After=network.target';
echo '';
echo '[Service]';
echo 'User=root';
echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-installer";
echo "ExecReload=/bin/kill \$MAINPID";
echo 'KillMode=process';
echo 'Restart=always';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target';
echo 'Alias=pleroma.service'; } > "$rootdir/etc/systemd/system/webadmin.service"
chroot "$rootdir" systemctl enable webadmin
}
function install_web_admin {
# This is intended as an admin web user interface
# similar to Plinth or the yunohost
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment