[[ $MAX_DEPTH ]] && [[ $DEPTH -ge $MAX_DEPTH ]] && return 1
- grep() {
- local foo
- smgl_which grep foo &&
- $foo "$@"
- }
[[ $FOUND ]] &&
grep -q '^'$name'$' $FOUND &&
found_before=" (see above for tree)"
@@ -2259,7 +2254,7 @@ gaze_time() {
continue
fi
if [[ ${diff% *} == $diff ]]; then
- (( sum += $diff ))
+ (( sum += diff ))
else
(( sum += ${diff% *}, n++ )) # we'll count the error separately
err_sum[n]=${diff#* }
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index c0d8840..5bf07fd 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -241,7 +241,7 @@ codex_add_grimoire() {
touch $GRIMOIRE_LIST
lock_start_transaction "$GRIMOIRE_LIST" tGRIMOIRE_LIST
rm $tGRIMOIRE_LIST
- for ((i=0; i<$GRIMOIRE_COUNT;i++)); do
+ for ((i = 0; i < GRIMOIRE_COUNT; i++)); do
echo GRIMOIRE_DIR[$i]=${GRIMOIRE_DIR[$i]} >> $tGRIMOIRE_LIST
done
lock_commit_transaction $GRIMOIRE_LIST
@@ -345,7 +345,7 @@ codex_set_grimoires() {
done
unset GRIMOIRE_DIR
let GRIMOIRE_COUNT--
- for ((; $GRIMOIRE_COUNT>=0;GRIMOIRE_COUNT--)) ; do
+ for ((; GRIMOIRE_COUNT>=0;GRIMOIRE_COUNT--)) ; do
GRIMOIRE_DIR[$GRIMOIRE_COUNT]=${NEW_GRIMOIRE_DIR[$GRIMOIRE_COUNT]}
done
}
diff --git a/var/lib/sorcery/modules/libdownload
b/var/lib/sorcery/modules/libdownload
index b4b4f07..333d28f 100755
--- a/var/lib/sorcery/modules/libdownload
+++ b/var/lib/sorcery/modules/libdownload
@@ -93,9 +93,7 @@ dl_get_bucket() {
}
dl_command_check() {
- local cmd
- smgl_which $1 cmd
- if ! [[ $cmd ]] || ! test -x $cmd ; then
+ if type "$1" >/dev/null 2>&1; then
message "${PROBLEM_COLOR}${cmd:-$1} is not installed, please cast it..."
\
"${DEFAULT_COLOR}"
return 1
diff --git a/var/lib/sorcery/modules/libgpg b/var/lib/sorcery/modules/libgpg
index aecf3b6..db20c68 100755
--- a/var/lib/sorcery/modules/libgpg
+++ b/var/lib/sorcery/modules/libgpg
@@ -41,10 +41,7 @@ gpg_verify_signature() { # $1 sig $2 file $3 pubring $4
algo var
# always trust and supply our own keyring.
# We provide our own trust for the pubkey validity.
- local GPGPROG
- smgl_which gpg GPGPROG 2> /dev/null
-
- if test -z "$GPGPROG" ; then
+ if type gpg >/dev/null 2>&1; then
message "It appears you do not have gpg (gnupg) in your PATH."
message "${QUERY_COLOR}For full source verification, it is highly" \
"suggested that you cast gnupg\nas soon as possible. This" \
diff --git a/var/lib/sorcery/modules/libgrimoire
b/var/lib/sorcery/modules/libgrimoire
index 01b51f0..bc69995 100755
--- a/var/lib/sorcery/modules/libgrimoire
+++ b/var/lib/sorcery/modules/libgrimoire
@@ -132,9 +132,9 @@ make() {
if [[ "$USE_DISTCC" == on ]] ; then
- let JOBS=$(($make_njobs+$jobs_per_host*$num_hosts))
+ JOBS=$((make_njobs+jobs_per_host*num_hosts))
else
- let JOBS=$make_njobs
+ JOBS=$make_njobs
fi
if [[ $JOBS == 0 ]]; then
diff --git a/var/lib/sorcery/modules/liblock b/var/lib/sorcery/modules/liblock
index 4259fed..22dc02c 100755
--- a/var/lib/sorcery/modules/liblock
+++ b/var/lib/sorcery/modules/liblock
@@ -50,7 +50,7 @@ lock_resources()
while ! trylock_resources "$@";
do
- local SLEEP=$(( ${RANDOM} % ${MAX_SLEEP} ))
+ local SLEEP=$(( RANDOM % MAX_SLEEP ))
debug "lock_resources" "process $$ is sleeping ${SLEEP} seconds"
sleep "${SLEEP}"
done
@@ -112,7 +112,7 @@ excllock_resources()
do
#^^^ look if a lock exists of the given type (ugly code)
global_clean_resources
- local SLEEP=$(( ${RANDOM} % ${MAX_SLEEP} ))
+ local SLEEP=$(( RANDOM % MAX_SLEEP ))
sleep "$SLEEP"
done
#theoretically, someone could create a lock now... tiny race
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 572a2d8..bdd1fa7 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -296,8 +296,8 @@ debug "libmisc" "progress_bar - $*"
LAST_PERCENT=$percent
#Fill the rest of the bar up with blanks
- for (( i++ ; i<$dash_len-1 ; i++ )) ; do
+ for (( i++ ; i < dash_len - 1 ; i++ )) ; do
BAR_STRING="${BAR_STRING} "
done
#Clear the rest of the space
- for (( i+=3+${#percent} ; i<$len ; i++ )) ; do
+ for (( i += 3 + ${#percent} ; i < len ; i++ )) ; do
BAR_STRING="${BAR_STRING} "
done
# real_default_<file> always refers to the level above in the hierarchy.
# (section, grimoire or sorcery).
@@ -82,12 +58,14 @@ EOF
# These two functions run the section/grimoire function and update
# the real_default_<file> function. Ignore this generic declaration,
# it is changed at runtime to private_default_<section|grimoire>_generic.
- eval "function real_default_section_${name}() {
- false
- }"
- eval "function real_default_grimoire_${name}() {
- false
- }"
+ eval "
+ function real_default_section_${name}() {
+ false
+ }
+ function real_default_grimoire_${name}() {
+ false
+ }
+ "
# If there isnt a sorcery default function, declare one as "true".
# Note that, the right thing happens regardless of what order lib files
diff --git a/var/lib/sorcery/modules/libsummon
b/var/lib/sorcery/modules/libsummon
index 3244c3e..69a940d 100755
--- a/var/lib/sorcery/modules/libsummon
+++ b/var/lib/sorcery/modules/libsummon
@@ -367,7 +367,7 @@ download_from_fallback() {
local i idx
local FALL_BACKS
local offset=$[${RANDOM} % $FURLNUM]
- for (( i=0; $i < $FURLNUM; i++ )); do
+ for (( i = 0; i < FURLNUM; i++ )); do
idx=$[($i + $offset) % $FURLNUM]
FALL_BACKS="$FALL_BACKS ${FALLBACK_URL_MIRROR[$idx]}/$target"
done
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index e54d538..b531646 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -388,7 +388,7 @@ tablet_get_path() {
local made
mkdir -p $TABLET_PATH/$SPELL &&
- for (( i=0 ; $i < 20 ; i++ )) ; do
+ for (( i=0 ; i < 20 ; i++ )) ; do
if mkdir $tb_dir > /dev/null; then
made=1
break
@@ -897,7 +897,7 @@ tablet_fix_duplicates() {
return
fi
- for ((i=0;$i<${#tablets[*]}; i++ )) ; do
+ for ((i = 0; i < ${#tablets[*]}; i++ )) ; do
message "Inspecting ${tablets[$i]}"
tablet_is_spell_version_installed $spell ${tablets[$i]} &&
tablet_does_tablet_point_to_itself ${tablets[$i]} ||
diff --git a/var/lib/sorcery/modules/libtime b/var/lib/sorcery/modules/libtime
index 2ffe40e..50755b4 100755
--- a/var/lib/sorcery/modules/libtime
+++ b/var/lib/sorcery/modules/libtime
@@ -171,7 +171,7 @@ compute_weighted_mean() {
if [[ $type == last-cast ]]; then
local weight=10 #make this relative someday?
local i command
- for ((i=1; i < $weight; i++)); do
+ for ((i = 1; i < weight; i++)); do
command="p; $command"
done
{
@@ -284,7 +284,7 @@ pretty_print_time_sub() {
pretty_print_time_error() {
local error=$1
- if (( $error < 60 )); then
+ if (( error < 60 )); then
error=0
else
error=$(pretty_print_time_sub $error)
diff --git a/var/lib/sorcery/modules/libtrack
b/var/lib/sorcery/modules/libtrack
index 6ddf2e2..3460f42 100755
--- a/var/lib/sorcery/modules/libtrack
+++ b/var/lib/sorcery/modules/libtrack
@@ -178,13 +178,12 @@ real_devoke_installwatch() {
is_castfs_installed()
{
- local loc
- if smgl_which castfs loc >/dev/null 2>&1 &&
+ if type castfs >/dev/null 2>&1 &&
(
modprobe fuse > /dev/null 2>&1 ||
grep -q '^nodev[\t\v\f\r ]*fuse$' /proc/filesystems
) &&
- [[ -c /dev/fuse ]]
+ [ -c /dev/fuse ]
then
message "${MESSAGE_COLOR}Staging enabled${DEFAULT_COLOR}"
return 0
[SM-Commit] GIT changes to master sorcery by Ismael Luceno (48a558e751395415d89a800d729491788e781678),
Ismael Luceno, 02/08/2019