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

Install squirrelmail in web admin

parent 1c8d9ba7
No related branches found
No related tags found
No related merge requests found
File added
......@@ -1210,6 +1210,270 @@ function web_admin_create_app_descriptions {
fi
}
function install_web_admin_webmail {
if [ ! -f "/root/${PROJECT_NAME}/image_build/squirrelmail.tar.gz" ]; then
return
fi
if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p "$INSTALL_DIR"
fi
if [ ! -d "/var/www/${local_hostname}/htdocs/mail" ]; then
cp "/root/${PROJECT_NAME}/image_build/squirrelmail.tar.gz" "$INSTALL_DIR"
cd "$INSTALL_DIR" || return
tar -xzvf squirrelmail.tar.gz
if [ ! -d "$INSTALL_DIR/squirrelmail.stable/squirrelmail" ]; then
mv "$INSTALL_DIR/squirrelmail.stable/squirrelmail" "/var/www/${local_hostname}/htdocs/mail"
fi
fi
if [ ! "/var/www/${local_hostname}/htdocs/mail" ]; then
return
fi
if [ ! -d /var/local/squirrelmail ]; then
mkdir /var/local/squirrelmail
fi
if [ ! -d /var/local/squirrelmail/data ]; then
mkdir /var/local/squirrelmail/data
fi
if [ ! -d /var/local/squirrelmail/temp ]; then
mkdir /var/local/squirrelmail/temp
fi
cd /var/local/squirrelmail || return
chgrp www-data data temp
chmod 0730 data temp
read_config_param DEFAULT_LANGUAGE
{ echo '<?php';
echo '';
echo '/**';
echo ' * SquirrelMail Configuration File';
echo ' * Created using the configure script, conf.pl';
echo ' */';
echo '';
echo "global \$version;";
echo "\$config_version = '1.4.0';";
echo "\$config_use_color = 2;";
echo '';
echo "\$org_name = \"${PROJECT_NAME}\";";
echo "\$org_logo = SM_PATH . 'images/sm_logo.png';";
echo "\$org_logo_width = '308';";
echo "\$org_logo_height = '111';";
echo "\$org_title = \"SquirrelMail $version\";";
echo "\$signout_page = '';";
echo "\$frame_top = '_top';";
echo '';
echo "\$provider_uri = 'https://freedombone.net/';";
echo '';
echo "\$provider_name = 'OnionPost';";
echo '';
echo "\$motd = \"\";";
echo '';
echo "\$squirrelmail_default_language = '${DEFAULT_LANGUAGE}';";
echo "\$default_charset = 'iso-8859-1';";
echo "\$lossy_encoding = false;";
echo '';
echo "\$domain = '$(cat /var/lib/tor/hidden_service_email/hostname)';";
echo "\$imapServerAddress = 'localhost';";
echo "\$imapPort = 143;";
echo "\$useSendmail = false;";
echo "\$smtpServerAddress = 'localhost';";
echo "\$smtpPort = 25;";
echo "\$sendmail_path = '/usr/sbin/sendmail';";
echo "\$sendmail_args = '-i -t';";
echo "\$pop_before_smtp = false;";
echo "\$pop_before_smtp_host = '';";
echo "\$imap_server_type = 'other';";
echo "\$invert_time = false;";
echo "\$optional_delimiter = 'detect';";
echo "\$encode_header_key = '';";
echo '';
echo "\$default_folder_prefix = '';";
echo "\$trash_folder = 'Trash';";
echo "\$sent_folder = 'Sent';";
echo "\$draft_folder = 'Drafts';";
echo "\$default_move_to_trash = true;";
echo "\$default_move_to_sent = true;";
echo "\$default_save_as_draft = true;";
echo "\$show_prefix_option = false;";
echo "\$list_special_folders_first = true;";
echo "\$use_special_folder_color = true;";
echo "\$auto_expunge = true;";
echo "\$default_sub_of_inbox = true;";
echo "\$show_contain_subfolders_option = false;";
echo "\$default_unseen_notify = 2;";
echo "\$default_unseen_type = 1;";
echo "\$auto_create_special = true;";
echo "\$delete_folder = false;";
echo "\$noselect_fix_enable = false;";
echo '';
echo "\$data_dir = '/var/local/squirrelmail/data/';";
echo "\$attachment_dir = '/var/local/squirrelmail/attach/';";
echo "\$dir_hash_level = 0;";
echo "\$default_left_size = '150';";
echo "\$force_username_lowercase = false;";
echo "\$default_use_priority = true;";
echo "\$hide_sm_attributions = false;";
echo "\$default_use_mdn = true;";
echo "\$edit_identity = true;";
echo "\$edit_name = true;";
echo "\$edit_reply_to = true;";
echo "\$hide_auth_header = false;";
echo "\$allow_thread_sort = false;";
echo "\$allow_server_sort = false;";
echo "\$allow_charset_search = true;";
echo "\$uid_support = true;";
echo '';
echo "\$theme_css = '';";
echo "\$theme_default = 0;";
echo "\$theme[0]['PATH'] = SM_PATH . 'themes/default_theme.php';";
echo "\$theme[0]['NAME'] = 'Default';";
echo "\$theme[1]['PATH'] = SM_PATH . 'themes/plain_blue_theme.php';";
echo "\$theme[1]['NAME'] = 'Plain Blue';";
echo "\$theme[2]['PATH'] = SM_PATH . 'themes/sandstorm_theme.php';";
echo "\$theme[2]['NAME'] = 'Sand Storm';";
echo "\$theme[3]['PATH'] = SM_PATH . 'themes/deepocean_theme.php';";
echo "\$theme[3]['NAME'] = 'Deep Ocean';";
echo "\$theme[4]['PATH'] = SM_PATH . 'themes/slashdot_theme.php';";
echo "\$theme[4]['NAME'] = 'Slashdot';";
echo "\$theme[5]['PATH'] = SM_PATH . 'themes/purple_theme.php';";
echo "\$theme[5]['NAME'] = 'Purple';";
echo "\$theme[6]['PATH'] = SM_PATH . 'themes/forest_theme.php';";
echo "\$theme[6]['NAME'] = 'Forest';";
echo "\$theme[7]['PATH'] = SM_PATH . 'themes/ice_theme.php';";
echo "\$theme[7]['NAME'] = 'Ice';";
echo "\$theme[8]['PATH'] = SM_PATH . 'themes/seaspray_theme.php';";
echo "\$theme[8]['NAME'] = 'Sea Spray';";
echo "\$theme[9]['PATH'] = SM_PATH . 'themes/bluesteel_theme.php';";
echo "\$theme[9]['NAME'] = 'Blue Steel';";
echo "\$theme[10]['PATH'] = SM_PATH . 'themes/dark_grey_theme.php';";
echo "\$theme[10]['NAME'] = 'Dark Grey';";
echo "\$theme[11]['PATH'] = SM_PATH . 'themes/high_contrast_theme.php';";
echo "\$theme[11]['NAME'] = 'High Contrast';";
echo "\$theme[12]['PATH'] = SM_PATH . 'themes/black_bean_burrito_theme.php';";
echo "\$theme[12]['NAME'] = 'Black Bean Burrito';";
echo "\$theme[13]['PATH'] = SM_PATH . 'themes/servery_theme.php';";
echo "\$theme[13]['NAME'] = 'Servery';";
echo "\$theme[14]['PATH'] = SM_PATH . 'themes/maize_theme.php';";
echo "\$theme[14]['NAME'] = 'Maize';";
echo "\$theme[15]['PATH'] = SM_PATH . 'themes/bluesnews_theme.php';";
echo "\$theme[15]['NAME'] = 'BluesNews';";
echo "\$theme[16]['PATH'] = SM_PATH . 'themes/deepocean2_theme.php';";
echo "\$theme[16]['NAME'] = 'Deep Ocean 2';";
echo "\$theme[17]['PATH'] = SM_PATH . 'themes/blue_grey_theme.php';";
echo "\$theme[17]['NAME'] = 'Blue Grey';";
echo "\$theme[18]['PATH'] = SM_PATH . 'themes/dompie_theme.php';";
echo "\$theme[18]['NAME'] = 'Dompie';";
echo "\$theme[19]['PATH'] = SM_PATH . 'themes/methodical_theme.php';";
echo "\$theme[19]['NAME'] = 'Methodical';";
echo "\$theme[20]['PATH'] = SM_PATH . 'themes/greenhouse_effect.php';";
echo "\$theme[20]['NAME'] = 'Greenhouse Effect (Changes)';";
echo "\$theme[21]['PATH'] = SM_PATH . 'themes/in_the_pink.php';";
echo "\$theme[21]['NAME'] = 'In The Pink (Changes)';";
echo "\$theme[22]['PATH'] = SM_PATH . 'themes/kind_of_blue.php';";
echo "\$theme[22]['NAME'] = 'Kind of Blue (Changes)';";
echo "\$theme[23]['PATH'] = SM_PATH . 'themes/monostochastic.php';";
echo "\$theme[23]['NAME'] = 'Monostochastic (Changes)';";
echo "\$theme[24]['PATH'] = SM_PATH . 'themes/shades_of_grey.php';";
echo "\$theme[24]['NAME'] = 'Shades of Grey (Changes)';";
echo "\$theme[25]['PATH'] = SM_PATH . 'themes/spice_of_life.php';";
echo "\$theme[25]['NAME'] = 'Spice of Life (Changes)';";
echo "\$theme[26]['PATH'] = SM_PATH . 'themes/spice_of_life_lite.php';";
echo "\$theme[26]['NAME'] = 'Spice of Life - Lite (Changes)';";
echo "\$theme[27]['PATH'] = SM_PATH . 'themes/spice_of_life_dark.php';";
echo "\$theme[27]['NAME'] = 'Spice of Life - Dark (Changes)';";
echo "\$theme[28]['PATH'] = SM_PATH . 'themes/christmas.php';";
echo "\$theme[28]['NAME'] = 'Holiday - Christmas';";
echo "\$theme[29]['PATH'] = SM_PATH . 'themes/darkness.php';";
echo "\$theme[29]['NAME'] = 'Darkness (Changes)';";
echo "\$theme[30]['PATH'] = SM_PATH . 'themes/random.php';";
echo "\$theme[30]['NAME'] = 'Random (Changes every login)';";
echo "\$theme[31]['PATH'] = SM_PATH . 'themes/midnight.php';";
echo "\$theme[31]['NAME'] = 'Midnight';";
echo "\$theme[32]['PATH'] = SM_PATH . 'themes/alien_glow.php';";
echo "\$theme[32]['NAME'] = 'Alien Glow';";
echo "\$theme[33]['PATH'] = SM_PATH . 'themes/dark_green.php';";
echo "\$theme[33]['NAME'] = 'Dark Green';";
echo "\$theme[34]['PATH'] = SM_PATH . 'themes/penguin.php';";
echo "\$theme[34]['NAME'] = 'Penguin';";
echo "\$theme[35]['PATH'] = SM_PATH . 'themes/minimal_bw.php';";
echo "\$theme[35]['NAME'] = 'Minimal BW';";
echo "\$theme[36]['PATH'] = SM_PATH . 'themes/redmond.php';";
echo "\$theme[36]['NAME'] = 'Redmond';";
echo "\$theme[37]['PATH'] = SM_PATH . 'themes/netstyle_theme.php';";
echo "\$theme[37]['NAME'] = 'Net Style';";
echo "\$theme[38]['PATH'] = SM_PATH . 'themes/silver_steel_theme.php';";
echo "\$theme[38]['NAME'] = 'Silver Steel';";
echo "\$theme[39]['PATH'] = SM_PATH . 'themes/simple_green_theme.php';";
echo "\$theme[39]['NAME'] = 'Simple Green';";
echo "\$theme[40]['PATH'] = SM_PATH . 'themes/wood_theme.php';";
echo "\$theme[40]['NAME'] = 'Wood';";
echo "\$theme[41]['PATH'] = SM_PATH . 'themes/bluesome.php';";
echo "\$theme[41]['NAME'] = 'Bluesome';";
echo "\$theme[42]['PATH'] = SM_PATH . 'themes/simple_green2.php';";
echo "\$theme[42]['NAME'] = 'Simple Green 2';";
echo "\$theme[43]['PATH'] = SM_PATH . 'themes/simple_purple.php';";
echo "\$theme[43]['NAME'] = 'Simple Purple';";
echo "\$theme[44]['PATH'] = SM_PATH . 'themes/autumn.php';";
echo "\$theme[44]['NAME'] = 'Autumn';";
echo "\$theme[45]['PATH'] = SM_PATH . 'themes/autumn2.php';";
echo "\$theme[45]['NAME'] = 'Autumn 2';";
echo "\$theme[46]['PATH'] = SM_PATH . 'themes/blue_on_blue.php';";
echo "\$theme[46]['NAME'] = 'Blue on Blue';";
echo "\$theme[47]['PATH'] = SM_PATH . 'themes/classic_blue.php';";
echo "\$theme[47]['NAME'] = 'Classic Blue';";
echo "\$theme[48]['PATH'] = SM_PATH . 'themes/classic_blue2.php';";
echo "\$theme[48]['NAME'] = 'Classic Blue 2';";
echo "\$theme[49]['PATH'] = SM_PATH . 'themes/powder_blue.php';";
echo "\$theme[49]['NAME'] = 'Powder Blue';";
echo "\$theme[50]['PATH'] = SM_PATH . 'themes/techno_blue.php';";
echo "\$theme[50]['NAME'] = 'Techno Blue';";
echo "\$theme[51]['PATH'] = SM_PATH . 'themes/turquoise.php';";
echo "\$theme[51]['NAME'] = 'Turquoise';";
echo "\$theme[52]['PATH'] = SM_PATH . 'themes/solarized_light.php';";
echo "\$theme[52]['NAME'] = 'Solarized Light';";
echo "\$theme[53]['PATH'] = SM_PATH . 'themes/solarized_dark.php';";
echo "\$theme[53]['NAME'] = 'Solarized Dark';";
echo '';
echo "\$default_use_javascript_addr_book = false;";
echo "\$abook_global_file = '';";
echo "\$abook_global_file_writeable = false;";
echo "\$abook_global_file_listing = true;";
echo "\$abook_file_line_length = 2048;";
echo '';
echo "\$addrbook_dsn = '';";
echo "\$addrbook_table = 'address';";
echo '';
echo "\$prefs_dsn = '';";
echo "\$prefs_table = 'userprefs';";
echo "\$prefs_user_field = 'user';";
echo "\$prefs_key_field = 'prefkey';";
echo "\$prefs_val_field = 'prefval';";
echo "\$addrbook_global_dsn = '';";
echo "\$addrbook_global_table = 'global_abook';";
echo "\$addrbook_global_writeable = false;";
echo "\$addrbook_global_listing = false;";
echo '';
echo "\$no_list_for_subscribe = false;";
echo "\$smtp_auth_mech = 'none';";
echo "\$imap_auth_mech = 'login';";
echo "\$smtp_sitewide_user = '';";
echo "\$smtp_sitewide_pass = '';";
echo "\$use_imap_tls = 0;";
echo "\$use_smtp_tls = 0;";
echo "\$display_imap_login_error = false;";
echo "\$session_name = 'SQMSESSID';";
echo "\$only_secure_cookies = false;";
echo "\$disable_security_tokens = false;";
echo "\$check_referrer = '';";
echo "\$browser_rendering_mode = 'quirks';";
echo "\$use_transparent_security_image = true;";
echo "\$check_mail_mechanism = 'meta';";
echo '';
echo "\$config_location_base = '';";
echo '';
echo "\@include SM_PATH . 'mail/config/config_local.php';"; } > "/var/www/${local_hostname}/htdocs/mail/config/config.php"
}
function install_web_admin {
# This is intended as an admin web user interface
# similar to Plinth or the yunohost
......@@ -1296,6 +1560,18 @@ function install_web_admin {
echo ' }';
echo ' }';
echo '';
echo ' location ^~ /mail {';
echo ' client_max_body_size 200m;';
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.php;';
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;';
......@@ -1341,6 +1617,18 @@ function install_web_admin {
echo ' }';
echo ' }';
echo '';
echo ' location ^~ /mail {';
echo ' client_max_body_size 200m;';
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.php;';
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;';
......@@ -1366,6 +1654,18 @@ function install_web_admin {
echo ' access_log /dev/null;';
echo ' error_log /dev/null;';
echo '';
echo ' location ^~ /mail {';
echo ' client_max_body_size 200m;';
echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.php;';
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 ^~ /admin {';
echo ' client_max_body_size 200m;';
echo " ${basic_auth_str} \"${WEBADMIN_LOGIN_TEXT}\";";
......@@ -1445,6 +1745,8 @@ function install_web_admin {
web_admin_translations_from_upstream
web_admin_translate
install_web_admin_webmail
}
# NOTE: deliberately no exit 0
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