diff --git a/README.md b/README.md index 411fb73..9c9071d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # GSL: Statique Littérateur - ------------------------------------------------------------------------ GSL is a multiple blogs/websites generator based on their domain, @@ -16,7 +15,6 @@ can easily get, in your webserver. # GSL: Installation - ------------------------------------------------------------------------ In your System / ``` @@ -109,7 +107,6 @@ You can select a specific post, with autocompletion to check and make only that specified one. # Create a Templates - ------------------------------------------------------------------------ You will have to create some CSS (styles.css) in your /DOMAIN/templates/ @@ -117,7 +114,6 @@ You will have to create some CSS (styles.css) in your /DOMAIN/templates/ - GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/ # How to Write a Post - ------------------------------------------------------------------------ Post has 2 sections : Before and After #1. #1 is the FIRST Title of your @@ -205,7 +201,7 @@ this border**line** content # Inline-code (¤ = alt-gr + $ on FR keyboard) ¤push()¤ -# Simple Blockquote +# Simple Blockquote: Use 3 "-" --- ( A simple great quote @@ -230,4 +226,19 @@ world a worse place # For advanced blockquotes, you can also add, if known: _year: 2021 _book: Esperanza 64 + +# Create Lists +Use = to create an item. You can use infinite sub-items, but each Item +of a list MUST be on the same Line +( +Let's start a list += Item 1 is *great* +== sub-item 1 +== sub-item 2 +=== sub-sub-item 1 of sub-item 2 +== sub-item 3 += Item 2 +** sub-item 1 of Item 2 +This list is ended +) ``` diff --git a/etc/gsl/gsl.conf b/etc/gsl/gsl.conf index 5f21e6d..91b3b9c 100644 --- a/etc/gsl/gsl.conf +++ b/etc/gsl/gsl.conf @@ -132,4 +132,3 @@ gsl_d=(\, \. \? \% \# \- \: \^ \/ \_ \| ) # Post-listing gsl_list_max_posts=5 -gsl_list_lines_per_post=5 diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index c8661b8..bfd726e 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -1,33 +1,56 @@ #!/bin/bash +# file: gsl +# Folder: /usr/local/bin +# By echolib +# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 + +#======================================================================= +# Tool: Check needed file and sourcee if asked +#======================================================================= +gsl__if_file() { +if ! [[ -f "$1" ]];then + echo "! Missing file: $1" + exit 1 +fi + +case "$2" in + source) + source "$1" || exit 1 + ;; + read) + cat "$1" + ;; + post) + gsl_this_post="$1" + ;; +esac +} #======================================================================= # Checking Dependancies #======================================================================= # Get Tools -! [[ -f "/var/lib/gsl/scripts/gsl__tools" ]] \ - && echo "! Missing file: /var/lib/gsl/scripts/gsl__tools" \ - && return -source "/var/lib/gsl/scripts/gsl__tools" +gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source # Get conf -gsl__check_source "/etc/gsl/gsl.conf" || exit 1 +gsl__if_file "/etc/gsl/gsl.conf" source # Get Logs Manager -gsl__check_source "$gsl_dir_scripts/gsl__log_manager" || exit 1 +gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source # Check/Create Files and Folders gsl__create_ff gsl__find_domain -gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1 +gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source gsl__authors_list check || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__new_website" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__post_checkers" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__post_manager" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__post_makers" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__page_creator" || exit 1 -gsl__check_source "$gsl_dir_scripts/gsl__do_commons" || exit 1 +gsl__if_file "$gsl_dir_scripts/gsl__new_website" source +gsl__if_file "$gsl_dir_scripts/gsl__post_checkers" source +gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source +gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source +gsl__if_file "$gsl_dir_scripts/gsl__post_makers" source +gsl__if_file "$gsl_dir_scripts/gsl__page_creator" source +gsl__if_file "$gsl_dir_scripts/gsl__do_commons" source #======================================================================= # Main @@ -106,25 +129,25 @@ case "$1" in while test "$2" do - case "$2" in - clean|-C) - gsl_date_logs=`date +%F-%H-%M-%S` - mv "$gsl_file_logs" "$gsl_dir_logs/$gsl_date_logs.gsl.log" - rm -f "$gsl_file_logs" - printf '%s %s %s\n' \ - "# Logs saved to" \ - "$gsl_dir_logs/$gsl_date_logs.gsl.log" \ - "and cleaned" - exit - ;; - - -s) gsl_logs_last_session=true ;; - -e) gsl_logs_err=true ;; - -i) gsl_logs_inf=true ;; - -w) gsl_logs_war=true ;; - *) gsl_logs_search="$2" ;; - esac - shift + case "$2" in + clean|-C) + gsl_date_logs=`date +%F-%H-%M-%S` + mv "$gsl_file_logs" "$gsl_dir_logs/$gsl_date_logs.gsl.log" + rm -f "$gsl_file_logs" + printf '%s %s %s\n' \ + "# Logs saved to" \ + "$gsl_dir_logs/$gsl_date_logs.gsl.log" \ + "and cleaned" + exit + ;; + + -s) gsl_logs_last_session=true ;; + -e) gsl_logs_err=true ;; + -i) gsl_logs_inf=true ;; + -w) gsl_logs_war=true ;; + *) gsl_logs_search="$2" ;; + esac + shift done gsl__logs_show @@ -132,17 +155,14 @@ case "$1" in check|-C) gsl__check_nbr_posts + gsl_process="chk" case "$2" in -F) gsl_force_check=true - if [[ "$3" ]];then - gsl__check_opt_post "$3" - fi + [[ "$3" ]] && gsl__if_file "$3" post ;; *) - if [[ "$2" ]];then - gsl__check_opt_post "$2" - fi + [[ "$2" ]] && gsl__if_file "$2" post ;; esac @@ -165,17 +185,15 @@ case "$1" in make|-M) gsl__check_nbr_posts + gsl_process="wip" + gsl_post_list="Add" case "$2" in -F) gsl_force_make=true - if [[ "$3" ]];then - gsl__check_opt_post "$3" - fi + [[ "$3" ]] && gsl__if_file "$3" post ;; *) - if [[ "$2" ]];then - gsl__check_opt_post "$2" - fi + [[ "$2" ]] && gsl__if_file "$2" post ;; esac @@ -197,11 +215,24 @@ case "$1" in ;; post-list) - if [[ "$2" ]];then - gsl__check_opt_post "$2" + case "$2" in + add) + gsl_post_list="Add" + ;; + pin) + gsl_post_list="Pin" + ;; + *) + echo "! Bad Argument: $2" + exit 1 + ;; + esac + + if [[ "$3" ]];then + gsl__if_file "$3" post else echo "! Select a Post to add to list" - exit + exit 1 fi gsl__check_nbr_posts @@ -209,7 +240,7 @@ case "$1" in "$gsl_log_i" \ "Starting" \ "Process" \ - "Post-List ; Add $2 from domain $gsl_find_domain" \ + "Post-List ; $gsl_post_list $3 from domain $gsl_find_domain" \ "$gsl_dir_domain_tpl/last-posts-list.html" gsl__loop_posts post-list @@ -218,35 +249,29 @@ case "$1" in "$gsl_log_i" \ "Stopping" \ "Process" \ - "Post-List ; Add $2 from domain $gsl_find_domain" \ + "Post-List ; $gsl_post_list $3 from domain $gsl_find_domain" \ "$gsl_dir_domain_tpl/last-posts-list.html" ;; readme) - gsl__if_file "/var/lib/gsl/README.md" clear - cat /var/lib/gsl/README.md + gsl__if_file "/var/lib/gsl/README.md" read ;; help|--help|-h) - gsl__if_file "$gsl_dir_helps/gsl_help" - clear case "$2" in "") - cat "$gsl_dir_helps/gsl_help" + gsl__if_file "$gsl_dir_helps/gsl_help" read ;; new) - gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" - cat "$gsl_dir_helps/gsl_infos_new_website" + gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" read ;; install) - gsl__if_file "$gsl_dir_helps/gsl_help_install" - cat "$gsl_dir_helps/gsl_help_install" + gsl__if_file "$gsl_dir_helps/gsl_help_install" read ;; write|-w) - gsl__if_file "$gsl_dir_helps/gsl_help_write_post" - cat "$gsl_dir_helps/gsl_help_write_post" + gsl__if_file "$gsl_dir_helps/gsl_help_write_post" read ;; esac ;; diff --git a/var/lib/gsl/README.md b/var/lib/gsl/README.md index cc50c45..9c9071d 100644 --- a/var/lib/gsl/README.md +++ b/var/lib/gsl/README.md @@ -201,7 +201,7 @@ this border**line** content # Inline-code (¤ = alt-gr + $ on FR keyboard) ¤push()¤ -# Simple Blockquote +# Simple Blockquote: Use 3 "-" --- ( A simple great quote @@ -226,4 +226,19 @@ world a worse place # For advanced blockquotes, you can also add, if known: _year: 2021 _book: Esperanza 64 + +# Create Lists +Use = to create an item. You can use infinite sub-items, but each Item +of a list MUST be on the same Line +( +Let's start a list += Item 1 is *great* +== sub-item 1 +== sub-item 2 +=== sub-sub-item 1 of sub-item 2 +== sub-item 3 += Item 2 +** sub-item 1 of Item 2 +This list is ended +) ``` diff --git a/var/lib/gsl/helps/gsl_help b/var/lib/gsl/helps/gsl_help index e4ce497..0e3c63a 100644 --- a/var/lib/gsl/helps/gsl_help +++ b/var/lib/gsl/helps/gsl_help @@ -26,6 +26,8 @@ $ gsl [ARG] make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE] to HTML file in server - post-list [FILE] : Add back post from [FILE] to Last-Posts List - (When converting new post, it will be added) + post-list [OPT] [FILE] : Add post again from [FILE] to Last-Posts List + (When converting new post, it will be added) + Pin : Set Post from [FILE] to first in Last-Posts List + Add : Add Post from [FILE] to last in Last-Posts List diff --git a/var/lib/gsl/helps/gsl_help_write_post b/var/lib/gsl/helps/gsl_help_write_post index df42949..7aae76d 100644 --- a/var/lib/gsl/helps/gsl_help_write_post +++ b/var/lib/gsl/helps/gsl_help_write_post @@ -86,7 +86,7 @@ this border**line** content # Inline-code (¤ = alt-gr + $ on FR keyboard) ¤push()¤ -# Simple Blockquote +# Simple Blockquote: Use 3 "-" --- ( A simple great quote @@ -111,4 +111,19 @@ world a worse place # For advanced blockquotes, you can also add, if known: _year: 2021 _book: Esperanza 64 + +# Create Lists +Use = to create an item. You can use infinite sub-items, but each Item +of a list MUST be on the same Line +( +Let's start a list += Item 1 is *great* +== sub-item 1 +== sub-item 2 +=== sub-sub-item 1 of sub-item 2 +== sub-item 3 += Item 2 +** sub-item 1 of Item 2 +This list is ended +) ``` diff --git a/var/lib/gsl/scripts/gsl__db_manager b/var/lib/gsl/scripts/gsl__db_manager index d1b098a..7e0d376 100644 --- a/var/lib/gsl/scripts/gsl__db_manager +++ b/var/lib/gsl/scripts/gsl__db_manager @@ -26,14 +26,20 @@ if [[ -f "$gsl_file_db_post" ]];then else -gsl__logs_print \ - "$gsl_log_w" \ - "DB" \ - "Post" \ - "$gsl_post missing. Check it first" \ - "$gsl_file_db_post" - gsl_checker_war=true - +case "$gsl_process" in + chk) + true + ;; + *) + gsl__logs_print \ + "$gsl_log_w" \ + "DB" \ + "Post" \ + "Missing from $gsl_post. Check it first" \ + "$gsl_file_db_post" + gsl_checker_war=true + ;; +esac fi } @@ -43,21 +49,37 @@ fi gsl__db_compare_post_hash() { gsl_checker_war=true -if ! (( $gsl_post_hash == $gsl_db_post_hash ));then - gsl__logs_print \ - "$gsl_log_w" \ - "Post" \ - "Hash" \ - "$gsl_post Changed ($gsl_post_hash)" \ - "${PWD}/$gsl_post" - gsl_post_new_hash=true -else +if (( $gsl_post_hash == $gsl_db_post_hash ));then + gsl__logs_print \ "$gsl_log_w" \ "Post" \ "Hash" \ "$gsl_post checked with hash:$gsl_db_post_hash " \ "${PWD}/$gsl_post" + +else + + gsl_post_new_hash=true + case "$gsl_db_post_hash" in + 0) + gsl__logs_print \ + "$gsl_log_w" \ + "Post" \ + "New" \ + "$gsl_post not yet checked" \ + "${PWD}/$gsl_post" + ;; + *) + gsl__logs_print \ + "$gsl_log_w" \ + "Post" \ + "Hash" \ + "$gsl_post Changed ($gsl_post_hash)" \ + "${PWD}/$gsl_post" + ;; + esac + fi } diff --git a/var/lib/gsl/scripts/gsl__page_creator b/var/lib/gsl/scripts/gsl__page_creator index f6098bf..f64f8fe 100644 --- a/var/lib/gsl/scripts/gsl__page_creator +++ b/var/lib/gsl/scripts/gsl__page_creator @@ -44,9 +44,6 @@ done gsl__page_prepare_datas() { #echo "D> $gsl_this_conf_domain" -# Source config website (DATAS) -source "$gsl_this_conf_domain/$gsl_find_domain.conf" - # Check for Files & Folders in server gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip" @@ -86,41 +83,55 @@ fi #====================================================================== gsl__page_create_listing() { # Check if Post is in list ; Status Made -case "$1" in - selected) - true - ;; +gsl_checker_war=true +gsl_listing_file="$gsl_dir_domain_listings/$gsl_post.list" - *) - case "$gsl_db_post_status" in - wip|www) - gsl__logs_print \ - "$gsl_log_i" \ - "Post" \ - "Make" \ - "$gsl_post already added to Latest listings" \ - "$gsl_file_db_posts" - return - ;; - esac +if [[ `ls -1 "$gsl_listing_file"* 2>/dev/null` ]];then + gsl__logs_print \ + "$gsl_log_w" \ + "Post" \ + "List" \ + "$gsl_post_list $gsl_post already added to Latests" \ + "$gsl_dir_domain_listings/" + return +fi + +case "$gsl_post_list" in + Pin) + gsl__page_create_listing_file "$gsl_listing_file.1" + ;; + Add) + # search for last listing number + gsl_listing_last=` + ls -1 *"$gsl_dir_domain_listings/"*".list."* \ + | tail -1 2>/dev/null` + + # Get Last listing number + ! [[ $gsl_listing_last ]] \ + && gsl_listing_last_n=0 \ + || gsl_listing_last_n=${gsl_listing_last: -1} + + # Set last listing number for this post + (( $gsl_listing_last_n <= $(( gsl_list_max_posts - 1)) )) \ + && gsl_listing_last_n=$(( $gsl_listing_last_n + 1 )) + + gsl__page_create_listing_file \ + "$gsl_listing_file.$gsl_listing_last_n" ;; esac -touch "$gsl_dir_domain_tpl/last-posts-list.html" +cat "$gsl_dir_domain_listings/"*.list.* \ + > "$gsl_dir_domain_tpl/last-posts-list.html" \ + && gsl__logs_print \ + "$gsl_log_w" \ + "Post" \ + "List" \ + "Create Latest Listing (Merged .list.*)"\ + "$gsl_dir_domain_tpl/last-post-list.html" +} -gsl_list_max_lines=$(( gsl_list_max_posts * gsl_list_lines_per_post)) -gsl_list_cur_lines=` -cat "$gsl_dir_domain_tpl/last-posts-list.html" \ - | wc -l` - -if (( $((gsl_list_cur_lines )) >= $gsl_list_max_lines ));then - for i in `seq 1 $gsl_list_lines_per_post` - do - sed -i "1d" "$gsl_dir_domain_tpl/last-posts-list.html" - done -fi - -cat << EOPostSide >> "$gsl_dir_domain_tpl/last-posts-list.html" +gsl__page_create_listing_file() { +cat << EOPostSide > "$1"
  • $gsl_header_title
    Le $gsl_header_date par $gsl_header_author
    @@ -131,10 +142,9 @@ EOPostSide gsl__logs_print \ "$gsl_log_w" \ "Post" \ - "Make" \ - "$gsl_post added to Latest listings" \ - "$gsl_dir_domain_tpl/last-posts-list.html" -gsl_checker_war=true + "List" \ + "$gsl_post_list $gsl_post to Latests"\ + "$1" } #---------------------------------------------------------------------- diff --git a/var/lib/gsl/scripts/gsl__post_makers b/var/lib/gsl/scripts/gsl__post_makers index 42cdcac..51f9296 100644 --- a/var/lib/gsl/scripts/gsl__post_makers +++ b/var/lib/gsl/scripts/gsl__post_makers @@ -29,6 +29,7 @@ gsl__do_italics "make" "$gsl_tmp_post" # First gsl__do_header "make" "$gsl_marker_link" "$gsl_post" gsl__do_header "make" "$gsl_marker_abbr" "$gsl_post" gsl__do_strongs_bolds "make" "$gsl_tmp_post" +gsl__make_list gsl__do_icode "make" "$gsl_tmp_post" gsl__make_titles gsl_ct=0 && gsl__make_titles_div_open @@ -77,6 +78,135 @@ awk -v s="$1" \ # Converters # --------------------------------- #======================================================================= + +#---------------------------------------------------------------------- +#====================================================================== +# Convert List.Get first/last line item / repeat till no more mark +#====================================================================== +gsl__make_list() { +! [[ `awk -v m="$gsl_mark_list" \ + '$1 == m {print $1;exit}' \ + "$gsl_tmp_post"` ]] \ + && return + +gsl_last_line=`cat $gsl_tmp_post | wc -l` + +# Get block lists by line numbers From Content +while read -r "gsl_line" "gsl_content" +do + case "$gsl_content" in + "$gsl_mark_list"*) + ! [[ $gsl_list ]] \ + && gsl_list=true \ + && gsl_list_o=$gsl_line \ + && continue + + [[ $gsl_list ]] && (( $gsl_line == $gsl_last_line )) \ + && gsl_list_c=$gsl_line \ + && gsl__make_list_get_block \ + && break + ;; + + ""|*) + [[ "$gsl_list" ]] \ + && gsl_list_c=$(( gsl_line - 1 )) \ + && unset gsl_list \ + && gsl__make_list_get_block \ + && break + ;; + esac +done < <(cat -n "$gsl_tmp_post") +} + +#====================================================================== +# Convert List. tmp file block list. replace mark with number +#====================================================================== +gsl__make_list_get_block() { +echo -ne "\r\033[2K: Converting Block-List... $gsl_list_o > $gsl_list_c" + +# Create tmp file with this block-list and marks converted +gsl_file_block_list=`mktemp` +while read -r "mark" "content" +do + echo "${#mark} $content" >> "$gsl_file_block_list" +done < <(awk -v o="$gsl_list_o" -v c="$gsl_list_c" \ + 'NR >= o && NR <= c' \ + "$gsl_tmp_post") + +gsl__make_list_convert + +# No more needed +unset gsl_list_o gsl_list_c +rm -f "$gsl_file_block_list" +} + +#====================================================================== +# Convert List. tmp HTML file. +#====================================================================== +gsl__make_list_convert() { + + # Get previeous line mark number + gsl__make_list_get_prev_mark() { + pm=` + awk -v pm="$(( $ln - 1))" \ + 'NR == pm {print $1}' \ + "$gsl_file_block_list"` + + ! [[ $pm ]] && pm=0 + } + +# Create tmp file with HTML block-list +gsl_HTML_list=`mktemp` + +#ln: line number ; mn: mark number +while read -r "ln" "mn" "content" +do + + gsl__make_list_get_prev_mark + gsl_diff_pm_mn=$(( mn - pm )) + + if (( $gsl_diff_pm_mn == 0 ));then + printf "%s%s\n" \ + "" \ + "
  • $content
  • " \ + >> "$gsl_HTML_list" + elif (( $gsl_diff_pm_mn > 0 ));then + printf "%s%s\n" \ + "" \ + "%.s\n' {1..eval $n} \ + >> "$gsl_HTML_list" + printf "%s%s\n" \ + "" \ + "
  • $content
  • " \ + >> "$gsl_HTML_list" + + fi +done < <(cat -n "$gsl_file_block_list") +echo "" >> "$gsl_HTML_list" + +# Remove useless list in tmp_post +gsl_list_rm_tl=$(( $gsl_list_c - $gsl_list_o )) +for rml in `seq 0 $gsl_list_rm_tl` +do + sed -i "${gsl_list_o}d" "$gsl_tmp_post" +done + +# Insert new HTML file list in tmp_post +gsl_list_line_i=$(( gsl_list_o - 1)) +sed -i "${gsl_list_line_i}r $gsl_HTML_list" "$gsl_tmp_post" + +rm -f "$gsl_HTML_list" # No more needed HTML tmp file list +gsl__make_list +} +#---------------------------------------------------------------------- + #====================================================================== # Replace gsl_mark_fcode #====================================================================== diff --git a/var/lib/gsl/scripts/gsl__post_manager b/var/lib/gsl/scripts/gsl__post_manager index 7779d94..8bcb2da 100644 --- a/var/lib/gsl/scripts/gsl__post_manager +++ b/var/lib/gsl/scripts/gsl__post_manager @@ -46,7 +46,6 @@ do # From COMMAND [OPT] case "$1" in check) - gsl_process="chk" if ! [[ "$gsl_force_check" ]];then ! [[ "$gsl_post_new_hash" ]] && continue fi @@ -61,7 +60,6 @@ do ;; make) - gsl_process="wip" gsl__post_begin gsl__get_needed_headers gsl__page_prepare_datas @@ -73,11 +71,6 @@ do ;; wip) - # Should not be used... - [[ "$gsl_force_make" ]] \ - && gsl__all_makers \ - && continue - if [[ "$gsl_post_new_hash" ]];then rm -f "$gsl_srv_wip_page" && \ gsl__logs_print \ @@ -94,6 +87,11 @@ do "file ; changes in $gsl_post" \ "$gsl_file_db_post" else + # Should not be used... + [[ "$gsl_force_make" ]] \ + && gsl__all_makers \ + && continue + gsl__logs_print \ "$gsl_log_w" \ "Post" \ @@ -106,7 +104,7 @@ do ;; esac ;; - + post-list) case "$gsl_db_post_status" in wip|online) @@ -114,7 +112,7 @@ do gsl__post_begin gsl__get_needed_headers gsl__page_prepare_datas - gsl__page_create_listing selected + gsl__page_create_listing ;; *) gsl__logs_print \ @@ -183,7 +181,7 @@ awk -v l="$gsl_post_begin" \ gsl__post_begin() { gsl_post_begin=` -grep -n "#1" $gsl_post \ - | head -1 \ - | awk -F: '{print $1}'` +awk -v m="#1" \ + '$1 == m {print NR;exit}' \ + "$gsl_post"` } diff --git a/var/lib/gsl/scripts/gsl__tools b/var/lib/gsl/scripts/gsl__tools index 9027ffe..e260a5c 100644 --- a/var/lib/gsl/scripts/gsl__tools +++ b/var/lib/gsl/scripts/gsl__tools @@ -4,28 +4,6 @@ # By echolib # License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 -#======================================================================= -# Tool: Source if found -#======================================================================= -gsl__check_source() { -if [[ -f "$1" ]];then - source "$1" -else - echo "! Missing file: $1" - exit 1 -fi -} - -#======================================================================= -# Tool: Check needed file -#======================================================================= -gsl__if_file() { -if ! [[ -f "$1" ]];then - echo "! Missing $1" - exit 1 -fi -} - #======================================================================= # Check Needed Folders, and create needed files #======================================================================= @@ -45,7 +23,7 @@ done for gsl_file in "$gsl_file_logs" \ "$gsl_file_db_domains" do - gsl__if_file "$gsl_file" && touch "$gsl_file" + ! [[ -f "$gsl_file" ]] && touch "$gsl_file" done } @@ -106,6 +84,8 @@ do "$gsl_new_dir" fi done + +gsl__if_file "$gsl_this_conf_domain/$gsl_find_domain.conf" source } #----------------------------------------------------------------------- @@ -124,7 +104,7 @@ gsl_post_size=`awk '{print $2}' <<< "$gsl_post_sum"` } #======================================================================= -# Get line nbr from Post... $1: TERM | $2: File +# Get line nbr from TERM in FIle... $1: TERM | $2: File #======================================================================= gsl__get_line() { awk -v s="$1" \