diff --git a/CHANGELOG.md b/CHANGELOG.md index 6444412..0f5db88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ STL: Statique Littérateur - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - 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] ### Added #### Changeslogs diff --git a/help/CHANGELOG.md b/help/CHANGELOG.md index 6444412..0f5db88 100644 --- a/help/CHANGELOG.md +++ b/help/CHANGELOG.md @@ -6,6 +6,15 @@ STL: Statique Littérateur - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - 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] ### Added #### Changeslogs diff --git a/help/last-version.md b/help/last-version.md index 38611da..09b30ae 100644 --- a/help/last-version.md +++ b/help/last-version.md @@ -1,20 +1,6 @@ # Added -## Changeslogs -- CHANGELOG.md -- last-version.md in help folder (for -v and -u arguments) - -## Arguments -- - -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 +## 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 diff --git a/usr/local/bin/stl b/usr/local/bin/stl index b683712..bc6691f 100755 --- a/usr/local/bin/stl +++ b/usr/local/bin/stl @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.2.1 +# Version: 0.2.2 # Name: Statique Littérateur # Type: Executable # file: stl diff --git a/var/lib/stl/help/CHANGELOG.md b/var/lib/stl/help/CHANGELOG.md index 6444412..0f5db88 100644 --- a/var/lib/stl/help/CHANGELOG.md +++ b/var/lib/stl/help/CHANGELOG.md @@ -6,6 +6,15 @@ STL: Statique Littérateur - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - 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] ### Added #### Changeslogs diff --git a/var/lib/stl/help/last-version.md b/var/lib/stl/help/last-version.md index 38611da..09b30ae 100644 --- a/var/lib/stl/help/last-version.md +++ b/var/lib/stl/help/last-version.md @@ -1,20 +1,6 @@ # Added -## Changeslogs -- CHANGELOG.md -- last-version.md in help folder (for -v and -u arguments) - -## Arguments -- - -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 +## 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 diff --git a/var/lib/stl/scripts/manage__domain b/var/lib/stl/scripts/manage__domain index 1c14ca5..af42b6c 100644 --- a/var/lib/stl/scripts/manage__domain +++ b/var/lib/stl/scripts/manage__domain @@ -40,17 +40,17 @@ if [[ -f "$stl_file_pwd_conf" ]];then source "$stl_file_pwd_conf" # Source config PWD file else - echo "# No domain set from this directory" + echo "# No domain set for this directory: $PWD" [[ $domain_add ]] && domain__set [[ $domain_check ]] || exit # exit if domain__get call fi -# From command line domain +# From command line domain only (check) if [[ $domain_check ]] && [[ $domain_name ]];then [[ $domain_edit ]] \ && nano "$stl_file_pwd_conf" - echo "# Domain set from this directory: $domain_name" + echo "# Domain '$domain_name' set for this directory: $PWD" exit fi } @@ -109,8 +109,8 @@ if__writeable "$PWD" else read -rp "- Use 'https://' protocol (N for 'http://') ? " set_prot case "$set_prot" in - Y) domain_protocol="https://" ;; - N) domain_protocol="http://" ;; + Y|y) domain_protocol="https://" ;; + N|n) domain_protocol="http://" ;; *) echo "# Maybe later...";exit ;; esac domain_ask+="$domain_name" @@ -120,12 +120,16 @@ if__writeable "$PWD" # ---------- # 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 ? +# ---------- 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__protocol ;; @@ -136,63 +140,97 @@ case "$domain_name" in read -rp "$domain_ask (Y|*) ? " domain_confirm case "$domain_confirm" in - Y) true ;; - *) echo "# Maybe later...";exit ;; + Y|y) true ;; + *) echo "# Maybe later...";exit ;; esac ;; esac # Where is the server ? /var/www ? +# ---------- read -erp "- Where is your server URI ? " srv_uri is__set "srv_uri" [[ "${srv_uri: -1}" == "/" ]] \ && srv_uri=${srv_uri::-1} ! [[ -d "$srv_uri" ]] \ - && echo "! Missing directory" \ + && echo "! Missing directory: $srv_uri" \ && exit if__writeable "$srv_uri" domain_srv="$srv_uri/$domain_name" + # 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 Y|y) stl_install="server" ;; N|n) stl_install="local" ;; *) echo "# Maybe later..." ;; esac + # Domain TITLE +# ---------- read -rp "- Domain Title ? " domain_title is__set "$domain_title" +[[ "$domain_title" =~ \" ]] \ + && domain_title=`sed -e 's^"^\\\\"^g' <<<"$domain_title"` + # Domain ABOUT +# ---------- read -rp "- Domain About ? " domain_about is__set "$domain_about" +[[ "$domain_about" =~ \" ]] \ + && domain_about=`sed -e 's^"^\\\\"^g' <<<"$domain_about"` + # 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" +! (( ${#domain_lang} == 2 )) \ + && echo "! Lang must be 2 characters (i.e. fr, gb, en...)" \ + && exit + # Domain MAIL +# ---------- read -rp "- Domain mail ? " domain_mail is__set "$domain_mail" +! [[ "$domain_mail" =~ @ ]] \ + && echo "! Mail must contain @..." \ + && exit + # Domain TAGS -read -rp "- Domain tags (comma separated) ? " domain_tags +# ---------- +read -rp "- Domain MAIN tags (comma separated) ? " 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" +[[ "$domain_cr" =~ \" ]] \ + && domain_cr=`sed -e 's^"^\\\\"^g' <<<"$domain_cr"` + # 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" +# 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" ! [[ $domain_sidebar_items =~ ^[0-9]+$ ]] \ && 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" \ && exit + # 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" ! [[ $domain_css =~ ^[a-zA-Z0-9_-]+$ ]] \ && echo "! '$domain_css' is not alpha numeric. '-' is authorized" \ && exit +domain_css=${domain_css,,} case "${domain_css: -1}" in "_"|"-") domain_css=${domain_css::-1} ;; esac -domain_css=${domain_css,,} # Domain LOGO -read -rp "- Domain logo filename ? " domain_logo +# ---------- +read -rp "- Domain logo filename (i.e. mylogo.png) ? " domain_logo + # 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 -read -rp "- Generate file stats (Statoolinfos) ? " domain_stats +# ---------- +read -rp "- Generate file stats for Statoolinfos (Y|N) ? " domain_stats case "$domain_stats" in Y|y) domain_stats="yes" ;; N|n) domain_stats="no" ;; *) echo "# Maybe later..." ;; esac + +# ---------- # Resume before writing conf -# ------ +# ---------- clear echo -e "# Resume configuration...\n" cat <