Better Domain Configuration
This commit is contained in:
parent
5308a72f27
commit
ba9086d264
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
||||||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||||
|
|
||||||
|
## [0.2.2]
|
||||||
|
### Added
|
||||||
|
#### Domain Configuration
|
||||||
|
- More infos at resume
|
||||||
|
- New simple check for mail and lang
|
||||||
|
- Answer y is equal to Y...
|
||||||
|
- Domain values can have " for sidebar title, about, title and copyright
|
||||||
|
|
||||||
|
|
||||||
## [0.2.1]
|
## [0.2.1]
|
||||||
### Added
|
### Added
|
||||||
#### Changeslogs
|
#### Changeslogs
|
||||||
|
|
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
||||||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||||
|
|
||||||
|
## [0.2.2]
|
||||||
|
### Added
|
||||||
|
#### Domain Configuration
|
||||||
|
- More infos at resume
|
||||||
|
- New simple check for mail and lang
|
||||||
|
- Answer y is equal to Y...
|
||||||
|
- Domain values can have " for sidebar title, about, title and copyright
|
||||||
|
|
||||||
|
|
||||||
## [0.2.1]
|
## [0.2.1]
|
||||||
### Added
|
### Added
|
||||||
#### Changeslogs
|
#### Changeslogs
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
# Added
|
# Added
|
||||||
## Changeslogs
|
## Domain Configuration
|
||||||
- CHANGELOG.md
|
- More infos at resume
|
||||||
- last-version.md in help folder (for -v and -u arguments)
|
- New simple check for mail and lang
|
||||||
|
- Answer y is equal to Y...
|
||||||
## Arguments
|
- Domain values can have " for sidebar title, about, title and copyright
|
||||||
- - -v: Show installed version and last changes
|
|
||||||
- - -u: Check for available update and show last changes
|
|
||||||
- - -U: like -u, but ask to perform upgrade (except for debian based)
|
|
||||||
- - --help: like help, -h
|
|
||||||
- - license: show STL license
|
|
||||||
|
|
||||||
## Dependancies
|
|
||||||
- curl
|
|
||||||
|
|
||||||
## Article
|
|
||||||
- Check article size (must be > 60 to be checked)
|
|
||||||
|
|
||||||
## DB
|
|
||||||
- db (ARTICLE): Inform if article is not in Database yet
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Version: 0.2.1
|
# Version: 0.2.2
|
||||||
# Name: Statique Littérateur
|
# Name: Statique Littérateur
|
||||||
# Type: Executable
|
# Type: Executable
|
||||||
# file: stl
|
# file: stl
|
||||||
|
|
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
||||||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||||
|
|
||||||
|
## [0.2.2]
|
||||||
|
### Added
|
||||||
|
#### Domain Configuration
|
||||||
|
- More infos at resume
|
||||||
|
- New simple check for mail and lang
|
||||||
|
- Answer y is equal to Y...
|
||||||
|
- Domain values can have " for sidebar title, about, title and copyright
|
||||||
|
|
||||||
|
|
||||||
## [0.2.1]
|
## [0.2.1]
|
||||||
### Added
|
### Added
|
||||||
#### Changeslogs
|
#### Changeslogs
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
# Added
|
# Added
|
||||||
## Changeslogs
|
## Domain Configuration
|
||||||
- CHANGELOG.md
|
- More infos at resume
|
||||||
- last-version.md in help folder (for -v and -u arguments)
|
- New simple check for mail and lang
|
||||||
|
- Answer y is equal to Y...
|
||||||
## Arguments
|
- Domain values can have " for sidebar title, about, title and copyright
|
||||||
- - -v: Show installed version and last changes
|
|
||||||
- - -u: Check for available update and show last changes
|
|
||||||
- - -U: like -u, but ask to perform upgrade (except for debian based)
|
|
||||||
- - --help: like help, -h
|
|
||||||
- - license: show STL license
|
|
||||||
|
|
||||||
## Dependancies
|
|
||||||
- curl
|
|
||||||
|
|
||||||
## Article
|
|
||||||
- Check article size (must be > 60 to be checked)
|
|
||||||
|
|
||||||
## DB
|
|
||||||
- db (ARTICLE): Inform if article is not in Database yet
|
|
||||||
|
|
|
@ -40,17 +40,17 @@ if [[ -f "$stl_file_pwd_conf" ]];then
|
||||||
source "$stl_file_pwd_conf" # Source config PWD file
|
source "$stl_file_pwd_conf" # Source config PWD file
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "# No domain set from this directory"
|
echo "# No domain set for this directory: $PWD"
|
||||||
[[ $domain_add ]] && domain__set
|
[[ $domain_add ]] && domain__set
|
||||||
[[ $domain_check ]] || exit # exit if domain__get call
|
[[ $domain_check ]] || exit # exit if domain__get call
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# From command line domain
|
# From command line domain only (check)
|
||||||
if [[ $domain_check ]] && [[ $domain_name ]];then
|
if [[ $domain_check ]] && [[ $domain_name ]];then
|
||||||
[[ $domain_edit ]] \
|
[[ $domain_edit ]] \
|
||||||
&& nano "$stl_file_pwd_conf"
|
&& nano "$stl_file_pwd_conf"
|
||||||
|
|
||||||
echo "# Domain set from this directory: $domain_name"
|
echo "# Domain '$domain_name' set for this directory: $PWD"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -109,8 +109,8 @@ if__writeable "$PWD"
|
||||||
else
|
else
|
||||||
read -rp "- Use 'https://' protocol (N for 'http://') ? " set_prot
|
read -rp "- Use 'https://' protocol (N for 'http://') ? " set_prot
|
||||||
case "$set_prot" in
|
case "$set_prot" in
|
||||||
Y) domain_protocol="https://" ;;
|
Y|y) domain_protocol="https://" ;;
|
||||||
N) domain_protocol="http://" ;;
|
N|n) domain_protocol="http://" ;;
|
||||||
*) echo "# Maybe later...";exit ;;
|
*) echo "# Maybe later...";exit ;;
|
||||||
esac
|
esac
|
||||||
domain_ask+="$domain_name"
|
domain_ask+="$domain_name"
|
||||||
|
@ -120,12 +120,16 @@ if__writeable "$PWD"
|
||||||
# ----------
|
# ----------
|
||||||
# Processing question to config domain
|
# Processing question to config domain
|
||||||
# ----------
|
# ----------
|
||||||
echo -e "\n# You will be asked to confirm after resume"
|
printf '\n%s\n%s\n\n' \
|
||||||
|
"# You will be asked to confirm after resume" \
|
||||||
|
"# Empty anwser or mismatch value cancel process !"
|
||||||
|
|
||||||
|
|
||||||
# DOMAIN is set in command line ?
|
# DOMAIN is set in command line ?
|
||||||
|
# ----------
|
||||||
case "$domain_name" in
|
case "$domain_name" in
|
||||||
'')
|
'')
|
||||||
read -rp "- Which domain to set ? " domain_name
|
read -rp "- Which domain to set (i.e. www.example.com) ? " domain_name
|
||||||
is__set "$domain_name"
|
is__set "$domain_name"
|
||||||
is__protocol
|
is__protocol
|
||||||
;;
|
;;
|
||||||
|
@ -136,63 +140,97 @@ case "$domain_name" in
|
||||||
|
|
||||||
read -rp "$domain_ask (Y|*) ? " domain_confirm
|
read -rp "$domain_ask (Y|*) ? " domain_confirm
|
||||||
case "$domain_confirm" in
|
case "$domain_confirm" in
|
||||||
Y) true ;;
|
Y|y) true ;;
|
||||||
*) echo "# Maybe later...";exit ;;
|
*) echo "# Maybe later...";exit ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Where is the server ? /var/www ?
|
# Where is the server ? /var/www ?
|
||||||
|
# ----------
|
||||||
read -erp "- Where is your server URI ? " srv_uri
|
read -erp "- Where is your server URI ? " srv_uri
|
||||||
is__set "srv_uri"
|
is__set "srv_uri"
|
||||||
[[ "${srv_uri: -1}" == "/" ]] \
|
[[ "${srv_uri: -1}" == "/" ]] \
|
||||||
&& srv_uri=${srv_uri::-1}
|
&& srv_uri=${srv_uri::-1}
|
||||||
|
|
||||||
! [[ -d "$srv_uri" ]] \
|
! [[ -d "$srv_uri" ]] \
|
||||||
&& echo "! Missing directory" \
|
&& echo "! Missing directory: $srv_uri" \
|
||||||
&& exit
|
&& exit
|
||||||
|
|
||||||
if__writeable "$srv_uri"
|
if__writeable "$srv_uri"
|
||||||
domain_srv="$srv_uri/$domain_name"
|
domain_srv="$srv_uri/$domain_name"
|
||||||
|
|
||||||
|
|
||||||
# Installation: server or local
|
# Installation: server or local
|
||||||
read -rp "- STL server installed (Y|N for local ; use wip only) ? " install
|
# ----------
|
||||||
|
read -rp "- STL server (Y|N for local = no WWW, WIP only) ? " install
|
||||||
case "$install" in
|
case "$install" in
|
||||||
Y|y) stl_install="server" ;;
|
Y|y) stl_install="server" ;;
|
||||||
N|n) stl_install="local" ;;
|
N|n) stl_install="local" ;;
|
||||||
*) echo "# Maybe later..." ;;
|
*) echo "# Maybe later..." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Domain TITLE
|
# Domain TITLE
|
||||||
|
# ----------
|
||||||
read -rp "- Domain Title ? " domain_title
|
read -rp "- Domain Title ? " domain_title
|
||||||
is__set "$domain_title"
|
is__set "$domain_title"
|
||||||
|
[[ "$domain_title" =~ \" ]] \
|
||||||
|
&& domain_title=`sed -e 's^"^\\\\"^g' <<<"$domain_title"`
|
||||||
|
|
||||||
|
|
||||||
# Domain ABOUT
|
# Domain ABOUT
|
||||||
|
# ----------
|
||||||
read -rp "- Domain About ? " domain_about
|
read -rp "- Domain About ? " domain_about
|
||||||
is__set "$domain_about"
|
is__set "$domain_about"
|
||||||
|
[[ "$domain_about" =~ \" ]] \
|
||||||
|
&& domain_about=`sed -e 's^"^\\\\"^g' <<<"$domain_about"`
|
||||||
|
|
||||||
|
|
||||||
# Domain LANG
|
# Domain LANG
|
||||||
read -rp "- Domain lang (i.e. fr) ? " domain_lang
|
# ----------
|
||||||
|
read -rp "- Domain lang (i.e. fr ; 2 characters) ? " domain_lang
|
||||||
is__set "$domain_lang"
|
is__set "$domain_lang"
|
||||||
|
! (( ${#domain_lang} == 2 )) \
|
||||||
|
&& echo "! Lang must be 2 characters (i.e. fr, gb, en...)" \
|
||||||
|
&& exit
|
||||||
|
|
||||||
|
|
||||||
# Domain MAIL
|
# Domain MAIL
|
||||||
|
# ----------
|
||||||
read -rp "- Domain mail ? " domain_mail
|
read -rp "- Domain mail ? " domain_mail
|
||||||
is__set "$domain_mail"
|
is__set "$domain_mail"
|
||||||
|
! [[ "$domain_mail" =~ @ ]] \
|
||||||
|
&& echo "! Mail must contain @..." \
|
||||||
|
&& exit
|
||||||
|
|
||||||
|
|
||||||
# Domain TAGS
|
# Domain TAGS
|
||||||
read -rp "- Domain tags (comma separated) ? " domain_tags
|
# ----------
|
||||||
|
read -rp "- Domain MAIN tags (comma separated) ? " domain_tags
|
||||||
is__set "$domain_tags"
|
is__set "$domain_tags"
|
||||||
|
|
||||||
# Domain TAGS
|
|
||||||
read -rp "- Domain copyright ? " domain_cr
|
# Domain Copyright
|
||||||
|
# ----------
|
||||||
|
read -rp "- Domain copyright (i.e. CC BY-NC-SA) ? " domain_cr
|
||||||
is__set "$domain_cr"
|
is__set "$domain_cr"
|
||||||
|
[[ "$domain_cr" =~ \" ]] \
|
||||||
|
&& domain_cr=`sed -e 's^"^\\\\"^g' <<<"$domain_cr"`
|
||||||
|
|
||||||
|
|
||||||
# Domain SIDEBAR TITLE
|
# Domain SIDEBAR TITLE
|
||||||
read -rp "- Domain sidebar title ? " domain_sidebar_title
|
# ----------
|
||||||
|
read -rp "- Domain sidebar title (i.e. last news) ? " domain_sidebar_title
|
||||||
is__set "$domain_sidebar_title"
|
is__set "$domain_sidebar_title"
|
||||||
|
# Replace " with \" if exists
|
||||||
|
[[ "$domain_sidebar_title" =~ \" ]] \
|
||||||
|
&& domain_sidebar_title=`sed -e 's^"^\\\\"^g' <<<"$domain_sidebar_title"`
|
||||||
|
|
||||||
# Domain SIDEBAR TITLE
|
|
||||||
read -rp "- Domain sidebar items (1-24) ? " domain_sidebar_items
|
# Domain SIDEBAR title NUMBERS
|
||||||
|
# ----------
|
||||||
|
read -rp "- Domain sidebar items max number (1-24) ? " domain_sidebar_items
|
||||||
is__set "$domain_sidebar_items"
|
is__set "$domain_sidebar_items"
|
||||||
! [[ $domain_sidebar_items =~ ^[0-9]+$ ]] \
|
! [[ $domain_sidebar_items =~ ^[0-9]+$ ]] \
|
||||||
&& echo "! $domain_sidebar_items is not digits between 1-24" \
|
&& echo "! $domain_sidebar_items is not digits between 1-24" \
|
||||||
|
@ -202,45 +240,63 @@ is__set "$domain_sidebar_items"
|
||||||
&& echo "! $domain_sidebar_items is not between 1-24" \
|
&& echo "! $domain_sidebar_items is not between 1-24" \
|
||||||
&& exit
|
&& exit
|
||||||
|
|
||||||
|
|
||||||
# Domain CSS PREFIX
|
# Domain CSS PREFIX
|
||||||
read -rp "- Domain CSS prefix (alnum,-) ? " domain_css
|
# ----------
|
||||||
|
read -rp "- Domain CSS prefix (alpha numeric and -) ? " domain_css
|
||||||
is__set "$domain_css"
|
is__set "$domain_css"
|
||||||
|
|
||||||
! [[ $domain_css =~ ^[a-zA-Z0-9_-]+$ ]] \
|
! [[ $domain_css =~ ^[a-zA-Z0-9_-]+$ ]] \
|
||||||
&& echo "! '$domain_css' is not alpha numeric. '-' is authorized" \
|
&& echo "! '$domain_css' is not alpha numeric. '-' is authorized" \
|
||||||
&& exit
|
&& exit
|
||||||
|
|
||||||
|
domain_css=${domain_css,,}
|
||||||
case "${domain_css: -1}" in
|
case "${domain_css: -1}" in
|
||||||
"_"|"-") domain_css=${domain_css::-1} ;;
|
"_"|"-") domain_css=${domain_css::-1} ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
domain_css=${domain_css,,}
|
|
||||||
|
|
||||||
# Domain LOGO
|
# Domain LOGO
|
||||||
read -rp "- Domain logo filename ? " domain_logo
|
# ----------
|
||||||
|
read -rp "- Domain logo filename (i.e. mylogo.png) ? " domain_logo
|
||||||
|
|
||||||
|
|
||||||
# External URL Profile
|
# External URL Profile
|
||||||
read -rp "- Domain external URL Profile ? " domain_ext_url
|
# ----------
|
||||||
|
read -rp "- Domain external URL Profile (empty if unknown) ? " domain_ext_url
|
||||||
|
|
||||||
|
|
||||||
# Statoolinfos
|
# Statoolinfos
|
||||||
read -rp "- Generate file stats (Statoolinfos) ? " domain_stats
|
# ----------
|
||||||
|
read -rp "- Generate file stats for Statoolinfos (Y|N) ? " domain_stats
|
||||||
case "$domain_stats" in
|
case "$domain_stats" in
|
||||||
Y|y) domain_stats="yes" ;;
|
Y|y) domain_stats="yes" ;;
|
||||||
N|n) domain_stats="no" ;;
|
N|n) domain_stats="no" ;;
|
||||||
*) echo "# Maybe later..." ;;
|
*) echo "# Maybe later..." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# ----------
|
||||||
# Resume before writing conf
|
# Resume before writing conf
|
||||||
# ------
|
# ----------
|
||||||
clear
|
clear
|
||||||
echo -e "# Resume configuration...\n"
|
echo -e "# Resume configuration...\n"
|
||||||
cat <<EODOMAINCONF
|
cat <<EODOMAINCONF
|
||||||
STL Inslallation : $stl_install
|
STL Inslallation : $stl_install
|
||||||
STL stats generator : $domain_stats
|
STL stats generator : $domain_stats
|
||||||
Domain Directory : $PWD
|
Domain Directory : $PWD/
|
||||||
|
Domain Articles : $PWD/articles/
|
||||||
|
Domain Generic files : $PWD/articles/files (for PDF, scripts...)
|
||||||
|
Domain Generic images: $PWD/articles/images (for png, jpg, svg...)
|
||||||
Domain : $domain_name
|
Domain : $domain_name
|
||||||
URL : $domain_protocol$domain_name
|
URL : $domain_protocol$domain_name
|
||||||
Server URI : $domain_srv
|
Server URI : $domain_srv
|
||||||
|
Server WIP : $domain_srv/wip/
|
||||||
|
$(
|
||||||
|
if [[ $stl_install == "server" ]];then
|
||||||
|
echo "Server WWW : $domain_srv/www/"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
Title : $domain_title
|
Title : $domain_title
|
||||||
About : $domain_about
|
About : $domain_about
|
||||||
|
@ -250,17 +306,25 @@ Tags : $domain_tags
|
||||||
Copyright : $domain_cr
|
Copyright : $domain_cr
|
||||||
Sidebar Name : $domain_sidebar_title
|
Sidebar Name : $domain_sidebar_title
|
||||||
Sidebar Items : $domain_sidebar_items
|
Sidebar Items : $domain_sidebar_items
|
||||||
CSS prefix : $domain_css
|
CSS prefix : $domain_css (configuree your own style.css)
|
||||||
Logo filename : $domain_logo
|
$(
|
||||||
|
if ! [[ $domain_logo ]];then
|
||||||
|
echo "Logo filename : To add one, type stl domain edit and put it in $domain_srv/wip/template/"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Logo filename : $domain_logo (put it in $domain_srv/wip/template/)"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
External URL Profile : $domain_ext_url
|
External URL Profile : $domain_ext_url
|
||||||
|
|
||||||
EODOMAINCONF
|
EODOMAINCONF
|
||||||
|
|
||||||
echo -e "! Use $domain_name only in $PWD"
|
echo -e "! Use $domain_name only in $PWD"
|
||||||
read -rp "- Write to $PWD/.stl.conf ? " set_conf
|
read -rp "- Write to $PWD/.stl.conf (Y|*) ? " set_conf
|
||||||
case "$set_conf" in
|
case "$set_conf" in
|
||||||
Y) true ;;
|
Y|y) true ;;
|
||||||
*) echo "Maybe later...";exit ;;
|
*) echo "# Maybe later...";exit ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue