maj des inclusions
This commit is contained in:
parent
fcf60b2bca
commit
f200c7ec66
|
@ -108,6 +108,12 @@ function nef() {
|
||||||
"$@" | sed '/^$/d'
|
"$@" | sed '/^$/d'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tolower() {
|
||||||
|
echo ${*,,}
|
||||||
|
}
|
||||||
|
function toupper() {
|
||||||
|
echo ${*^^}
|
||||||
|
}
|
||||||
function isnum() {
|
function isnum() {
|
||||||
[ ${#1} -gt 0 ] || return 1
|
[ ${#1} -gt 0 ] || return 1
|
||||||
local v="$1"
|
local v="$1"
|
||||||
|
@ -1644,9 +1650,9 @@ function array_deli(dest, i, l) {
|
||||||
}
|
}
|
||||||
delete dest[l]
|
delete dest[l]
|
||||||
}
|
}
|
||||||
function array_del(dest, value, i) {
|
function array_del(dest, value, ignoreCase, i) {
|
||||||
do {
|
do {
|
||||||
i = key_index(value, dest)
|
i = key_index(value, dest, ignoreCase)
|
||||||
if (i != 0) array_deli(dest, i)
|
if (i != 0) array_deli(dest, i)
|
||||||
} while (i != 0)
|
} while (i != 0)
|
||||||
}
|
}
|
||||||
|
@ -2273,8 +2279,7 @@ function __po_process_options() {
|
||||||
function __genparse_shortopt() {
|
function __genparse_shortopt() {
|
||||||
local LC_COLLATE=C
|
local LC_COLLATE=C
|
||||||
local shortopt="${1//[^A-Z]}"
|
local shortopt="${1//[^A-Z]}"
|
||||||
shortopt="${shortopt:0:1}"
|
shortopt="$(tolower "${shortopt:0:1}")"
|
||||||
shortopt="${shortopt,,}"
|
|
||||||
[ -n "$shortopt" ] && echo "$shortopt"
|
[ -n "$shortopt" ] && echo "$shortopt"
|
||||||
}
|
}
|
||||||
HELP_DESC=
|
HELP_DESC=
|
||||||
|
@ -2289,7 +2294,7 @@ function genparse() {
|
||||||
if [[ "$var" == *=* ]]; then
|
if [[ "$var" == *=* ]]; then
|
||||||
splitvar "$var" name value
|
splitvar "$var" name value
|
||||||
shortopt="$(__genparse_shortopt "$name")"
|
shortopt="$(__genparse_shortopt "$name")"
|
||||||
option="${name,,}"
|
option="$(tolower "$name")"
|
||||||
name="${option//-/_}"
|
name="${option//-/_}"
|
||||||
array_add names "$name"
|
array_add names "$name"
|
||||||
array_add descs "${shortopt:+-$shortopt, }--$option VALUE"
|
array_add descs "${shortopt:+-$shortopt, }--$option VALUE"
|
||||||
|
@ -2298,7 +2303,7 @@ function genparse() {
|
||||||
else
|
else
|
||||||
name="$var"
|
name="$var"
|
||||||
shortopt="$(__genparse_shortopt "$name")"
|
shortopt="$(__genparse_shortopt "$name")"
|
||||||
option="${name,,}"
|
option="$(tolower "$name")"
|
||||||
name="${option//-/_}"
|
name="${option//-/_}"
|
||||||
array_add names "$name"
|
array_add names "$name"
|
||||||
array_add descs "${shortopt:+-$shortopt, }--$option"
|
array_add descs "${shortopt:+-$shortopt, }--$option"
|
||||||
|
@ -3594,6 +3599,22 @@ if check_sysinfos -s macosx; then
|
||||||
function _nl2crlf() { _nl2lf | awk '{ print $0 "\r" }'; }
|
function _nl2crlf() { _nl2lf | awk '{ print $0 "\r" }'; }
|
||||||
function _nl2cr() { _nl2lf | awk 'BEGIN { ORS="" } { print $0 "\r" }'; }
|
function _nl2cr() { _nl2lf | awk 'BEGIN { ORS="" } { print $0 "\r" }'; }
|
||||||
function sedi() { sed -i '' "$@"; }
|
function sedi() { sed -i '' "$@"; }
|
||||||
|
function tolower() { tr A-Z a-z <<<"$*"; }
|
||||||
|
function toupper() { tr a-z A-Z <<<"$*"; }
|
||||||
|
function is_yes() {
|
||||||
|
case "$(tolower "$1")" in
|
||||||
|
o|oui|y|yes|v|vrai|t|true|on) return 0;;
|
||||||
|
esac
|
||||||
|
isnum "$1" && [ "$1" -ne 0 ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function is_no() {
|
||||||
|
case "$(tolower "$1")" in
|
||||||
|
n|non|no|f|faux|false|off) return 0;;
|
||||||
|
esac
|
||||||
|
isnum "$1" && [ "$1" -eq 0 ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function __po_check_options() {
|
function __po_check_options() {
|
||||||
local -a options args
|
local -a options args
|
||||||
|
|
125
ucrontab
125
ucrontab
|
@ -196,6 +196,12 @@ function nef() {
|
||||||
"$@" | sed '/^$/d'
|
"$@" | sed '/^$/d'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tolower() {
|
||||||
|
echo ${*,,}
|
||||||
|
}
|
||||||
|
function toupper() {
|
||||||
|
echo ${*^^}
|
||||||
|
}
|
||||||
function isnum() {
|
function isnum() {
|
||||||
[ ${#1} -gt 0 ] || return 1
|
[ ${#1} -gt 0 ] || return 1
|
||||||
local v="$1"
|
local v="$1"
|
||||||
|
@ -1732,9 +1738,9 @@ function array_deli(dest, i, l) {
|
||||||
}
|
}
|
||||||
delete dest[l]
|
delete dest[l]
|
||||||
}
|
}
|
||||||
function array_del(dest, value, i) {
|
function array_del(dest, value, ignoreCase, i) {
|
||||||
do {
|
do {
|
||||||
i = key_index(value, dest)
|
i = key_index(value, dest, ignoreCase)
|
||||||
if (i != 0) array_deli(dest, i)
|
if (i != 0) array_deli(dest, i)
|
||||||
} while (i != 0)
|
} while (i != 0)
|
||||||
}
|
}
|
||||||
|
@ -2361,8 +2367,7 @@ function __po_process_options() {
|
||||||
function __genparse_shortopt() {
|
function __genparse_shortopt() {
|
||||||
local LC_COLLATE=C
|
local LC_COLLATE=C
|
||||||
local shortopt="${1//[^A-Z]}"
|
local shortopt="${1//[^A-Z]}"
|
||||||
shortopt="${shortopt:0:1}"
|
shortopt="$(tolower "${shortopt:0:1}")"
|
||||||
shortopt="${shortopt,,}"
|
|
||||||
[ -n "$shortopt" ] && echo "$shortopt"
|
[ -n "$shortopt" ] && echo "$shortopt"
|
||||||
}
|
}
|
||||||
HELP_DESC=
|
HELP_DESC=
|
||||||
|
@ -2377,7 +2382,7 @@ function genparse() {
|
||||||
if [[ "$var" == *=* ]]; then
|
if [[ "$var" == *=* ]]; then
|
||||||
splitvar "$var" name value
|
splitvar "$var" name value
|
||||||
shortopt="$(__genparse_shortopt "$name")"
|
shortopt="$(__genparse_shortopt "$name")"
|
||||||
option="${name,,}"
|
option="$(tolower "$name")"
|
||||||
name="${option//-/_}"
|
name="${option//-/_}"
|
||||||
array_add names "$name"
|
array_add names "$name"
|
||||||
array_add descs "${shortopt:+-$shortopt, }--$option VALUE"
|
array_add descs "${shortopt:+-$shortopt, }--$option VALUE"
|
||||||
|
@ -2386,7 +2391,7 @@ function genparse() {
|
||||||
else
|
else
|
||||||
name="$var"
|
name="$var"
|
||||||
shortopt="$(__genparse_shortopt "$name")"
|
shortopt="$(__genparse_shortopt "$name")"
|
||||||
option="${name,,}"
|
option="$(tolower "$name")"
|
||||||
name="${option//-/_}"
|
name="${option//-/_}"
|
||||||
array_add names "$name"
|
array_add names "$name"
|
||||||
array_add descs "${shortopt:+-$shortopt, }--$option"
|
array_add descs "${shortopt:+-$shortopt, }--$option"
|
||||||
|
@ -3882,6 +3887,22 @@ if check_sysinfos -s macosx; then
|
||||||
function _nl2crlf() { _nl2lf | awk '{ print $0 "\r" }'; }
|
function _nl2crlf() { _nl2lf | awk '{ print $0 "\r" }'; }
|
||||||
function _nl2cr() { _nl2lf | awk 'BEGIN { ORS="" } { print $0 "\r" }'; }
|
function _nl2cr() { _nl2lf | awk 'BEGIN { ORS="" } { print $0 "\r" }'; }
|
||||||
function sedi() { sed -i '' "$@"; }
|
function sedi() { sed -i '' "$@"; }
|
||||||
|
function tolower() { tr A-Z a-z <<<"$*"; }
|
||||||
|
function toupper() { tr a-z A-Z <<<"$*"; }
|
||||||
|
function is_yes() {
|
||||||
|
case "$(tolower "$1")" in
|
||||||
|
o|oui|y|yes|v|vrai|t|true|on) return 0;;
|
||||||
|
esac
|
||||||
|
isnum "$1" && [ "$1" -ne 0 ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function is_no() {
|
||||||
|
case "$(tolower "$1")" in
|
||||||
|
n|non|no|f|faux|false|off) return 0;;
|
||||||
|
esac
|
||||||
|
isnum "$1" && [ "$1" -eq 0 ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function __po_check_options() {
|
function __po_check_options() {
|
||||||
local -a options args
|
local -a options args
|
||||||
|
@ -4269,11 +4290,16 @@ function enable_in_crontab() {
|
||||||
function ctnow() {
|
function ctnow() {
|
||||||
date +"%-M %-H %-d %-m %u"
|
date +"%-M %-H %-d %-m %u"
|
||||||
}
|
}
|
||||||
|
__CTRESOLVE_CTNOW=""
|
||||||
function ctresolve() {
|
function ctresolve() {
|
||||||
local -a ctnow
|
local -a ctnow
|
||||||
eval "ctnow=($(ctnow))"
|
if [ -n "$__CTRESOLVE_CTNOW" ]; then
|
||||||
|
eval "ctnow=($__CTRESOLVE_CTNOW)"
|
||||||
|
else
|
||||||
|
eval "ctnow=($(ctnow))"
|
||||||
|
fi
|
||||||
filter_conf | awkrun -f ctnow[@] '
|
filter_conf | awkrun -f ctnow[@] '
|
||||||
function ctmatch(ctval, ref, parts, part, i, j, start, end, step, ok) {
|
function ctmatch_one(ctval, ref, parts, part, i, j, start, end, step, ok) {
|
||||||
ok = 0
|
ok = 0
|
||||||
split(ctval, parts, /,/)
|
split(ctval, parts, /,/)
|
||||||
for(i = 1; i <= length(parts); i++) {
|
for(i = 1; i <= length(parts); i++) {
|
||||||
|
@ -4302,17 +4328,41 @@ function ctmatch(ctval, ref, parts, part, i, j, start, end, step, o
|
||||||
}
|
}
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, domok, monok, dowok) {
|
||||||
|
gsub(/\*/, "0-59", M)
|
||||||
|
Mok = ctmatch_one(M, refM)
|
||||||
|
|
||||||
|
gsub(/\*/, "0-23", H)
|
||||||
|
Hok = ctmatch_one(H, refH)
|
||||||
|
|
||||||
|
gsub(/\*/, "1-31", dom)
|
||||||
|
domok = ctmatch_one(dom, refdom)
|
||||||
|
|
||||||
|
gsub(/\*/, "1-12", mon)
|
||||||
|
monok = ctmatch_one(mon, refmon)
|
||||||
|
|
||||||
|
gsub(/\*/, "1-7", dow)
|
||||||
|
dowok = ctmatch_one(dow, refdow)
|
||||||
|
|
||||||
|
return Mok && Hok && monok && (domok || dowok)
|
||||||
|
}
|
||||||
|
function print_cmd(cmd) {
|
||||||
|
print "__ctexec " quote_value(cmd)
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
refM = ctnow[1]; refH = ctnow[2]; refdom = ctnow[3]; refmon = ctnow[4]; refdow = ctnow[5]
|
refM = ctnow[1]; refH = ctnow[2]; refdom = ctnow[3]; refmon = ctnow[4]; refdow = ctnow[5]
|
||||||
ctref = refM " " refH " " refdom " " refmon " " refdow
|
ctref = refM " " refH " " refdom " " refmon " " refdow
|
||||||
print "##now: " ctref
|
print "## now: " ctref
|
||||||
|
|
||||||
match_ctline = 0
|
ctline_run = 0
|
||||||
|
ctline_run_one_match = 0
|
||||||
match_indented = 0
|
match_indented = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*[-+%#?]=/ {
|
/^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*[-+%#?]=/ {
|
||||||
|
ctline_run = 0; ctline_run_one_match = 0; match_indented = 0
|
||||||
|
|
||||||
match($0, /^(export[ \t]+)?([a-zA-Z_][a-zA-Z0-9_]*)([-+%#?])=(.*)$/, parts)
|
match($0, /^(export[ \t]+)?([a-zA-Z_][a-zA-Z0-9_]*)([-+%#?])=(.*)$/, parts)
|
||||||
name = parts[2]
|
name = parts[2]
|
||||||
type = parts[3]
|
type = parts[3]
|
||||||
|
@ -4330,11 +4380,15 @@ BEGIN {
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
/^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*=/ {
|
/^(export[ \t]+)?[a-zA-Z_][a-zA-Z0-9_]*=/ {
|
||||||
|
ctline_run = 0; ctline_run_one_match = 0; match_indented = 0
|
||||||
|
|
||||||
sub(/^export[ \t]+/, "", $0)
|
sub(/^export[ \t]+/, "", $0)
|
||||||
print "export " $0
|
print "export " $0
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
/^\$.+/ {
|
/^\$.+/ {
|
||||||
|
ctline_run = 0; ctline_run_one_match = 0; match_indented = 0
|
||||||
|
|
||||||
if ($0 ~ /^\$\{([ \t]*(#.*)?)?$/) {
|
if ($0 ~ /^\$\{([ \t]*(#.*)?)?$/) {
|
||||||
getline
|
getline
|
||||||
while ($0 !~ /^\$\}([ \t]*(#.*)?)?$/) {
|
while ($0 !~ /^\$\}([ \t]*(#.*)?)?$/) {
|
||||||
|
@ -4347,45 +4401,50 @@ BEGIN {
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
/^[ \t]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+/ {
|
|
||||||
M = $1; H = $2; dom = $3; mon = $4; dow = $5
|
|
||||||
sub(/^[ ]*[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]*/, "", $0)
|
|
||||||
|
|
||||||
if (!match_ctline) match_indented = 0
|
/^[ \t]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+[ ]*[-0-9/*,]+/ {
|
||||||
|
match_indented = 0
|
||||||
|
|
||||||
|
M = $1; H = $2; dom = $3; mon = $4; dow = $5
|
||||||
ctline = M " " H " " dom " " mon " " dow
|
ctline = M " " H " " dom " " mon " " dow
|
||||||
|
|
||||||
gsub(/\*/, "0-59", M)
|
sub(/^[ \t]*[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]*/, "", $0)
|
||||||
Mok = ctmatch(M, refM)
|
cmd = $0
|
||||||
|
|
||||||
gsub(/\*/, "0-23", H)
|
match_cur = ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow)
|
||||||
Hok = ctmatch(H, refH)
|
if (match_cur) print "## match: " ctline
|
||||||
|
|
||||||
gsub(/\*/, "1-31", dom)
|
if (cmd == "") {
|
||||||
domok = ctmatch(dom, refdom)
|
ctline_run = 1
|
||||||
|
if (match_cur) ctline_run_one_match = 1
|
||||||
|
if (ctline_run_one_match) match_indented = 1
|
||||||
|
|
||||||
gsub(/\*/, "1-12", mon)
|
} else {
|
||||||
monok = ctmatch(mon, refmon)
|
if (ctline_run && match_cur) ctline_run_one_match = 1
|
||||||
|
if (ctline_run && ctline_run_one_match) {
|
||||||
|
print_cmd(cmd)
|
||||||
|
match_indented = 1
|
||||||
|
}
|
||||||
|
|
||||||
gsub(/\*/, "1-7", dow)
|
if (!ctline_run && match_cur) {
|
||||||
dowok = ctmatch(dow, refdow)
|
print_cmd(cmd)
|
||||||
|
match_indented = 1
|
||||||
|
}
|
||||||
|
|
||||||
if (Mok && Hok && monok && (domok || dowok)) {
|
ctline_run = 0
|
||||||
print "##matches: " ctline
|
ctline_run_one_match = 0
|
||||||
match_ctline = 1
|
|
||||||
match_indented = 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match_ctline && $0 != "") {
|
|
||||||
print "__ctexec " quote_value($0)
|
|
||||||
match_ctline = 0
|
|
||||||
}
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
/^[ \t]+/ {
|
/^[ \t]+/ {
|
||||||
|
ctline_run = 0; ctline_run_one_match = 0
|
||||||
|
|
||||||
if (match_indented) {
|
if (match_indented) {
|
||||||
sub(/^[ \t]+/, "", $0)
|
sub(/^[ \t]+/, "", $0)
|
||||||
print "__ctexec " quote_value($0)
|
print_cmd($0)
|
||||||
}
|
}
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue