2022-02-13 17:58:25 +01:00
|
|
|
#!/bin/bash
|
2022-04-14 17:00:54 +02:00
|
|
|
# Version: 0.0.23
|
2022-03-08 17:53:40 +01:00
|
|
|
# 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
|
|
|
|
#=======================================================================
|
2022-03-27 18:46:48 +02:00
|
|
|
if__command() {
|
|
|
|
! [[ `command -v $1` ]] \
|
|
|
|
&& echo -e "$I_Red Missing $1 command" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-03-27 18:46:48 +02:00
|
|
|
}
|
|
|
|
|
2022-03-08 17:53:40 +01:00
|
|
|
gsl__if_file() {
|
|
|
|
if ! [[ -f "$1" ]];then
|
|
|
|
echo "! Missing file: $1"
|
2022-04-11 18:06:38 +02:00
|
|
|
exit
|
2022-03-08 17:53:40 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
case "$2" in
|
|
|
|
source)
|
2022-04-11 18:06:38 +02:00
|
|
|
source "$1" || exit
|
2022-03-08 17:53:40 +01:00
|
|
|
;;
|
|
|
|
read)
|
|
|
|
cat "$1"
|
|
|
|
;;
|
|
|
|
post)
|
|
|
|
gsl_this_post="$1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-03-13 16:20:44 +01:00
|
|
|
# Get conf
|
|
|
|
gsl__if_file "/etc/gsl/gsl.conf" source
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source
|
2022-04-06 18:28:48 +02:00
|
|
|
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
|
2022-03-27 18:46:48 +02:00
|
|
|
|
2022-03-13 16:20:44 +01:00
|
|
|
case "$1" in
|
|
|
|
help|--help|-h)
|
|
|
|
clear
|
|
|
|
case "$2" in
|
|
|
|
"")
|
|
|
|
gsl__if_file "$gsl_dir_helps/gsl_help" read
|
|
|
|
;;
|
|
|
|
new)
|
|
|
|
gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" read
|
|
|
|
;;
|
|
|
|
install)
|
|
|
|
gsl__if_file "$gsl_dir_helps/gsl_help_install" read
|
|
|
|
;;
|
|
|
|
write|-w)
|
|
|
|
gsl__if_file "$gsl_dir_helps/gsl_help_write_post" read
|
|
|
|
;;
|
|
|
|
esac
|
2022-03-21 12:12:37 +01:00
|
|
|
exit
|
2022-03-13 16:20:44 +01:00
|
|
|
;;
|
2022-04-06 18:28:48 +02:00
|
|
|
|
|
|
|
new|-N)
|
|
|
|
gsl__if_file "$gsl_dir_scripts/gsl__new_website" source
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"New Website" \
|
|
|
|
"$gsl_dir_scripts/gsl__new_website"
|
|
|
|
|
|
|
|
gsl__new_website
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"New Website" \
|
|
|
|
"$gsl_dir_scripts/gsl__new_website"
|
|
|
|
|
|
|
|
[[ -f "$gsl_file_db_domains" ]] && \
|
|
|
|
[[ -d "$gsl_dir_user_posts" ]] \
|
|
|
|
&& cd "$gsl_dir_user_posts" \
|
|
|
|
&& gsl author add
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
echo
|
|
|
|
gsl log -s -w
|
2022-04-06 18:28:48 +02:00
|
|
|
exit
|
|
|
|
;;
|
|
|
|
|
|
|
|
author|-A)
|
|
|
|
gsl__find_domain
|
|
|
|
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
|
|
|
|
case "$2" in
|
|
|
|
"")
|
|
|
|
gsl__authors_list
|
|
|
|
;;
|
|
|
|
add)
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"author $2 for domain $gsl_find_domain" \
|
|
|
|
"$gsl_file_auth_ndd"
|
|
|
|
|
|
|
|
gsl__authors_add
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"author $2 for domain $gsl_find_domain" \
|
|
|
|
"$gsl_file_auth_ndd"
|
|
|
|
;;
|
|
|
|
remove)
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"author $2 for domain $gsl_find_domain" \
|
|
|
|
"$gsl_file_auth_ndd"
|
|
|
|
|
|
|
|
gsl__authors_remove
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"author $2 for domain $gsl_find_domain" \
|
|
|
|
"$gsl_file_auth_ndd"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
exit
|
|
|
|
;;
|
2022-03-27 18:46:48 +02:00
|
|
|
|
|
|
|
readme)
|
|
|
|
clear
|
|
|
|
gsl__if_file "/var/lib/gsl/README.md" read
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
|
|
|
|
log|-L)
|
|
|
|
[[ -z `grep '[^[:space:]]' "$gsl_file_logs" 2>/dev/null` ]] \
|
|
|
|
&& echo "# No logs to show. File is empty." \
|
|
|
|
&& exit
|
|
|
|
|
|
|
|
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
|
|
|
|
done
|
|
|
|
|
|
|
|
gsl__logs_show
|
2022-04-11 18:45:33 +02:00
|
|
|
exit 0
|
2022-03-27 18:46:48 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
version|-v)
|
|
|
|
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/$app_name"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
|
|
|
|
-vv)
|
|
|
|
v_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/$app_name"`
|
|
|
|
echo -n "# $app_name Current: $v_cur | "
|
|
|
|
if__command curl
|
|
|
|
v_onl=`curl -s "$repo" | awk 'NR==2 {print $3}'`
|
|
|
|
echo -ne "Online: $v_onl\n"
|
|
|
|
exit
|
|
|
|
;;
|
2022-03-13 16:20:44 +01:00
|
|
|
esac
|
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
#=======================================================================
|
|
|
|
# Checking Dependancies
|
|
|
|
#=======================================================================
|
|
|
|
# Check/Create Files and Folders
|
|
|
|
gsl__create_ff
|
|
|
|
|
2022-02-27 19:16:16 +01:00
|
|
|
gsl__find_domain
|
2022-04-06 18:37:23 +02:00
|
|
|
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
|
2022-04-11 18:06:38 +02:00
|
|
|
gsl__authors_list check || exit
|
2022-03-08 17:53:40 +01:00
|
|
|
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
|
2022-02-27 19:16:16 +01:00
|
|
|
|
2022-02-13 17:58:25 +01:00
|
|
|
#=======================================================================
|
|
|
|
# Main
|
|
|
|
#=======================================================================
|
|
|
|
case "$1" in
|
2022-03-27 18:46:48 +02:00
|
|
|
edit|-E)
|
|
|
|
! [[ "$2" ]] \
|
|
|
|
&& echo "! Missing argument: post [FILE]" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-03-27 18:46:48 +02:00
|
|
|
|
|
|
|
gsl__if_file "$2" post
|
2022-04-08 17:52:27 +02:00
|
|
|
if ! [[ "$EDITOR" ]];then
|
2022-03-27 18:46:48 +02:00
|
|
|
if__command nano
|
|
|
|
EDITOR=`which nano`
|
|
|
|
fi
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"edit $gsl_this_post with $EDITOR" \
|
|
|
|
"$PWD/$gsl_this_post"
|
|
|
|
|
|
|
|
gsl__get_sum "$PWD/$gsl_this_post"
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Post" \
|
|
|
|
"edit" \
|
|
|
|
"$gsl_this_post > Hash: $gsl_post_hash | Size: $gsl_post_size" \
|
|
|
|
"$PWD/$gsl_this_post"
|
|
|
|
|
|
|
|
gsl_post_hash_old=$gsl_post_hash
|
|
|
|
$EDITOR $PWD/$gsl_this_post
|
2022-04-08 17:52:27 +02:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__get_sum "$PWD/$gsl_this_post"
|
|
|
|
if (( $gsl_post_hash != $gsl_post_hash_old ));then
|
|
|
|
gsl_log_infos="NEW > Hash: $gsl_post_hash | Size: $gsl_post_size"
|
|
|
|
gsl_log_level="$gsl_log_w"
|
|
|
|
else
|
|
|
|
gsl_log_infos="Unchanged"
|
|
|
|
gsl_log_level="$gsl_log_i"
|
|
|
|
fi
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_level" \
|
|
|
|
"Post" \
|
|
|
|
"edit" \
|
|
|
|
"$gsl_this_post > $gsl_log_infos" \
|
|
|
|
"$PWD/$gsl_this_post"
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"edit $gsl_this_post with $EDITOR" \
|
|
|
|
"$PWD/$gsl_this_post"
|
|
|
|
;;
|
2022-03-08 17:53:40 +01:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
db)
|
|
|
|
! [[ "$2" ]] \
|
|
|
|
&& echo "! Missing argument: post [FILE]" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-02-13 17:58:25 +01:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__if_file "$2" post
|
|
|
|
[[ -f "$gsl_dir_db/$gsl_this_post.db" ]] \
|
|
|
|
&& cat -n "$gsl_dir_db/$gsl_this_post.db" \
|
|
|
|
|| echo "! No DB yet for $gsl_this_post. Check it first."
|
|
|
|
exit
|
2022-02-14 00:23:33 +01:00
|
|
|
;;
|
2022-02-19 18:17:09 +01:00
|
|
|
|
2022-02-14 00:23:33 +01:00
|
|
|
check|-C)
|
|
|
|
case "$2" in
|
2022-02-16 16:57:20 +01:00
|
|
|
-F)
|
|
|
|
gsl_force_check=true
|
2022-03-08 17:53:40 +01:00
|
|
|
[[ "$3" ]] && gsl__if_file "$3" post
|
2022-02-16 16:57:20 +01:00
|
|
|
;;
|
|
|
|
*)
|
2022-03-08 17:53:40 +01:00
|
|
|
[[ "$2" ]] && gsl__if_file "$2" post
|
2022-02-16 16:57:20 +01:00
|
|
|
;;
|
2022-02-14 00:23:33 +01:00
|
|
|
esac
|
2022-02-19 18:17:09 +01:00
|
|
|
|
2022-02-14 00:23:33 +01:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"check Post for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
2022-02-19 18:17:09 +01:00
|
|
|
|
|
|
|
gsl__loop_posts check
|
|
|
|
|
2022-02-14 00:23:33 +01:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
2022-02-19 18:17:09 +01:00
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"check Post for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
|
|
|
;;
|
|
|
|
|
|
|
|
sync|-s)
|
|
|
|
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
|
|
|
gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www"
|
2022-04-13 12:24:39 +02:00
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"Sync Templates for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
case "$2" in
|
|
|
|
"")
|
|
|
|
gsl__srv_sync "$gsl_srv_wip"
|
|
|
|
gsl__srv_sync "$gsl_srv_www"
|
|
|
|
;;
|
|
|
|
www)
|
|
|
|
gsl__srv_sync "$gsl_srv_www"
|
|
|
|
;;
|
|
|
|
wip)
|
|
|
|
gsl__srv_sync "$gsl_srv_wip"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "! Bad Argument: $2 ? OPT=www/wip/''"
|
2022-04-13 12:24:39 +02:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Sync" \
|
|
|
|
"Argument" \
|
|
|
|
"Invalid $2" \
|
|
|
|
"$PWD"
|
2022-03-27 18:46:48 +02:00
|
|
|
;;
|
|
|
|
esac
|
2022-04-13 12:24:39 +02:00
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"Sync Templates for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
2022-02-19 18:17:09 +01:00
|
|
|
;;
|
|
|
|
|
|
|
|
make|-M)
|
2022-03-08 17:53:40 +01:00
|
|
|
gsl_process="wip"
|
|
|
|
gsl_post_list="Add"
|
2022-03-02 17:25:23 +01:00
|
|
|
case "$2" in
|
|
|
|
-F)
|
|
|
|
gsl_force_make=true
|
2022-03-08 17:53:40 +01:00
|
|
|
[[ "$3" ]] && gsl__if_file "$3" post
|
2022-03-02 17:25:23 +01:00
|
|
|
;;
|
|
|
|
*)
|
2022-03-08 17:53:40 +01:00
|
|
|
[[ "$2" ]] && gsl__if_file "$2" post
|
2022-03-02 17:25:23 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-02-19 18:17:09 +01:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"make Post for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
2022-02-19 18:17:09 +01:00
|
|
|
|
2022-04-13 12:24:39 +02:00
|
|
|
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
|
|
|
gsl__srv_sync "$gsl_srv_wip"
|
2022-02-19 18:17:09 +01:00
|
|
|
gsl__loop_posts make
|
|
|
|
|
2022-02-14 00:23:33 +01:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"make Post for domain $gsl_find_domain" \
|
|
|
|
"$PWD"
|
2022-02-14 00:23:33 +01:00
|
|
|
;;
|
2022-02-19 18:17:09 +01:00
|
|
|
|
2022-03-06 15:57:20 +01:00
|
|
|
post-list)
|
2022-03-08 17:53:40 +01:00
|
|
|
case "$2" in
|
|
|
|
add)
|
|
|
|
gsl_post_list="Add"
|
|
|
|
;;
|
|
|
|
pin)
|
|
|
|
gsl_post_list="Pin"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "! Bad Argument: $2"
|
2022-04-11 18:06:38 +02:00
|
|
|
exit
|
2022-03-08 17:53:40 +01:00
|
|
|
;;
|
|
|
|
esac
|
2022-03-27 18:46:48 +02:00
|
|
|
|
|
|
|
! [[ "$3" ]] \
|
|
|
|
&& echo "! Missing argument: post [FILE]" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-03-08 17:53:40 +01:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__if_file "$3" post
|
2022-03-06 15:57:20 +01:00
|
|
|
|
|
|
|
gsl__check_nbr_posts
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"$1 ; $gsl_post_list $3 from domain $gsl_find_domain" \
|
2022-03-06 15:57:20 +01:00
|
|
|
"$gsl_dir_domain_tpl/last-posts-list.html"
|
|
|
|
|
|
|
|
gsl__loop_posts post-list
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
2022-03-27 18:46:48 +02:00
|
|
|
"$1 ; $gsl_post_list $3 from domain $gsl_find_domain" \
|
2022-03-06 15:57:20 +01:00
|
|
|
"$gsl_dir_domain_tpl/last-posts-list.html"
|
|
|
|
;;
|
|
|
|
|
2022-04-14 14:14:42 +02:00
|
|
|
list|-l)
|
|
|
|
case "$2" in
|
|
|
|
add|-A) gsl_listing_process="add" ;;
|
|
|
|
remove|-R) gsl_listing_process="remove" ;;
|
2022-04-14 15:49:49 +02:00
|
|
|
""*) echo "! Bad argument: $2 ? OPT=add|-A/remove|-R";exit ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$3" in
|
|
|
|
0*)
|
|
|
|
echo "! Are you serious ?"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
$(( $3 <= $gsl_list_max_posts)))
|
|
|
|
echo "> $3 is OK"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "! Mysterious number"
|
|
|
|
exit
|
|
|
|
;;
|
2022-04-14 14:14:42 +02:00
|
|
|
esac
|
|
|
|
|
2022-04-14 15:49:49 +02:00
|
|
|
! [[ "$4" ]] \
|
|
|
|
&& echo "! Set post [FILE]" \
|
|
|
|
&& exit
|
|
|
|
|
|
|
|
gsl__if_file "$4" post
|
|
|
|
|
2022-04-14 14:14:42 +02:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"$1 ; $2 ; $3 from domain $gsl_find_domain" \
|
|
|
|
"$gsl_dir_domain_tpl/last-posts-list.html"
|
|
|
|
|
|
|
|
gsl__loop_posts listing
|
|
|
|
|
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"$1 ; $2 ; $3 from domain $gsl_find_domain" \
|
|
|
|
"$gsl_dir_domain_tpl/last-posts-list.html"
|
|
|
|
;;
|
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
www)
|
|
|
|
! [[ "$2" ]] \
|
|
|
|
&& echo "! Missing argument: OPT=add/remove" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-03-27 18:46:48 +02:00
|
|
|
|
|
|
|
if__command rsync
|
|
|
|
gsl_www_act="$2"
|
|
|
|
case "$2" in
|
|
|
|
add)
|
2022-03-27 19:19:26 +02:00
|
|
|
gsl_ask="! Put online ALL wip posts (yes|N)? "
|
2022-03-27 18:46:48 +02:00
|
|
|
;;
|
|
|
|
remove)
|
|
|
|
gsl_ask="! REMOVE ALL www posts (yes|N)? "
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "! Bad argument: $2 ? OPT=add/remove"
|
2022-04-11 18:06:38 +02:00
|
|
|
exit
|
2022-03-27 18:46:48 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
! [[ "$3" ]] \
|
|
|
|
&& echo "! Missing argument: post [FILE]/all" \
|
2022-04-11 18:06:38 +02:00
|
|
|
&& exit
|
2022-03-27 18:46:48 +02:00
|
|
|
|
|
|
|
case "$3" in
|
|
|
|
all)
|
|
|
|
read -rp "$gsl_ask" gsl_ask_www
|
|
|
|
case "$gsl_ask_www" in
|
|
|
|
YES|yes|Yes)
|
|
|
|
true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "# Abandon"
|
2022-04-11 18:06:38 +02:00
|
|
|
exit
|
2022-03-27 18:46:48 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
=)
|
|
|
|
gsl__if_file "$3" post
|
|
|
|
;;
|
|
|
|
esac
|
2022-04-14 14:14:42 +02:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Starting" \
|
|
|
|
"Process" \
|
|
|
|
"$1 ; $2 from domain $gsl_find_domain" \
|
|
|
|
"$gsl_site_server"
|
|
|
|
|
2022-04-13 12:24:39 +02:00
|
|
|
gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www"
|
|
|
|
gsl__srv_sync "$gsl_srv_www"
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__loop_posts www "$2"
|
2022-04-14 14:14:42 +02:00
|
|
|
|
2022-03-27 18:46:48 +02:00
|
|
|
gsl__logs_print \
|
|
|
|
"$gsl_log_i" \
|
|
|
|
"Stopping" \
|
|
|
|
"Process" \
|
|
|
|
"$1 ; $2 from domain $gsl_find_domain" \
|
|
|
|
"$gsl_site_server"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
gsl help
|
|
|
|
exit
|
2022-02-14 00:23:33 +01:00
|
|
|
;;
|
2022-02-13 17:58:25 +01:00
|
|
|
esac
|
2022-03-27 18:46:48 +02:00
|
|
|
|
2022-04-11 18:45:33 +02:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Check for process errors or warnings
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
gsl_logs_last_session=true
|
|
|
|
gsl__logs_show
|
|
|
|
|
|
|
|
if [[ "$gsl_checker_war" ]];then
|
|
|
|
echo
|
|
|
|
gsl_logs_war=true
|
|
|
|
gsl__logs_show
|
|
|
|
fi
|
|
|
|
|
2022-04-12 17:56:54 +02:00
|
|
|
if [[ "$gsl_checker_err" ]];then
|
2022-04-11 18:45:33 +02:00
|
|
|
echo
|
|
|
|
gsl_logs_err=true
|
|
|
|
gsl__logs_show
|
2022-04-12 17:56:54 +02:00
|
|
|
exit 1
|
2022-04-11 18:45:33 +02:00
|
|
|
fi
|