2022-02-13 17:58:25 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# file: gsl__new_website
|
|
|
|
# Folder: /var/lib/gsl/scripts
|
|
|
|
# By echolib
|
|
|
|
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
|
|
|
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
#
|
|
|
|
# Configure new WEBSITE from DOMAIN
|
|
|
|
#
|
|
|
|
#=======================================================================
|
|
|
|
gsl__new_website() {
|
2022-04-12 17:56:54 +02:00
|
|
|
gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" read
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
clear
|
|
|
|
cat $gsl_dir_helps/gsl_infos_new_website
|
|
|
|
printf '\n%s\n%s\n%s\n' \
|
|
|
|
"# Configuration of a new website..." \
|
|
|
|
"# Cancel with empty field" \
|
|
|
|
"# You will be asked to confirm at the end"
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Domain URL
|
|
|
|
#=======================================================================
|
2022-02-16 14:11:41 +01:00
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# URL: www.example.com" \
|
2022-02-13 17:58:25 +01:00
|
|
|
"(https:// will be added if missing or force with http://)"
|
2022-04-06 18:28:48 +02:00
|
|
|
read -rp \
|
|
|
|
": Website URL ? " \
|
|
|
|
gsl_set_url
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-02-16 14:11:41 +01:00
|
|
|
[[ ${gsl_set_url: -1} == "/" ]] \
|
|
|
|
&& gsl_set_url=${gsl_set_url::-1}
|
|
|
|
|
|
|
|
gsl__check_settings $gsl_set_url || return
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
gsl_https='https://'
|
|
|
|
case "$gsl_set_url" in
|
|
|
|
"https://"*)
|
|
|
|
gsl_set_ndd=${gsl_set_url/$gsl_https/}
|
|
|
|
;;
|
|
|
|
"http://"*)
|
|
|
|
gsl_http="http://"
|
|
|
|
gsl_set_ndd=${gsl_set_url/$gsl_http/}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
gsl_set_ndd="$gsl_set_url"
|
|
|
|
gsl_https+=$gsl_set_url
|
|
|
|
gsl_set_url=$gsl_https
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Domain NAME
|
|
|
|
gsl_set_ndd=`awk -F"." '{print $(NF-1)"."$NF}' <<< $gsl_set_ndd`
|
|
|
|
gsl_set_file_ndd="$gsl_set_ndd.conf"
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ -f "$gsl_dir_user_domains/$gsl_set_ndd/$gsl_set_file_ndd" ]] \
|
|
|
|
&& gsl_profile="$gsl_dir_user_domains/$gsl_set_ndd/$gsl_set_file_ndd" \
|
2022-02-16 14:11:41 +01:00
|
|
|
&& gsl_set_user_conf="Y"
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ -f "$gsl_dir_global_domains/$gsl_set_ndd/$gsl_set_file_ndd" ]] \
|
|
|
|
&& gsl_profile="$gsl_dir_global_domains/$gsl_set_ndd/$gsl_set_file_ndd" \
|
2022-02-16 14:11:41 +01:00
|
|
|
&& gsl_set_user_conf="N"
|
|
|
|
|
|
|
|
if [[ "$gsl_profile" ]];then
|
2022-04-12 17:56:54 +02:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_w" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Found configuration from $gsl_set_ndd" \
|
|
|
|
"$gsl_profile"
|
|
|
|
|
|
|
|
echo -e "\n! A Profile exists: $gsl_profile"
|
|
|
|
read -rp ": Continue (Y|*) " gsl_continue
|
2022-02-16 14:11:41 +01:00
|
|
|
case "$gsl_continue" in
|
2022-04-12 17:56:54 +02:00
|
|
|
Y|y)
|
|
|
|
source "$gsl_profile" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Load configuration from $gsl_set_ndd" \
|
|
|
|
"$gsl_profile"
|
|
|
|
gsl_profile_exists=true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return
|
|
|
|
;;
|
2022-02-16 14:11:41 +01:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
#=======================================================================
|
|
|
|
# Webserver URI
|
|
|
|
#=======================================================================
|
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Webserver registred: $gsl_site_server" \
|
|
|
|
|| echo -e "\n# Webserver: /var/www (Or maybe elsewhere...)"
|
|
|
|
|
|
|
|
read -erp \
|
|
|
|
": Webserver URI ? " \
|
|
|
|
gsl_set_server
|
|
|
|
|
|
|
|
[[ ${gsl_set_server: -1} == "/" ]] \
|
|
|
|
&& gsl_set_server=${gsl_set_server::-1}
|
|
|
|
|
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_server" ]];then
|
|
|
|
[[ "$gsl_site_server" ]] \
|
|
|
|
&& gsl_set_server="$gsl_site_server" \
|
|
|
|
|| gsl__check_settings $gsl_set_server || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_server || return
|
|
|
|
fi
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
#=======================================================================
|
|
|
|
# Personal use or global use ?
|
|
|
|
#=======================================================================
|
2022-02-16 14:11:41 +01:00
|
|
|
if ! [[ "$gsl_set_user_conf" ]];then
|
|
|
|
echo -e "\n# Save Domain in Home or Global"
|
|
|
|
read -rp \
|
|
|
|
": Home Use (y/n) ? " \
|
|
|
|
gsl_set_user_conf
|
|
|
|
fi
|
2022-04-12 17:56:54 +02:00
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
case "$gsl_set_user_conf" in
|
|
|
|
y|Y)
|
|
|
|
gsl_save_dir_ndd="$gsl_dir_user_domains/$gsl_set_ndd"
|
|
|
|
gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd"
|
2022-04-12 17:56:54 +02:00
|
|
|
gsl_ask="# Save to $gsl_save_conf_ndd (y|*) ? "
|
2022-02-13 17:58:25 +01:00
|
|
|
;;
|
|
|
|
n|N)
|
|
|
|
gsl_save_dir_ndd="$gsl_dir_global_domains/$gsl_set_ndd"
|
|
|
|
gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd"
|
2022-04-12 17:56:54 +02:00
|
|
|
gsl_ask="# Save to $gsl_save_conf_ndd (y|*) ? "
|
2022-02-13 17:58:25 +01:00
|
|
|
;;
|
|
|
|
*) echo "! Abandon... Maybe next time" && return ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Website Title
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Title registred: $gsl_site_title" \
|
|
|
|
|| echo -e "\n# Title: My Compagny (or My beautiful website)"
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
read -rp \
|
|
|
|
": Website Title ? " \
|
|
|
|
gsl_set_title
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_title" ]];then
|
|
|
|
[[ "$gsl_site_title" ]] \
|
|
|
|
&& gsl_set_title="$gsl_site_title" \
|
|
|
|
|| gsl__check_settings $gsl_set_title || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_title || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Website Description
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Description registred: $gsl_site_about" \
|
|
|
|
|| echo -e "\n# Description: writings about this website"
|
|
|
|
|
2022-04-06 18:28:48 +02:00
|
|
|
read -rp \
|
|
|
|
": Website Description ? " \
|
|
|
|
gsl_set_about
|
2022-02-16 14:11:41 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_about" ]];then
|
|
|
|
[[ "$gsl_site_about" ]] \
|
|
|
|
&& gsl_set_about="$gsl_site_about" \
|
|
|
|
|| gsl__check_settings $gsl_set_about || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_about || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Contact Mail
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Mail registred: $gsl_site_mail" \
|
|
|
|
|| echo -e "\n# Mail: contact@example.com"
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
read -rp \
|
|
|
|
": Contact Mail ? " \
|
|
|
|
gsl_set_mail
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_mail" ]];then
|
|
|
|
[[ "$gsl_site_mail" ]] \
|
|
|
|
&& gsl_set_mail="$gsl_site_mail" \
|
|
|
|
|| gsl__check_settings $gsl_set_mail || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_mail || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Website Keywords
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# GENERIC pages Keywords registred: $gsl_site_keys" \
|
|
|
|
"! Will be used on each post !"
|
|
|
|
else
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# GENERIC pages Keywords: geek stuff,free (comma separated)" \
|
|
|
|
"! Will be used on each post !"
|
|
|
|
fi
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
read -rp \
|
2022-02-16 14:11:41 +01:00
|
|
|
": Website Keywords for all Pages ? " \
|
2022-02-13 17:58:25 +01:00
|
|
|
gsl_set_keys
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_keys" ]];then
|
|
|
|
[[ "$gsl_site_keys" ]] \
|
|
|
|
&& gsl_set_keys="$gsl_site_keys" \
|
|
|
|
|| gsl__check_settings $gsl_set_keys || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_keys || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Language
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Language registred: $gsl_site_lang" \
|
|
|
|
|| echo -e "\n# Language: fr (or en-GB...)"
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
read -rp \
|
|
|
|
": Website Lang ? " \
|
2022-04-06 18:28:48 +02:00
|
|
|
gsl_set_lang
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_lang" ]];then
|
|
|
|
[[ "$gsl_site_lang" ]] \
|
|
|
|
&& gsl_set_lang="$gsl_site_lang" \
|
|
|
|
|| gsl__check_settings $gsl_set_lang || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_lang || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Copyright
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
[[ $gsl_profile_exists ]] \
|
|
|
|
&& echo -e "\n# Copyright registred: $gsl_site_cr" \
|
|
|
|
|| echo -e "\n# Copyright: 2022 TITLE CC-BY-SA"
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
read -rp \
|
|
|
|
": Website Copyright ? " \
|
|
|
|
gsl_set_cr
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_cr" ]];then
|
|
|
|
[[ "$gsl_site_cr" ]] \
|
|
|
|
&& gsl_set_cr="$gsl_site_cr" \
|
|
|
|
|| gsl__check_settings $gsl_set_cr || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_cr || return
|
|
|
|
fi
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Website Logo
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# logo registred: $gsl_site_logo" \
|
|
|
|
"Put it in $gsl_save_dir_ndd/templates/"
|
|
|
|
else
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# logo: my-logo.png" \
|
|
|
|
"Put it in $gsl_save_dir_ndd/templates/"
|
|
|
|
fi
|
|
|
|
|
2022-04-06 18:28:48 +02:00
|
|
|
read -rp \
|
|
|
|
": Website logo file NAME ? " \
|
|
|
|
gsl_set_logo
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_logo" ]];then
|
|
|
|
[[ "$gsl_site_logo" ]] \
|
|
|
|
&& gsl_set_logo="$gsl_site_logo" \
|
|
|
|
|| gsl__check_settings $gsl_set_logo || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_logo || return
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Last Posts listing name header
|
|
|
|
#=======================================================================
|
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# Title List Name registred: $gsl_site_listname" \
|
|
|
|
"Title List to show before last posts"
|
|
|
|
else
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# Title List Name: My Last Posts" \
|
|
|
|
"Title List to show before last posts"
|
|
|
|
fi
|
|
|
|
|
|
|
|
read -rp \
|
|
|
|
": Title List Name ? " \
|
|
|
|
gsl_set_listname
|
|
|
|
|
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_listname" ]];then
|
|
|
|
[[ "$gsl_site_listname" ]] \
|
|
|
|
&& gsl_set_listname="$gsl_site_listname" \
|
|
|
|
|| gsl__check_settings $gsl_set_listname || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_listname || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# CSS Acronym
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# CSS (short) Acronym registred: $gsl_site_css" \
|
|
|
|
"Will create specific HTML classes like ${gsl_site_css}_paragraph"
|
|
|
|
else
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# CSS (short) Acronym: myweb !No need to end with _" \
|
|
|
|
"Will create specific HTML classes like myweb_paragraph"
|
|
|
|
fi
|
|
|
|
|
2022-04-06 18:28:48 +02:00
|
|
|
read -rp \
|
|
|
|
": CSS Acronym ? " \
|
|
|
|
gsl_set_css
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_css" ]];then
|
|
|
|
[[ "$gsl_site_css" ]] \
|
|
|
|
&& gsl_set_css="$gsl_site_css" \
|
|
|
|
|| gsl__check_settings $gsl_set_css || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_css || return
|
|
|
|
fi
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Author Reference
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# Author/Compagny URL Profile registred: $gsl_site_auth_url" \
|
|
|
|
"Used for meta rel='me'"
|
|
|
|
else
|
|
|
|
printf '\n%s\n %s\n' \
|
|
|
|
"# Author/Compagny URL Profile: https://..." \
|
|
|
|
"Used for meta rel='me'"
|
|
|
|
fi
|
|
|
|
|
2022-04-06 18:28:48 +02:00
|
|
|
read -rp \
|
|
|
|
": Author URL Profile ? " \
|
|
|
|
gsl_set_auth_url
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ $gsl_profile_exists ]];then
|
|
|
|
if ! [[ "$gsl_set_auth_url" ]];then
|
|
|
|
[[ "$gsl_site_auth_url" ]] \
|
|
|
|
&& gsl_set_auth_url="$gsl_site_auth_url" \
|
|
|
|
|| gsl__check_settings $gsl_set_auth_url || return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gsl__check_settings $gsl_set_auth_url || return
|
|
|
|
fi
|
2022-02-16 14:11:41 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Folder for Posts
|
|
|
|
#=======================================================================
|
|
|
|
printf '\n%s\n %s\n %s\n' \
|
2022-04-06 18:28:48 +02:00
|
|
|
"# You can set here a folder for your writings' Posts" \
|
2022-04-12 17:56:54 +02:00
|
|
|
"Leave Empty to manually do it later (see help)" \
|
2022-02-16 14:11:41 +01:00
|
|
|
"Autocompletion /NEWFOLDER (name of choice)"
|
2022-04-12 17:56:54 +02:00
|
|
|
|
2022-04-06 18:28:48 +02:00
|
|
|
read -erp \
|
|
|
|
": Where will you add your files' [post].gsl ? " \
|
|
|
|
gsl_dir_user_posts
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Show Resume
|
|
|
|
#=======================================================================
|
|
|
|
clear
|
2022-04-12 17:56:54 +02:00
|
|
|
printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
|
2022-02-13 17:58:25 +01:00
|
|
|
"# New Website configurations..." \
|
|
|
|
": Webserver|$gsl_set_server" \
|
|
|
|
": URL|$gsl_set_url" \
|
|
|
|
": Domain|$gsl_set_ndd" \
|
|
|
|
": Title|$gsl_set_title" \
|
|
|
|
": Description|$gsl_set_about" \
|
|
|
|
": Contact|$gsl_set_mail" \
|
|
|
|
": Keywords|$gsl_set_keys" \
|
|
|
|
": Language|$gsl_set_lang" \
|
|
|
|
": Copyright|$gsl_set_cr" \
|
|
|
|
": Logo File|$gsl_set_logo" \
|
2022-04-12 17:56:54 +02:00
|
|
|
": Title List|$gsl_set_listname" \
|
2022-02-13 17:58:25 +01:00
|
|
|
": CSS Acro|$gsl_set_css" \
|
|
|
|
": Author URL|$gsl_set_auth_url" \
|
2022-02-27 19:16:16 +01:00
|
|
|
": User folder writings' Posts|$gsl_dir_user_posts" \
|
2022-02-13 17:58:25 +01:00
|
|
|
| column -t -s'|'
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
#=======================================================================
|
|
|
|
# Ask to Confirm
|
|
|
|
#=======================================================================
|
|
|
|
echo
|
2022-04-12 17:56:54 +02:00
|
|
|
read -rp "$gsl_ask " gsl_set_confirm
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
case "$gsl_set_confirm" in
|
2022-02-16 14:11:41 +01:00
|
|
|
y|Y)
|
|
|
|
gsl__logs_print \
|
2022-04-12 17:56:54 +02:00
|
|
|
"$gsl_log_w" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Confirmed configuration from $gsl_set_ndd" \
|
|
|
|
"$gsl_save_conf_ndd"
|
|
|
|
|
|
|
|
if ! [[ -d "$gsl_save_dir_ndd" ]];then
|
|
|
|
mkdir -p "$gsl_save_dir_ndd" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Create Folder configuration for $gsl_set_ndd" \
|
|
|
|
"$gsl_save_dir_ndd/"
|
|
|
|
fi
|
2022-02-16 14:11:41 +01:00
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
# Create et set a folder for writings' posts
|
|
|
|
if [[ $gsl_dir_user_posts ]];then
|
|
|
|
mkdir -p "$gsl_dir_user_posts" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Create Folder Posts for $gsl_set_ndd" \
|
|
|
|
"$gsl_dir_user_posts/"
|
|
|
|
|
|
|
|
touch "$gsl_dir_user_posts/gsl.$gsl_set_ndd" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Folder set with gsl.$gsl_set_ndd" \
|
|
|
|
"$gsl_dir_user_posts/"
|
2022-02-16 14:11:41 +01:00
|
|
|
fi
|
|
|
|
;;
|
2022-04-12 17:56:54 +02:00
|
|
|
|
2022-02-16 14:11:41 +01:00
|
|
|
*)
|
2022-04-12 17:56:54 +02:00
|
|
|
return
|
2022-02-16 14:11:41 +01:00
|
|
|
;;
|
2022-02-13 17:58:25 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Save config
|
|
|
|
#=======================================================================
|
2022-04-12 17:56:54 +02:00
|
|
|
printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
|
2022-02-13 17:58:25 +01:00
|
|
|
"gsl_site_server=\"$gsl_set_server\"" \
|
|
|
|
"gsl_site_url=\"$gsl_set_url\"" \
|
|
|
|
"gsl_site_ndd=\"$gsl_set_ndd\"" \
|
|
|
|
"gsl_site_title=\"$gsl_set_title\"" \
|
|
|
|
"gsl_site_about=\"$gsl_set_about\"" \
|
|
|
|
"gsl_site_mail=\"$gsl_set_mail\"" \
|
|
|
|
"gsl_site_keys=\"$gsl_set_keys\"" \
|
|
|
|
"gsl_site_lang=\"$gsl_set_lang\"" \
|
|
|
|
"gsl_site_cr=\"$gsl_set_cr\"" \
|
|
|
|
"gsl_site_logo=\"$gsl_set_logo\"" \
|
2022-04-12 17:56:54 +02:00
|
|
|
"gsl_site_listname=\"$gsl_set_listname\"" \
|
2022-02-13 17:58:25 +01:00
|
|
|
"gsl_site_css=\"$gsl_set_css\"" \
|
|
|
|
"gsl_site_auth_url=\"$gsl_set_auth_url\"" \
|
2022-04-12 17:56:54 +02:00
|
|
|
> "$gsl_save_conf_ndd" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_w" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Write configuration for $gsl_set_ndd" \
|
|
|
|
"$gsl_save_conf_ndd"
|
2022-02-13 17:58:25 +01:00
|
|
|
|
|
|
|
if ! [[ `grep "$gsl_save_dir_ndd" "$gsl_file_db_domains"` ]];then
|
2022-04-12 17:56:54 +02:00
|
|
|
echo "$gsl_save_dir_ndd" >> "$gsl_file_db_domains" && \
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_w" \
|
|
|
|
"New" \
|
|
|
|
"Profile" \
|
|
|
|
"Add $gsl_save_dir_ndd to DB for $gsl_set_ndd" \
|
|
|
|
"$gsl_file_db_domains"
|
2022-02-13 17:58:25 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Check if no Response from $@
|
|
|
|
#=======================================================================
|
|
|
|
gsl__check_settings() {
|
2022-02-16 14:11:41 +01:00
|
|
|
[[ "$@" ]] && return
|
|
|
|
echo "! Abandon... Maybe next time"
|
2022-04-06 18:37:23 +02:00
|
|
|
exit
|
2022-02-13 17:58:25 +01:00
|
|
|
}
|