Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2baa1005d | ||
|
|
92d07bb589 | ||
|
|
a03c25ebf9 | ||
|
|
909a1fb52d | ||
|
|
1682d0bd18 | ||
|
|
ada7ab40cd | ||
|
|
cf8f7f391c | ||
|
|
d3afa4788b |
+11
@@ -3,6 +3,7 @@
|
|||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
|
yellow="\033[0;33m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
|
||||||
KYMSU_PATH=`pwd`
|
KYMSU_PATH=`pwd`
|
||||||
@@ -28,6 +29,16 @@ rm -rf $pluginpath
|
|||||||
echo -e "Copying plugins in ${bold}$pluginpath${reset} ..."
|
echo -e "Copying plugins in ${bold}$pluginpath${reset} ..."
|
||||||
cp -R "${KYMSU_PATH}/plugins.d" $HOME/.kymsu
|
cp -R "${KYMSU_PATH}/plugins.d" $HOME/.kymsu
|
||||||
|
|
||||||
|
for F in $HOME/.kymsu/plugins.d/*.sh
|
||||||
|
do
|
||||||
|
q=$(xattr -l "$F" | grep "com.apple.quarantine")
|
||||||
|
|
||||||
|
if [ "$q" != "" ]; then
|
||||||
|
echo -e "${yellow}Clear quarantine flag...${reset}"
|
||||||
|
xattr -d com.apple.quarantine "$F"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ -n "$disabled" ]; then
|
if [ -n "$disabled" ]; then
|
||||||
|
|
||||||
echo -e "Disabling previous disabled plugins ..."
|
echo -e "Disabling previous disabled plugins ..."
|
||||||
|
|||||||
+15
-6
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
#PREF_FILE="$SCRIPT_DIR/kymsu.pref"
|
PREF_FILE="$HOME/.kymsu/plugins.d/kymsu.cfg"
|
||||||
#TEMP_FILE="$SCRIPT_DIR/kymsu.pref.tmp"
|
TEMP_FILE="$HOME/.kymsu/plugins.d/kymsu.cfg.tmp"
|
||||||
PREF_FILE="$HOME/.kymsu/plugins.d/kymsu.pref"
|
|
||||||
TEMP_FILE="$HOME/.kymsu/plugins.d/kymsu.pref.tmp"
|
|
||||||
|
|
||||||
# 5m 5 minutes
|
# 5m 5 minutes
|
||||||
# 2h 2 hours
|
# 2h 2 hours
|
||||||
@@ -37,9 +35,20 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
current_timestamp=$(date +"%s")
|
current_timestamp=$(date +"%s")
|
||||||
temps=$(( current_timestamp-last_update))
|
temps=$(( current_timestamp-last_update ))
|
||||||
|
|
||||||
if [ $(( temps-w)) -gt 0 ]; then
|
last_upd=$(date +'%d-%m-%Y %H:%M:%S' -d @$last_update)
|
||||||
|
echo "Last update: $last_upd"
|
||||||
|
|
||||||
|
current=$(date +'%d-%m-%Y %H:%M:%S' -d @$current_timestamp)
|
||||||
|
echo "Current: $current"
|
||||||
|
|
||||||
|
next_update=$(( last_update+w ))
|
||||||
|
next_upd=$(date +'%d-%m-%Y %H:%M:%S' -d @$next_update)
|
||||||
|
echo -e "Next update: $next_upd\n"
|
||||||
|
|
||||||
|
|
||||||
|
if [ $(( temps-w )) -gt 0 ]; then # more than $update_interval
|
||||||
echo "🦄 KYMSU self update"
|
echo "🦄 KYMSU self update"
|
||||||
pushd "$(cat ~/.kymsu/path)" > /dev/null
|
pushd "$(cat ~/.kymsu/path)" > /dev/null
|
||||||
#git pull
|
#git pull
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
config_read_file() {
|
||||||
|
(grep -E "^${2}=" -m 1 "${1}" 2>/dev/null || echo "VAR=__UNDEFINED__") | head -n 1 | cut -d '=' -f 2-;
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get() {
|
||||||
|
val="$(config_read_file kymsu.cfg "${1}")";
|
||||||
|
if [ "${val}" = "__UNDEFINED__" ]; then
|
||||||
|
val="$(config_read_file config.cfg.defaults "${1}")";
|
||||||
|
fi
|
||||||
|
printf -- "%s" "${val}";
|
||||||
|
}
|
||||||
+18
-3
@@ -3,6 +3,8 @@
|
|||||||
# Homebrew plugin for KYMSU
|
# Homebrew plugin for KYMSU
|
||||||
# https://github.com/welcoMattic/kymsu
|
# https://github.com/welcoMattic/kymsu
|
||||||
|
|
||||||
|
source config.shlib; # load the config library functions
|
||||||
|
|
||||||
###############################################################################################
|
###############################################################################################
|
||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
@@ -12,7 +14,10 @@ display_info=true
|
|||||||
|
|
||||||
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
# Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update.
|
||||||
# declare -a do_not_update=("xnconvert" "yate")
|
# declare -a do_not_update=("xnconvert" "yate")
|
||||||
declare -a cask_to_not_update=()
|
#declare -a cask_to_not_update=(ff-works)
|
||||||
|
|
||||||
|
pinned_cask="$(config_get pinned_cask)"
|
||||||
|
declare -a cask_to_not_update=($pinned_cask)
|
||||||
|
|
||||||
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
|
||||||
#[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
#[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false
|
||||||
@@ -34,7 +39,6 @@ latest=false
|
|||||||
|
|
||||||
: <<'END_COMMENT'
|
: <<'END_COMMENT'
|
||||||
blabla
|
blabla
|
||||||
END_COMMENT
|
|
||||||
|
|
||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
@@ -44,6 +48,17 @@ red="\033[1;31m"
|
|||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
box="\033[1;41m"
|
box="\033[1;41m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
italic="$(config_get italic)"
|
||||||
|
underline="$(config_get underline)"
|
||||||
|
ita_under="$(config_get ita_under)"
|
||||||
|
bgd="$(config_get bgd)"
|
||||||
|
red="$(config_get red)"
|
||||||
|
bold="$(config_get bold)"
|
||||||
|
box="$(config_get box)"
|
||||||
|
reset="$(config_get reset)"
|
||||||
|
|
||||||
|
|
||||||
command -v terminal-notifier >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}terminal-notifier${reset} for notification ${italic}(brew install terminal-notifier)${reset}.\n"; }
|
command -v terminal-notifier >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}terminal-notifier${reset} for notification ${italic}(brew install terminal-notifier)${reset}.\n"; }
|
||||||
command -v jq >/dev/null 2>&1 || { echo -e "${bold}kymsu2${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; }
|
command -v jq >/dev/null 2>&1 || { echo -e "${bold}kymsu2${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; }
|
||||||
@@ -311,7 +326,7 @@ if (( ${#cask_to_not_update[@]} )); then
|
|||||||
|
|
||||||
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' casks:${reset}"
|
echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' casks:${reset}"
|
||||||
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
echo -e "${red}${cask_to_not_update[*]}${reset}"
|
||||||
echo -e "To remove an app from this list, you need to edit the ${italic}do_not_update${reset} array."
|
echo -e "To add/remove an app from this list, you need to edit the ${italic}pinned_cask${reset} variable in kymsu.cfg file."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
casks_not_pinned=""
|
casks_not_pinned=""
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ y=$(find . -type f -name 'Brewfile*' -mtime +10 -maxdepth 1)
|
|||||||
if [ -n "$y" ]; then
|
if [ -n "$y" ]; then
|
||||||
nb=$(echo "$y" | wc -l)
|
nb=$(echo "$y" | wc -l)
|
||||||
echo "$y" | xargs rm
|
echo "$y" | xargs rm
|
||||||
[ $? ] && echo -e "\033[93m$nb Brewfile_*\033[0m files removed !"
|
[ $? ] && echo -e "\033[93m$nb Brewfile_*\033[0m files removed !\n\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
#iconv -f macroman -t utf-8 Installed.md > Installed-utf8.md
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# General
|
||||||
|
italic=\033[3m
|
||||||
|
underline=\033[4m
|
||||||
|
ita_under=\033[3;4m
|
||||||
|
bgd=\033[1;4;31m
|
||||||
|
red=\033[1;31m
|
||||||
|
bold=\033[1m
|
||||||
|
box=\033[1;41m
|
||||||
|
green=\033[1;32m
|
||||||
|
bold_ita=\033[1;3m
|
||||||
|
redbold=\033[1;31m
|
||||||
|
redbox=\033[1;41m
|
||||||
|
reset=\033[0m
|
||||||
|
|
||||||
|
last.update=1658067929
|
||||||
|
|
||||||
|
# Homebrew
|
||||||
|
pinned_cask=ff-works mole
|
||||||
|
|
||||||
|
# Node
|
||||||
|
pinned_npm=@squoosh/cli
|
||||||
|
npm_local_path=$HOME/Sites # $HOME not evaluated
|
||||||
+76
-14
@@ -4,6 +4,8 @@
|
|||||||
# https://github.com/welcoMattic/kymsu
|
# https://github.com/welcoMattic/kymsu
|
||||||
#
|
#
|
||||||
|
|
||||||
|
source config.shlib; # load the config library functions
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
#
|
#
|
||||||
# Settings:
|
# Settings:
|
||||||
@@ -28,18 +30,22 @@ update_node=true
|
|||||||
|
|
||||||
# Local install:
|
# Local install:
|
||||||
# run 'npm init' in local_path to create package.json
|
# run 'npm init' in local_path to create package.json
|
||||||
local_path=$HOME/Sites/
|
local_path=$HOME/Sites
|
||||||
|
#local_path=$(config_get npm_local_path) # $HOME not evaluated
|
||||||
|
|
||||||
# Add module to the do_not_update array for prevent to update.
|
# Add module to the do_not_update array for prevent to update.
|
||||||
#declare -a do_not_update=()
|
#declare -a do_not_update=()
|
||||||
#declare -a do_not_update=("parso" "asgiref")
|
#declare -a do_not_update=("parso" "asgiref")
|
||||||
declare -a do_not_update=("@squoosh/cli")
|
#declare -a do_not_update=("@squoosh/cli")
|
||||||
|
|
||||||
|
pinned_npm="$(config_get pinned_npm)"
|
||||||
|
declare -a npm_do_not_update=($pinned_npm)
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
|
|
||||||
: <<'END_COMMENT'
|
: <<'END_COMMENT'
|
||||||
blabla
|
blabla
|
||||||
END_COMMENT
|
|
||||||
|
|
||||||
italic="\033[3m"
|
italic="\033[3m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
@@ -53,6 +59,20 @@ box="\033[1;41m"
|
|||||||
redbold="\033[1;31m"
|
redbold="\033[1;31m"
|
||||||
redbox="\033[1;41m"
|
redbox="\033[1;41m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
italic="$(config_get italic)"
|
||||||
|
underline="$(config_get underline)"
|
||||||
|
ita_under="$(config_get ita_under)"
|
||||||
|
bgd="$(config_get bgd)"
|
||||||
|
red="$(config_get red)"
|
||||||
|
bold="$(config_get bold)"
|
||||||
|
box="$(config_get box)"
|
||||||
|
green="$(config_get green)"
|
||||||
|
bold_ita="$(config_get bold_ita)"
|
||||||
|
redbold="$(config_get redbold)"
|
||||||
|
redbox="$(config_get redbox)"
|
||||||
|
reset="$(config_get reset)"
|
||||||
|
|
||||||
upd_nvm() {(
|
upd_nvm() {(
|
||||||
cd "$NVM_DIR"
|
cd "$NVM_DIR"
|
||||||
@@ -161,15 +181,15 @@ echo ""
|
|||||||
|
|
||||||
|
|
||||||
# Do not update packages
|
# Do not update packages
|
||||||
if (( ${#do_not_update[@]} )); then
|
|
||||||
|
|
||||||
nbp=${#do_not_update[*]}
|
if [ ${#npm_do_not_update[@]} -gt 0 ]; then
|
||||||
|
|
||||||
|
nbp="${#npm_do_not_update[@]}"
|
||||||
|
|
||||||
echo -e "${underline}🌿 List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
echo -e "${underline}🌿 List of${reset} ${redbox} $nbp ${reset} ${underline}'do not update' packages:${reset}"
|
||||||
echo -e "${redbold}${do_not_update[*]}${reset}"
|
echo -e "${redbold}${npm_do_not_update[@]}${reset}"
|
||||||
echo -e "To remove package from this list, you need to edit the ${italic}do_not_update${reset} array."
|
echo -e "To remove package from this list, you need to edit the ${italic}pinned_npm${reset} variable in ${italic}kymsu.cfg${reset} file."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##################
|
##################
|
||||||
@@ -182,6 +202,8 @@ fi
|
|||||||
|
|
||||||
# Local folder exist and not empty (modules installed)
|
# Local folder exist and not empty (modules installed)
|
||||||
#if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then
|
#if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then
|
||||||
|
|
||||||
|
|
||||||
if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then
|
if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then
|
||||||
|
|
||||||
echo -e "${underline}🌿 Local installed scripts:${reset}"
|
echo -e "${underline}🌿 Local installed scripts:${reset}"
|
||||||
@@ -226,14 +248,14 @@ if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then
|
|||||||
while IFS= read -r i
|
while IFS= read -r i
|
||||||
do
|
do
|
||||||
package=$(echo "$i" | awk '{print $1}')
|
package=$(echo "$i" | awk '{print $1}')
|
||||||
current=$(echo "$i" | awk '{print $2}')
|
current=$(echo "$i" | awk '{print $2}') # 2.8.3
|
||||||
wanted=$(echo "$i" | awk '{print $3}')
|
wanted=$(echo "$i" | awk '{print $3}') # 2.8.3
|
||||||
latest=$(echo "$i" | awk '{print $4}')
|
latest=$(echo "$i" | awk '{print $4}') # 2.9.0-beta.1
|
||||||
|
|
||||||
j=$(echo "$current" | awk -F "." '{print $1}')
|
j=$(echo "$current" | awk -F "." '{print $1}')
|
||||||
k=$(echo "$latest" | awk -F "." '{print $1}')
|
k=$(echo "$latest" | awk -F "." '{print $1}')
|
||||||
|
|
||||||
if [[ ! " ${do_not_update[@]} " =~ " ${package} " ]]; then
|
if [[ ! " ${npm_do_not_update[@]} " =~ " ${package} " ]]; then
|
||||||
|
|
||||||
# Update major version 1.x.y to 2.x.y
|
# Update major version 1.x.y to 2.x.y
|
||||||
if [ $current = $wanted ] && [ "$j" -lt "$k" ]; then
|
if [ $current = $wanted ] && [ "$j" -lt "$k" ]; then
|
||||||
@@ -261,6 +283,8 @@ if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then
|
|||||||
else
|
else
|
||||||
echo -e "${italic}No local packages updates.${reset}"
|
echo -e "${italic}No local packages updates.${reset}"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${italic}No local folder !${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
@@ -275,6 +299,7 @@ if [ "$display_info" = true ]; then
|
|||||||
lg=$(npm list --location=global --depth=0 --long | grep -v 'git$')
|
lg=$(npm list --location=global --depth=0 --long | grep -v 'git$')
|
||||||
x=""
|
x=""
|
||||||
q=""
|
q=""
|
||||||
|
all_global_pkgs=""
|
||||||
|
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
@@ -287,6 +312,8 @@ if [ "$display_info" = true ]; then
|
|||||||
#echo "$q"
|
#echo "$q"
|
||||||
x+="${bold}${line}${reset}\n"
|
x+="${bold}${line}${reset}\n"
|
||||||
|
|
||||||
|
all_global_pkgs="$all_global_pkgs $global_pkg"
|
||||||
|
|
||||||
elif [[ ${#line} > 2 ]]; then
|
elif [[ ${#line} > 2 ]]; then
|
||||||
#echo -e "${line}"
|
#echo -e "${line}"
|
||||||
x+="${line}\n"
|
x+="${line}\n"
|
||||||
@@ -298,6 +325,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "$x"
|
echo -e "$x"
|
||||||
|
#echo "$all_global_pkgs"
|
||||||
|
|
||||||
#Packages update
|
#Packages update
|
||||||
echo -e "\n${underline}🌿 Search for global packages update...${reset}\n"
|
echo -e "\n${underline}🌿 Search for global packages update...${reset}\n"
|
||||||
@@ -327,7 +355,7 @@ if [ -n "$glong_outdated" ]; then
|
|||||||
vers=$(echo "$line" | awk '{print $4}')
|
vers=$(echo "$line" | awk '{print $4}')
|
||||||
outdated="$pkg@$vers"
|
outdated="$pkg@$vers"
|
||||||
|
|
||||||
if [[ ! " ${do_not_update[@]} " =~ " ${pkg} " ]]; then
|
if [[ ! " ${npm_do_not_update[@]} " =~ " ${pkg} " ]]; then
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
#version=$(echo "$line" | awk '{print $1 "@" $4}')
|
#version=$(echo "$line" | awk '{print $1 "@" $4}')
|
||||||
@@ -362,8 +390,8 @@ echo ""
|
|||||||
if [ "$doctor" = true ]; then
|
if [ "$doctor" = true ]; then
|
||||||
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
|
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
|
||||||
#npm doctor
|
#npm doctor
|
||||||
doc=$(cd "$local_path" && npm doctor)
|
|
||||||
|
|
||||||
|
doc=$(cd "$local_path" && npm doctor)
|
||||||
|
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
@@ -394,6 +422,8 @@ if [ "$doctor" = true ]; then
|
|||||||
|
|
||||||
if [ "$new_node" != "$old_node" ] && [ "$update_node" = true ]; then
|
if [ "$new_node" != "$old_node" ] && [ "$update_node" = true ]; then
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
|
||||||
b=$(echo -e "\nCurrent node: v$old_node. Update ${bold}node${reset} to ${bold}v$new_node${reset} [y/n] ? ")
|
b=$(echo -e "\nCurrent node: v$old_node. Update ${bold}node${reset} to ${bold}v$new_node${reset} [y/n] ? ")
|
||||||
read -e -p "$b" rep2
|
read -e -p "$b" rep2
|
||||||
if [ "$rep2" == "y" ] || [ "$rep2" == "Y" ]; then
|
if [ "$rep2" == "y" ] || [ "$rep2" == "Y" ]; then
|
||||||
@@ -407,6 +437,38 @@ if [ "$doctor" = true ]; then
|
|||||||
echo -e "\n${bold}Reinstall packages from v$old_node...${reset}"
|
echo -e "\n${bold}Reinstall packages from v$old_node...${reset}"
|
||||||
nvm reinstall-packages "$old_node"
|
nvm reinstall-packages "$old_node"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
echo -e "\nCurrent node: v$old_node. Press \"u\" to update ${bold}node${reset} to ${bold}v$new_node${reset}"
|
||||||
|
|
||||||
|
#read -sn1 c && printf "You Pressed: %s\n" "$c"
|
||||||
|
|
||||||
|
|
||||||
|
read -sn1 c
|
||||||
|
if [ "$c" == "u" ] || [ "$c" == "U" ]; then
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
. $HOME/.nvm/nvm.sh
|
||||||
|
echo -e "\n${bold}Updating node to v$new_node...${reset}"
|
||||||
|
nvm install "$new_node"
|
||||||
|
echo -e "\n${bold}Updating npm...${reset}"
|
||||||
|
npm --location=global install npm
|
||||||
|
#
|
||||||
|
nvm use $new_node
|
||||||
|
echo -e "\n${bold}Reinstall packages from v$old_node...${reset}"
|
||||||
|
echo "$all_global_pkgs"
|
||||||
|
# nvm reinstall-packages bloque sur thumbsup (better-sql)
|
||||||
|
#nvm reinstall-packages "$old_node"
|
||||||
|
|
||||||
|
for i in "$all_global_pkgs"
|
||||||
|
do
|
||||||
|
echo "--$i--"
|
||||||
|
done
|
||||||
|
#npm install -g "$all_global_pkgs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+61
-30
@@ -36,10 +36,6 @@ then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
list=$(pipx list --include-injected) # pipx list --quiet
|
|
||||||
echo -e "\n${underline}List installed packages:${reset}"
|
|
||||||
echo "$list"
|
|
||||||
|
|
||||||
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
curl -Is https://www.apple.com | head -1 | grep 200 1>/dev/null
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
echo -e "\n${red}No Internet connection !${reset}"
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
@@ -47,20 +43,56 @@ if [[ $? -eq 1 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
list=$(pipx list --include-injected) # pipx list --quiet
|
||||||
|
echo -e "\n${underline}List installed packages:${reset}"
|
||||||
|
#echo "$list"
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
|
||||||
|
if grep -q 'package.*,' <<< "${line}"
|
||||||
|
then
|
||||||
|
pyPkgName=$(echo "${line}" | awk -F" " '{print $2}' )
|
||||||
|
|
||||||
|
infoPkg=$(curl -s https://pypi.org/pypi/${pyPkgName}/json | jq -r '.info')
|
||||||
|
summaryPkg=$(echo "$infoPkg" | jq -r '.summary')
|
||||||
|
srcUrl=$(echo "$infoPkg" | jq -r '.project_urls' | jq -r '.Homepage')
|
||||||
|
|
||||||
|
inf="$summaryPkg\n"" ${italic}$srcUrl${reset}"
|
||||||
|
echo -e "\n${bold}${line}${reset}\n ${inf}"
|
||||||
|
else
|
||||||
|
echo -e "${line}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
done <<< "$list"
|
||||||
|
|
||||||
|
|
||||||
|
pinned=$(pipx list --pinned)
|
||||||
|
echo -e "\n${underline}Pinned packages:${reset}"
|
||||||
|
echo "$pinned"
|
||||||
|
echo -e "To unpin, please enter ${italic}pipx unpin <package>${reset}"
|
||||||
|
|
||||||
|
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.summary'
|
||||||
|
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.version'
|
||||||
|
# curl -s https://pypi.org/pypi/mkdocs/json | jq -r '.info.project_url'
|
||||||
|
|
||||||
pipx-outdated() {
|
pipx-outdated() {
|
||||||
echo -e "\n${underline}Outdated Packages:${reset}"
|
echo -e "\n${underline}Outdated Packages:${reset}"
|
||||||
while read -sr pyPkgName pyPkyVersion; do
|
while read -sr pyPkgName pyPkyVersion; do
|
||||||
local pypi_latest="$(curl -sS https://pypi.org/simple/${pyPkgName}/ | grep -o '>.*</' | tail -n 1 | grep -o -E '[0-9]([0-9]|[-._])*[0-9]')"
|
local pypi_latest="$(curl -sS https://pypi.org/simple/${pyPkgName}/ | grep -o '>.*</' | tail -n 1 | grep -o -E '[0-9]([0-9]|[-._])*[0-9]')"
|
||||||
#[ "$pyPkyVersion" != "$pypi_latest" ] && printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
#[ "$pyPkyVersion" != "$pypi_latest" ] && printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||||
if [ "$pyPkyVersion" != "$pypi_latest" ]; then
|
if [ "$pyPkyVersion" != "$pypi_latest" ]; then
|
||||||
printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
if [[ "$pinned" == *"$pyPkgName"* ]]; then
|
||||||
outdated+="$pyPkgName "
|
printf "${red}%s\tCurrent: %s\tLatest: %s (pinned)${reset}\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||||
|
else
|
||||||
|
printf "%s\tCurrent: %s\tLatest: %s\n" "$pyPkgName" "$pyPkyVersion" "$pypi_latest"
|
||||||
|
outdated+="$pyPkgName "
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- )
|
done < <( pipx list | grep -o 'package.*,' | tr -d ',' | cut -d ' ' -f 2- )
|
||||||
}
|
}
|
||||||
|
|
||||||
# https://github.com/avantrec/soco-cli/blob/master/CHANGELOG.txt
|
|
||||||
|
|
||||||
pipx-outdated
|
pipx-outdated
|
||||||
|
|
||||||
@@ -71,31 +103,30 @@ if [ -n "$outdated" ]; then
|
|||||||
nb=$(echo "$outdated" | wc -w | xargs)
|
nb=$(echo "$outdated" | wc -w | xargs)
|
||||||
echo -e "${redbox} $nb ${reset} availables updates:"
|
echo -e "${redbox} $nb ${reset} availables updates:"
|
||||||
|
|
||||||
|
a=$(echo -e "\nDo you wanna run ${bold}pipx upgrade "$outdated"${reset} ? (y/n/a) ")
|
||||||
|
# yes/no/all
|
||||||
|
read -p "$a" choice
|
||||||
|
|
||||||
a=$(echo -e "\nDo you wanna run ${bold}pipx upgrade "$outdated"${reset} ? (y/n/a) ")
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
# yes/no/all
|
for i in $outdated;
|
||||||
read -p "$a" choice
|
do
|
||||||
|
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
if [ "$injected" = true ]; then
|
||||||
for i in $outdated;
|
echo "$i" | xargs -p -n 1 pipx upgrade --include-injected
|
||||||
do
|
else
|
||||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
echo "$i" | xargs -p -n 1 pipx upgrade
|
||||||
if [ "$injected" = true ]; then
|
|
||||||
echo "$i" | xargs -p -n 1 pipx upgrade --include-injected
|
|
||||||
else
|
|
||||||
echo "$i" | xargs -p -n 1 pipx upgrade
|
|
||||||
fi
|
|
||||||
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
|
||||||
if [ "$injected" = true ]; then
|
|
||||||
pipx upgrade-all --include-injected
|
|
||||||
else
|
|
||||||
pipx upgrade-all
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then
|
||||||
else
|
if [ "$injected" = true ]; then
|
||||||
echo -e "OK, let's continue..."
|
pipx upgrade-all --include-injected
|
||||||
fi
|
else
|
||||||
|
pipx upgrade-all
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -e "OK, let's continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "No update available !"
|
echo "No update available !"
|
||||||
|
|||||||
+26
-6
@@ -5,6 +5,7 @@ underline="\033[4m"
|
|||||||
ita_under="\033[3;4m"
|
ita_under="\033[3;4m"
|
||||||
bgd="\033[1;4;31m"
|
bgd="\033[1;4;31m"
|
||||||
red="\033[1;31m"
|
red="\033[1;31m"
|
||||||
|
greenbold="\033[1;32m"
|
||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
box="\033[1;41m"
|
box="\033[1;41m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
@@ -21,16 +22,35 @@ fi
|
|||||||
if hash rustup 2>/dev/null; then
|
if hash rustup 2>/dev/null; then
|
||||||
|
|
||||||
echo -e "🦀 ${underline}rustup check${reset}\n"
|
echo -e "🦀 ${underline}rustup check${reset}\n"
|
||||||
rustup check
|
#rustup check
|
||||||
|
check=$(rustup check)
|
||||||
|
#check=$(echo "$check" | sed 's/Up\ to\ date/${bold}Up\ to\ dateee${reset}/g')
|
||||||
|
#echo ${check/Up to date/\{greenbold\}Up to dateee\{reset\}\}
|
||||||
|
#Update available
|
||||||
|
echo -e "$check\n"
|
||||||
|
|
||||||
|
if [[ "$check" =~ "update\ available" ]]; then
|
||||||
|
echo -e "🦀 ${underline}rustup update${reset}\n"
|
||||||
|
rustup update
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! $(which rustup-init) =~ "homebrew" ]]; then
|
#if [[ ! $(which rustup-init) =~ "homebrew" ]]; then
|
||||||
echo -e "\n🦀 ${underline}Upgrading rustup itself !${reset}\n"
|
# echo -e "\n🦀 ${underline}Upgrading rustup itself !${reset}\n"
|
||||||
rustup self update
|
# rustup self update
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
echo -e "\n🦀 ${underline}Upgrading rust toolchains !${reset}\n"
|
echo -e "\n🦀 ${underline}Upgrading rust toolchains !${reset}\n"
|
||||||
rustup update
|
check_rust=$(echo "$check" | awk 'NR==1' | awk -F" - " '{print $2}')
|
||||||
|
|
||||||
|
if [[ $check_rust =~ "Update available" ]]; then
|
||||||
|
echo "$check_rust"
|
||||||
|
rustup update
|
||||||
|
elif [[ $check_rust =~ "Up to date" ]]; then
|
||||||
|
rust_version=$(echo "$check_rust" | awk -F" : " '{print $2}')
|
||||||
|
echo -e "${greenbold}Rust is up to date!${reset}"" ($rust_version)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# si erreur rustup update => rustup toolchain uninstall stable && rustup toolchain install stable
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then
|
|||||||
v=$HOME/venv
|
v=$HOME/venv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -Is http://www.google.com | head -1 | grep 200 1>/dev/null
|
curl -Is https://www.google.com | head -1 | grep 200 1>/dev/null
|
||||||
if [[ $? -eq 1 ]]; then
|
if [[ $? -eq 1 ]]; then
|
||||||
echo -e "\n${red}No Internet connection !${reset}"
|
echo -e "\n${red}No Internet connection !${reset}"
|
||||||
echo -e "Exit !"
|
echo -e "Exit !"
|
||||||
|
|||||||
+62
-39
@@ -25,12 +25,25 @@ emptytrash=true
|
|||||||
# Sauvegarde de la base
|
# Sauvegarde de la base
|
||||||
backup=true
|
backup=true
|
||||||
# Maintenance de la base (optimize & repair)
|
# Maintenance de la base (optimize & repair)
|
||||||
database=false
|
database=true
|
||||||
# Effacer les transients expirés
|
# Effacer les transients expirés
|
||||||
transient=true
|
transient=true
|
||||||
# Ouvrir la page d'aministration
|
# Ouvrir la page d'aministration
|
||||||
admin=false
|
admin=false
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
blabla
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
italic="\033[3m"
|
||||||
|
underline="\033[4m"
|
||||||
|
ita_under="\033[3;4m"
|
||||||
|
bgd="\033[1;4;31m"
|
||||||
|
redbold="\033[1;31m"
|
||||||
|
bold="\033[1m"
|
||||||
|
box="\033[1;41m"
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
#add module to do_not_update array
|
#add module to do_not_update array
|
||||||
declare -a do_not_update=()
|
declare -a do_not_update=()
|
||||||
|
|
||||||
@@ -49,20 +62,23 @@ if ! [ -x "$(command -v wp)" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\033[1mWP wp-cli \033[0m"
|
echo -e "${redbold}Updates${reset}"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
cd $rep_wordpress
|
cd $rep_wordpress || exit
|
||||||
|
|
||||||
#echo $(pwd)
|
#echo $(pwd)
|
||||||
|
|
||||||
|
|
||||||
# *** plugins ***
|
# *** plugins ***
|
||||||
|
|
||||||
if [ "$test" = true ]; then
|
#if [ "$test" = true ]; then
|
||||||
|
|
||||||
|
#: <<'END_COMMENT2'
|
||||||
|
|
||||||
# *** core update ***
|
# *** core update ***
|
||||||
echo "Search for core update..."
|
echo -e "${bold}Search for core update...${reset}"
|
||||||
core_cu=$(wp core check-update)
|
core_cu=$(wp core check-update)
|
||||||
if ! [[ $core_cu = *"latest version"* ]]; then
|
if ! [[ $core_cu = *"latest version"* ]]; then
|
||||||
echo "New version available!"
|
echo "New version available!"
|
||||||
@@ -80,10 +96,11 @@ if [ "$test" = true ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# *** plugins ***
|
# *** plugins ***
|
||||||
echo "Search for all plugins update..."
|
echo -e "${bold}Search for all plugins update...${reset}"
|
||||||
plugin_cu_all=$(wp plugin update --all --dry-run)
|
wp plugin list --format=table # --update=available
|
||||||
|
plugin_update=$(wp plugin list --format=table --update=available)
|
||||||
plugins_outdated=$(echo "$plugin_cu_all" | sed '1,2d' | awk '{print $1}')
|
echo
|
||||||
|
plugins_outdated=$(echo "$plugin_update" | sed '/^+/d' | sed '1d' | awk '{print $1}')
|
||||||
if [ -z "$plugins_outdated" ]; then
|
if [ -z "$plugins_outdated" ]; then
|
||||||
echo "No plugins update available !"
|
echo "No plugins update available !"
|
||||||
else
|
else
|
||||||
@@ -95,10 +112,11 @@ if [ "$test" = true ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# *** themes ***
|
# *** themes ***
|
||||||
echo "Search for all themes update..."
|
echo -e "${bold}Search for all themes update...${reset}"
|
||||||
theme_cu_all=$(wp theme update --all --dry-run)
|
wp theme list --format=table #--update=available
|
||||||
|
theme_update=$(wp theme list --format=table --update=available)
|
||||||
themes_outdated=$(echo "$theme_cu_all" | sed '1,2d' | awk '{print $1}')
|
echo
|
||||||
|
themes_outdated=$(echo "$theme_update" | sed '/^+/d' | sed '1d' | awk '{print $1}')
|
||||||
if [ -z "$themes_outdated" ]; then
|
if [ -z "$themes_outdated" ]; then
|
||||||
echo "No themes update available !"
|
echo "No themes update available !"
|
||||||
else
|
else
|
||||||
@@ -110,10 +128,11 @@ if [ "$test" = true ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# *** languages core ***
|
# *** languages core ***
|
||||||
echo "Search for languages core update..."
|
echo -e "${bold}Search for languages core update...${reset}"
|
||||||
list_lang_core_upd=$(wp language core list --update=available --all --format=csv)
|
wp language core list --update=available --all --format=table
|
||||||
|
list_lang_core_upd=$(wp language core list --update=available --all --format=table)
|
||||||
|
|
||||||
lang_core_outdated=$(echo "$list_lang_core_upd" | sed '1d' | awk '{print $1}')
|
lang_core_outdated=$(echo "$list_lang_core_upd" | sed '/^+/d' | sed '1d' | awk '{print $1}')
|
||||||
if [ -z "$lang_core_outdated" ]; then
|
if [ -z "$lang_core_outdated" ]; then
|
||||||
echo "No languages core update available !"
|
echo "No languages core update available !"
|
||||||
else
|
else
|
||||||
@@ -124,11 +143,12 @@ if [ "$test" = true ]; then
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# *** languages plugin ***
|
|
||||||
echo "Search for languages plugins update..."
|
|
||||||
list_lang_plugin_upd=$(wp language plugin list --update=available --all --format=csv)
|
|
||||||
|
|
||||||
lang_plugin_outdated=$(echo "$list_lang_plugin_upd" | sed '1d' | awk '{print $1}')
|
# *** languages plugin ***
|
||||||
|
echo -e "${bold}Search for languages plugins update...${reset}"
|
||||||
|
wp language plugin list --update=available --all --format=table
|
||||||
|
list_lang_plugin_upd=$(wp language plugin list --update=available --all --format=table)
|
||||||
|
lang_plugin_outdated=$(echo "$list_lang_plugin_upd" | sed '/^+/d' | sed '1d' | awk '{print $1}')
|
||||||
if [ -z "$lang_plugin_outdated" ]; then
|
if [ -z "$lang_plugin_outdated" ]; then
|
||||||
echo "No languages plugins update available !"
|
echo "No languages plugins update available !"
|
||||||
else
|
else
|
||||||
@@ -140,10 +160,11 @@ if [ "$test" = true ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# *** languages theme ***
|
# *** languages theme ***
|
||||||
echo "Search for languages themes update..."
|
echo -e "${bold}Search for languages themes update...${reset}"
|
||||||
list_lang_theme_upd=$(wp language theme list --update=available --all --format=csv)
|
wp language theme list --update=available --all --format=table
|
||||||
|
list_lang_theme_upd=$(wp language theme list --update=available --all --format=table)
|
||||||
|
|
||||||
lang_theme_outdated=$(echo "$list_lang_theme_upd" | sed '1d' | awk '{print $1}')
|
lang_theme_outdated=$(echo "$list_lang_theme_upd" | sed '/^+/d' | sed '1d' | awk '{print $1}')
|
||||||
if [ -z "$lang_theme_outdated" ]; then
|
if [ -z "$lang_theme_outdated" ]; then
|
||||||
echo "No languages themes update available !"
|
echo "No languages themes update available !"
|
||||||
else
|
else
|
||||||
@@ -153,9 +174,10 @@ if [ "$test" = true ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
#fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
#END_COMMENT2
|
||||||
|
|
||||||
# *** Maintenance ***
|
# *** Maintenance ***
|
||||||
|
|
||||||
@@ -164,19 +186,20 @@ if [ "$maint" = true ]; then
|
|||||||
echo -e "\n\033[1;31mMaintenance...\033[0m"
|
echo -e "\n\033[1;31mMaintenance...\033[0m"
|
||||||
|
|
||||||
#On récupère la liste des packages installés
|
#On récupère la liste des packages installés
|
||||||
|
echo -e "\n\033[1mInstalled package list...\033[0m"
|
||||||
packages_list=$(wp package list | sed -n '1!p' | awk '{print $1'})
|
packages_list=$(wp package list | sed -n '1!p' | awk '{print $1'})
|
||||||
echo "$packages_list"
|
echo "$packages_list"
|
||||||
|
|
||||||
if [ "$transient" = true ]; then
|
if [ "$transient" = true ]; then
|
||||||
echo -e "\n\033[1mRemove expired transients...\033[0m"
|
echo -e "\n\033[1mRemove expired transients...\033[0m"
|
||||||
|
|
||||||
wp transient delete --expired --path=$path
|
wp transient delete --expired --path=$rep_wordpress
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$database" = true ]; then
|
if [ "$database" = true ]; then
|
||||||
echo -e "\n\033[1mDatabase maintenance...\033[0m"
|
echo -e "\n\033[1mDatabase maintenance...\033[0m"
|
||||||
|
|
||||||
wp db optimize --quiet --path=$path
|
wp db optimize --quiet --path=$rep_wordpress
|
||||||
|
|
||||||
#wp db repair --quiet --path=$path
|
#wp db repair --quiet --path=$path
|
||||||
fi
|
fi
|
||||||
@@ -187,19 +210,19 @@ echo "$packages_list"
|
|||||||
DATE=`date +%Y-%m-%d_%H:%M:%S`
|
DATE=`date +%Y-%m-%d_%H:%M:%S`
|
||||||
file="wp-$blogname-$DATE.sql"
|
file="wp-$blogname-$DATE.sql"
|
||||||
|
|
||||||
wp db export "$file" --add-drop-table --path=$path
|
wp db export "$file" --add-drop-table --path=$rep_wordpress
|
||||||
mv "$file" "../$file"
|
mv "$file" "../$file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$removespam" = true ]; then
|
if [ "$removespam" = true ]; then
|
||||||
echo -e "\n\033[1mRemove spam comments...\033[0m"
|
echo -e "\n\033[1mRemove spam comments...\033[0m"
|
||||||
|
|
||||||
#spam=$($wp_exec comment list --status=spam --format=ids --path=$path)
|
spam=$(wp comment list --status=spam --format=ids --path=$rep_wordpress)
|
||||||
echo "$spam"
|
echo "$spam"
|
||||||
if [ -n "$spam" ]; then
|
if [ -n "$spam" ]; then
|
||||||
echo "$spam"
|
echo "$spam"
|
||||||
#wp comment delete "$spam" --path=$path
|
#wp comment delete "$spam" --path=$path
|
||||||
wp comment delete $($wp_exec comment list --status=spam --format=ids --path=$path) --path=$path --dry-run
|
wp comment delete $(wp comment list --status=spam --format=ids --path=$rep_wordpress) --path=$rep_wordpress --dry-run
|
||||||
else
|
else
|
||||||
echo "No SPAM"
|
echo "No SPAM"
|
||||||
fi
|
fi
|
||||||
@@ -208,9 +231,9 @@ echo "$packages_list"
|
|||||||
if [ "$emptytrash" = true ]; then
|
if [ "$emptytrash" = true ]; then
|
||||||
echo -e "\n\033[1mRemove comments in trash and comment from deleted posts...\033[0m"
|
echo -e "\n\033[1mRemove comments in trash and comment from deleted posts...\033[0m"
|
||||||
|
|
||||||
trashed=$(wp comment list --status=trash,post-trashed --format=ids --path=$path)
|
trashed=$(wp comment list --status=trash,post-trashed --format=ids --path=$rep_wordpress)
|
||||||
if [ -n "$trashed" ]; then
|
if [ -n "$trashed" ]; then
|
||||||
wp comment delete "$trashed" --path=$path
|
wp comment delete "$trashed" --path=$rep_wordpress
|
||||||
echo $?
|
echo $?
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -221,7 +244,7 @@ echo "$packages_list"
|
|||||||
#if [[ "$($wp_exec cli has-command 'revisions' --path=$path && echo $?)" -eq 0 ]] && [[ "$rev" = true ]]; then
|
#if [[ "$($wp_exec cli has-command 'revisions' --path=$path && echo $?)" -eq 0 ]] && [[ "$rev" = true ]]; then
|
||||||
if [[ -n "$(echo "$packages_list" | awk '$1 ~ /trepmal\/wp-revisions-cli/')" ]] && [[ "$rev" = true ]]; then
|
if [[ -n "$(echo "$packages_list" | awk '$1 ~ /trepmal\/wp-revisions-cli/')" ]] && [[ "$rev" = true ]]; then
|
||||||
echo -e "\n\033[1mKeep only $revisions revisions...\033[0m"
|
echo -e "\n\033[1mKeep only $revisions revisions...\033[0m"
|
||||||
wp revisions clean $revisions --path=$path --dry-run
|
wp revisions clean $revisions --path=$rep_wordpress --dry-run
|
||||||
|
|
||||||
elif [ "$rev" = true ]; then
|
elif [ "$rev" = true ]; then
|
||||||
printf "Voulez-vous installer wp-revisions-cli ? (y/n)"
|
printf "Voulez-vous installer wp-revisions-cli ? (y/n)"
|
||||||
@@ -239,18 +262,18 @@ echo "$packages_list"
|
|||||||
if [ "$back" = true ]; then
|
if [ "$back" = true ]; then
|
||||||
echo -e "\n\033[1mTrackback list...\033[0m"
|
echo -e "\n\033[1mTrackback list...\033[0m"
|
||||||
|
|
||||||
trackback=$(wp comment list --type=trackback --format=ids --path=$path)
|
trackback=$(wp comment list --type=trackback --format=ids --path=$rep_wordpress)
|
||||||
if [ -n "$trackback" ]; then
|
if [ -n "$trackback" ]; then
|
||||||
wp comment delete "$trackback" --path=$path --dry-run
|
wp comment delete "$trackback" --path=$rep_wordpress --dry-run
|
||||||
else
|
else
|
||||||
echo "No trackback post"
|
echo "No trackback post"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n\033[1mPingback list...\033[0m"
|
echo -e "\n\033[1mPingback list...\033[0m"
|
||||||
|
|
||||||
pingback=$(wp comment list --type=pingback --format=ids --path=$path)
|
pingback=$(wp comment list --type=pingback --format=ids --path=$rep_wordpress)
|
||||||
if [ -n "$pingback" ]; then
|
if [ -n "$pingback" ]; then
|
||||||
wp comment delete "$pingback" --path=$path --dry-run
|
wp comment delete "$pingback" --path=$rep_wordpress --dry-run
|
||||||
else
|
else
|
||||||
echo "No pingback post"
|
echo "No pingback post"
|
||||||
fi
|
fi
|
||||||
@@ -262,12 +285,12 @@ echo "$packages_list"
|
|||||||
|
|
||||||
if [[ -n "$(echo "$packages_list" | awk '$1 ~ /wp-cli\/admin-command/')" ]] && [[ "$admin" = true ]]; then
|
if [[ -n "$(echo "$packages_list" | awk '$1 ~ /wp-cli\/admin-command/')" ]] && [[ "$admin" = true ]]; then
|
||||||
echo -e "\n\033[1mOpen wp-admin/ page in browser...\033[0m"
|
echo -e "\n\033[1mOpen wp-admin/ page in browser...\033[0m"
|
||||||
wp admin --path=$path
|
wp admin --path=$rep_wordpress
|
||||||
elif [ "$admin" = true ]; then
|
elif [ "$admin" = true ]; then
|
||||||
wp package install wp-cli/admin-command
|
wp package install wp-cli/admin-command
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\n\033[1mOpen wp-admin/ page in browser...\033[0m"
|
echo -e "\n\033[1mOpen wp-admin/ page in browser...\033[0m"
|
||||||
wp admin --path=$path
|
wp admin --path=$rep_wordpress
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user