sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (0f0b04d24609c86967ca4df497b76937978a2a7b)
- From: Jaka Kranjc <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (0f0b04d24609c86967ca4df497b76937978a2a7b)
- Date: Wed, 26 Mar 2008 15:06:52 -0500
GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:
ChangeLog | 10 ++++++
etc/sorcery/config | 1
uninstall | 2 +
usr/sbin/cleanse | 6 +--
usr/sbin/dispel | 9 +++--
var/lib/sorcery/modules/dl_handlers/dl_wget | 3 -
var/lib/sorcery/modules/libdepends | 16 ++++++----
var/lib/sorcery/modules/libdepengine | 26 +++++++++++-----
var/lib/sorcery/modules/libhash | 22 +++++++------
var/lib/sorcery/modules/liblock | 10 +++---
var/lib/sorcery/modules/libmisc | 41
++++++++++++--------------
var/lib/sorcery/modules/libsecurity | 24 +++++++--------
var/lib/sorcery/modules/libstate | 8 +++--
var/lib/sorcery/modules/liburl | 4 +-
var/lib/sorcery/modules/url_handlers/url_http | 2 -
15 files changed, 107 insertions(+), 77 deletions(-)
New commits:
commit 0f0b04d24609c86967ca4df497b76937978a2a7b
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
config: revert the recent addition of STAGED_INSTALL, so
is_castfs_installed gets a chance to be run
commit 17e26eecdf3559d33e060949aa5513b347a13056
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
dispel, libstate: use hash_get_ref some more
commit 96e5ba2a721c16da3f4f87f2a7fa3fa90e8dbde4
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
cleanse: cleanse_fix_ldd_check: use hash_get_ref, don't do the lookup
twice and trick wc
commit c201b8b35dc68fe369c5c6adf7dd7234349347cc
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
libmisc: fixed esc_str not escaping strings starting with .
commit f3c0a7620f15b2c9ee80f392b6de91e4d214f6cc
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
dl_wget, liburl, url_http: use real_list_find instead of echo | grep -q
commit 3fc499cac78e126af8c1a9490ea7e55019e3b0e9
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
applied a modified patch from Arvid Norlander, which mainly changes uses
of hash_get to has_get_ref, removes double evaluations and improves
some
formatting
diff --git a/ChangeLog b/ChangeLog
index 6fb5903..232b2b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,16 @@
use real_list_find everywhere else
fixed real_show_up_depends showing false positives
* libcodex: silence the unused codex_remove_duplicates with
real_list_find
+ * applied a modified patch from Arvid Norlander, which mainly changes
uses
+ of hash_get to has_get_ref, removes double evaluations and improves
some
+ formatting
+ * dl_wget, liburl, url_http: use real_list_find instead of echo |
grep -q
+ * libmisc: fixed esc_str not escaping strings starting with .
+ * cleanse: cleanse_fix_ldd_check: use hash_get_ref, don't do the
lookup
+ twice and trick wc
+ * dispel, libstate: use hash_get_ref some more
+ * config: revert the recent addition of STAGED_INSTALL, so
+ is_castfs_installed gets a chance to be run
2008-03-25 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libsorcery: reformatted the files, directories and symlinks
functions and
diff --git a/etc/sorcery/config b/etc/sorcery/config
index 67f0a6d..6af7757 100755
--- a/etc/sorcery/config
+++ b/etc/sorcery/config
@@ -33,7 +33,6 @@ shopt -u expand_aliases
UMASK=${UMASK:=0022}
SORCERY_PATH="/usr/sbin"
FORCE_BASESYSTEM_DEPENDS=${FORCE_BASESYSTEM_DEPENDS:-off}
- STAGED_INSTALL=${STAGED_INSTALL:-off}
LDD_CHECK=${LDD_CHECK:=on}
FIND_CHECK=${FIND_CHECK:=on}
diff --git a/uninstall b/uninstall
index 39dc1c5..f8a5b96 100755
--- a/uninstall
+++ b/uninstall
@@ -1,3 +1,5 @@
+#!/bin/bash
+
INSTALL_ROOT=${1:-}
SORCERY_INSTALL_LOG=$INSTALL_ROOT/etc/sorcery/install.log
if ! test -f $SORCERY_INSTALL_LOG ; then
diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index 3e91c3e..a861eeb 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -790,8 +790,8 @@ function cleanse_fix_ldd_check() { (
local tmp
for each in $($REAL_MAKE -s -f $MAKEFILE $1 2>/dev/null); do
- tmp=$(hash_get ldd_hash $each)
- [[ $tmp ]] && LD_LIBRARY_PATH="$(hash_get ldd_hash
$each):${LD_LIBRARY_PATH}"
+ hash_get_ref ldd_hash $each tmp
+ [[ $tmp ]] && LD_LIBRARY_PATH="$tmp:${LD_LIBRARY_PATH}"
done
local TMP_I_LOG=$TMP_DIR/${SPELL}/install.log
@@ -802,7 +802,7 @@ function cleanse_fix_ldd_check() { (
local count size
let count=0
- local size=$(wc -l $TMP_I_LOG | awk '{print $1;}')
+ local size=$(wc -l < $TMP_I_LOG)
export LD_LIBRARY_PATH
while read LINE; do
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 185b9b8..b5007c6 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -527,9 +527,10 @@ function dispel_depends_engine() {
local borkers
# for all borked spells either recast, dispel, or ignore
for parent in $(hash_get_table_fields BORKED_PARENTS) ; do
- message "$parent is borked because of $(hash_get BORKED_PARENTS
$parent)"
+ hash_get_ref BORKED_PARENTS $parent borkers
+ message "$parent is borked because of $borkers"
local recastable=yes
- borkers=$(hash_get BORKED_PARENTS $parent)
+
local non_optional_borkers suggested_borkers runtime_borkers type
# if any of the removed children are required depends of the current
# spell, the spell is not recastable
@@ -584,7 +585,7 @@ function dispel_depends_engine() {
elif dispel_parent_query "Dispel $parent?" \
"$DISPEL_PARENT_DEFAULT" ; then
- foo=$(hash_get down_deps $parent)
+ hash_get_ref down_deps $parent foo
list_remove foo $borkers
hash_put down_deps $parent $foo
@@ -598,7 +599,7 @@ function dispel_depends_engine() {
if dispel_parent_query "Dispel $parent?" \
"$DISPEL_PARENT_DEFAULT"; then
- foo=$(hash_get down_deps $parent)
+ hash_get_ref down_deps $parent foo
list_remove foo $borkers
hash_put down_deps $parent $foo
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_wget
b/var/lib/sorcery/modules/dl_handlers/dl_wget
index 216154a..f906f65 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_wget
+++ b/var/lib/sorcery/modules/dl_handlers/dl_wget
@@ -94,8 +94,7 @@ function dl_wget_set_options() {
# The sourceforge check pre-dates that but is lacking any documentation,
# I suspect it is a less general attempt to solve the same problem.
# (afk 2005-06-25)
- if echo "$URL" | grep -q "\?" ||
- echo "$URL" | grep -q "sourceforge" ; then
+ if real_list_find "$URL" "?" "sourceforge"; then
unset CONTINUE
else CONTINUE="-c"
fi
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 63ca3fe..26ffca9 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -186,7 +186,9 @@ function run_our_sub_depends() {
# if the requester has been processed skip any sub-depends its
# previous instance requested, bug 11865
- [[ $(hash_get "depends_looked_at" "$requester") == done ]] && continue
+ local hash_depends_looked_at
+ hash_get_ref "depends_looked_at" "$requester" hash_depends_looked_at
+ [[ $hash_depends_looked_at == done ]] && continue
process_sub_depends "$requester" "$sub_dependee" "$sub_depends" ||
return 1
done
@@ -207,13 +209,15 @@ function run_other_sub_depends() {
$STD_DEBUG
local this_spell=$1
local SPELL sub_dependee sub_depends pair
+ local sub_dependee_looked_at
# do all sub-depends from sub_dep_f_hash (things we request)
for pair in $(hash_get sub_dep_f_hash $this_spell) ; do
# FIXME, do this one spell at a time, rather than in whatever order we
# see them it will reduce the number of run_details
sub_dependee=${pair%:*}
sub_depends=${pair#*:}
- if [[ $(hash_get depends_looked_at $sub_dependee) == done ]] ; then
+ hash_get_ref depends_looked_at $sub_dependee sub_dependee_looked_at
+ if [[ $sub_dependee_looked_at == done ]]; then
# load the spell and clear out any special variables
SPELL=$sub_dependee
run_details
@@ -251,7 +255,8 @@ function process_sub_depends() {
local rc=0
local THIS_SUB_DEPENDS=$sub_depends
- local PROCESSED_SUB_DEPENDS=$(hash_get processed_sub_depends
$sub_dependee)
+ local PROCESSED_SUB_DEPENDS
+ hash_get_ref processed_sub_depends $sub_dependee PROCESSED_SUB_DEPENDS
run_spell_file SUB_DEPENDS sub_depends || return 1
hash_append processed_sub_depends $sub_dependee $sub_depends
else
@@ -399,7 +404,7 @@ function compute_uninstalled_depends()
# would have to be specified all the time.
for (( _idx=0 ; _idx<${#spells[*]} ; _idx++ )) ; do
- if [[ ! `hash_get depends_looked_at ${spells[$_idx]}` ]]; then
+ if [[ ! $(hash_get depends_looked_at ${spells[$_idx]}) ]]; then
if ! private_run_depends ${spells[$_idx]} ; then
# i dont know if this will work, but it will have to suffice
private_remove_dependees ${spells[$_idx]}
@@ -1377,7 +1382,8 @@ function real_sub_depends() {
#---------------------------------------------------------------------
function real_force_depends() {
debug "libdepends" "$FUNCNAME - $SPELL - $@"
- local check=$(hash_get "depends_looked_at" "$1")
+ local check
+ hash_get_ref "depends_looked_at" "$1" check
message "${SPELL}" "is forcing a recast of" "${1}"
diff --git a/var/lib/sorcery/modules/libdepengine
b/var/lib/sorcery/modules/libdepengine
index 0aa6396..ab7f107 100755
--- a/var/lib/sorcery/modules/libdepengine
+++ b/var/lib/sorcery/modules/libdepengine
@@ -107,10 +107,12 @@ function depengine_cast_engine() {
# when that happens dont execute $spell's triggers
# because it will be re-triggered
local grey_triggerer=0
- for triggerer in $(hash_get trg_r_hash $spell:cast_self); do
+ local hash_triggerers
+ hash_get_ref trg_r_hash $spell:cast_self hash_triggerers
+ for triggerer in $hash_triggerers; do
# note that $spell's status is grey
[[ $triggerer == $spell ]] && continue
- child_status=$(hash_get state_hash $triggerer)
+ hash_get_ref state_hash $triggerer child_status
if [[ $child_status == grey ]] ; then
debug "libdepengine" "$spell has a $child_status triggerer on
$triggerer!"
grey_triggerer=1
@@ -144,14 +146,17 @@ function recurse_depends() {
local spell=$1
local in_trigger=${2:-0}
local rc=0
-
- for child in $(hash_get dep_f_hash $spell); do
+ local hash_childs
+ hash_get_ref dep_f_hash $spell hash_childs
+ for child in $hash_childs; do
# check if any of our dependencies failed while we weren't looking
# if one did, bail out, if MINUS_K is set then skip this and build
# everything we can
if [[ $MINUS_K == no ]] ; then
- for _child in $(hash_get dep_f_hash $spell); do
+ local hash_childs2
+ hash_get_ref dep_f_hash $spell hash_childs2
+ for _child in $hash_childs2; do
case $(dpgn_get_spell_color $_child) in
black:0)
:
@@ -203,7 +208,9 @@ function recurse_depends() {
# catches those cases where we dont, and doesn't worry too much
# about a failure
if [[ $rc == 0 ]] ; then
- for triggerer in $(hash_get trg_r_hash $spell:cast_self); do
+ local hash_triggerers
+ hash_get_ref trg_r_hash $spell:cast_self hash_triggerers
+ for triggerer in $hash_triggerers; do
trgrr_status=$(dpgn_get_spell_color $triggerer)
if [[ "$trgrr_status" == "white" ]] ; then
if list_find "$need_cast_list" $triggerer; then
@@ -275,7 +282,8 @@ function execute_triggers() {
# if there are no white triggerers, we are the last triggerer
local last=1
- local triggerers=$(hash_get trg_r_hash $trg_target:$trg_action)
+ local triggerers
+ hash_get_ref trg_r_hash $trg_target:$trg_action triggerers
for triggerer in $triggerers; do
[[ $triggerer == $spell ]] && continue
if [[ $(dpgn_get_spell_color $triggerer) == white ]] ; then
@@ -370,7 +378,9 @@ function dpgn_register_pending_trigger() {
## determine if a trigger is pending or not
#------------------------------------------------------------------------
function dpgn_is_pending_trigger_registered() {
- [[ $(hash_get pending_triggers $1) == 1 ]]
+ local pending
+ hash_get_ref pending_triggers $1 pending
+ [[ $pending == 1 ]]
}
#------------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libhash b/var/lib/sorcery/modules/libhash
index a757c77..c987acf 100755
--- a/var/lib/sorcery/modules/libhash
+++ b/var/lib/sorcery/modules/libhash
@@ -82,7 +82,7 @@ function hash_build_variable_name() {
if [[ $___FIELD ]] ; then ___FIELD="HASH_${___TABLE}_${___FIELD}_"
else ___FIELD="HASH_${___TABLE}_" ; fi
- eval $3=\"$___FIELD\"
+ eval $3=\"\$___FIELD\"
}
@@ -110,7 +110,7 @@ function hash_unbuild_field_name() {
___FIELD=${___FIELD//_CSB_/]}
___FIELD=${___FIELD//_OSB_/[}
- eval $3=\"$___FIELD\"
+ eval $3=\"\$___FIELD\"
}
@@ -125,7 +125,7 @@ function hash_unbuild_field_name() {
function hash_put() {
local VARIABLE_NAME
hash_build_variable_name "$1" "$2" VARIABLE_NAME
- eval "${VARIABLE_NAME}=\"${3}\""
+ eval "${VARIABLE_NAME}=\"\${3}\""
debug "libhash" "hash_put() - VARIABLE_NAME=$VARIABLE_NAME, data=$3"
}
@@ -178,9 +178,9 @@ function hash_append() {
hash_build_variable_name "$1" "$2" VARIABLE_NAME
old_value=${!VARIABLE_NAME}
if [[ -n $old_value ]] ; then
- eval "${VARIABLE_NAME}=\"$old_value${sep}${3}\""
+ eval "${VARIABLE_NAME}=\"\$old_value\${sep}\${3}\""
else
- eval "${VARIABLE_NAME}=\"$3\""
+ eval "${VARIABLE_NAME}=\"\$3\""
fi
}
@@ -211,7 +211,7 @@ function hash_export() {
function hash_unset() {
local VARIABLE_NAME
hash_build_variable_name "$1" "$2" VARIABLE_NAME
- eval unset ${VARIABLE_NAME}
+ unset ${VARIABLE_NAME}
}
@@ -224,7 +224,7 @@ function hash_unset() {
function hash_reset() {
local TABLE_NAME
hash_build_variable_name "$1" '' TABLE_NAME
- local VARIABLES=`eval 'echo ${!'${TABLE_NAME}'*}'`
+ eval "local VARIABLES=\"\${!${TABLE_NAME}*}\""
unset $VARIABLES
}
@@ -244,7 +244,7 @@ function hash_get_table() {
local VARIABLES i
local separator="$2"
separator=${separator:-$'\n'}
- VARIABLES=`eval 'echo ${!'${TABLE_NAME}'*}'`
+ eval "VARIABLES=\"\${!${TABLE_NAME}*}\""
for i in $VARIABLES; do
echo -n "${!i}${separator}"
@@ -269,7 +269,7 @@ function hash_get_table_fields() {
local VARIABLES i
local separator="$2"
separator=${separator:-$'\n'}
- VARIABLES=`eval 'echo ${!'${TABLE_NAME}'*}'`
+ eval "VARIABLES=\"\${!${TABLE_NAME}*}\""
local FIELD
for i in $VARIABLES ; do
@@ -289,8 +289,10 @@ function hash_get_table_fields() {
function hash_debug_dump() {
local TABLE_NAME
local FIELD
+ local value
for FIELD in $(hash_get_table_fields $1); do
- echo "${FIELD} : $(hash_get $1 ${FIELD})"
+ hash_get_ref $1 $FIELD value
+ echo "$FIELD : $value"
done
}
diff --git a/var/lib/sorcery/modules/liblock b/var/lib/sorcery/modules/liblock
index 70cd4b2..c012281 100755
--- a/var/lib/sorcery/modules/liblock
+++ b/var/lib/sorcery/modules/liblock
@@ -167,7 +167,7 @@ clean_resources()
while read file; do
debug "clean_resources" "removing forgotten lock ${file}"
rm -f "${file}" 2>/dev/null &&
- rmdir `dirname "${file}"` 2>/dev/null
+ rmdir $(smgl_dirname "${file}") 2>/dev/null
done
fi
}
@@ -191,7 +191,7 @@ global_clean_resources()
if [ ! -d "${file}" ]; then
debug "global_clean_resources" "removing stale lock ${file}"
rm -f "${file}" 2>/dev/null &&
- rmdir `dirname "${file}"` 2>/dev/null
+ rmdir $(smgl_dirname "${file}") 2>/dev/null
fi
done
fi
@@ -257,7 +257,7 @@ function lock_start_transaction()
lock_file $LOCK_TRANSACTIONS
[ -s $LOCK_TRANSACTIONS ] || echo "0:::" > $LOCK_TRANSACTIONS
- NUMTRANS=`tail -n 1 $LOCK_TRANSACTIONS | cut -d : -f 1`
+ NUMTRANS=$(tail -n 1 $LOCK_TRANSACTIONS | cut -d : -f 1)
NUMTRANS=${NUMTRANS:-1} # TODO: check if this should fallback to 0
let NUMTRANS++
@@ -345,10 +345,10 @@ function lock_kill_transaction()
lock_file $LOCK_TRANSACTIONS
for i in $* ; do
- TMP_FILE=$(grep `esc_str ".*:$i:$$"` $LOCK_TRANSACTIONS | cut -d : -f 1)
+ TMP_FILE=$(grep $(esc_str ".*:$i:$$") $LOCK_TRANSACTIONS | cut -d : -f 1)
unlock_file $i
cp $LOCK_TRANSACTIONS $LOCK_TRANSACTIONS.1
- grep -v `esc_str ".*:$i:$$"` $LOCK_TRANSACTIONS.1 >$LOCK_TRANSACTIONS
+ grep -v $(esc_str ".*:$i:$$") $LOCK_TRANSACTIONS.1 >$LOCK_TRANSACTIONS
done
unlock_file $LOCK_TRANSACTIONS
}
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 9c526a7..3c6dc99 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -30,7 +30,7 @@ function explode()
local result=${l%%$2*}
l=${l#"$result"}
l=${l#$2}
- eval "$3[$i]=\"$result\""
+ eval "$3[$i]=\"\$result\""
((i++))
done
# this adds an empty array element at the end if the line ended in $2
@@ -160,7 +160,7 @@ function real_query_string () {
[ -z "$RESPONSE" ] && RETURN=1 && RESPONSE="$3"
- eval $1=\"${RESPONSE}\"
+ eval $1=\"\${RESPONSE}\"
return $RETURN
}
@@ -260,15 +260,15 @@ debug "libmisc" "progress_bar - $*"
# Can't make a bar because there's no total, or the length isn't
# long enough, or if there is no length
- if [ $# -lt 2 ] || [ $len -lt 8 ] ; then
+ if [[ $# -lt 2 ]] || [[ $len -lt 8 ]]; then
message -n "."
return 0
fi
- if [ $1 -lt 1 ] || [ $2 -lt 1 ] ; then return 1 ; fi
+ if [[ $1 -lt 1 ]] || [[ $2 -lt 1 ]]; then return 1; fi
percent=$((100*$1/$2))
- percent=`printf "%.0f" $percent`
+ percent=$(printf "%.0f" $percent)
if [[ $LAST_PERCENT == $percent ]] ; then
progress_spinner
@@ -379,13 +379,12 @@ function esc_str()
{
local OUT
- if [[ $* == .* ]] ; then
- OUT="$1"
+ if [[ $* == ".*" ]] ; then
+ echo "$1"
else
- OUT=`echo "$@" | sed -e 's:\.:\\\.:'g \
- -e 's:\*:\\\*:'g`
+ echo "$@" | sed -e 's:\.:\\\.:'g \
+ -e 's:\*:\\\*:'g
fi
- echo "$OUT"
}
@@ -459,7 +458,7 @@ function iterate()
{ # $1=callback+args, $2=separator, $3=(opt)string
# debug "libmisc" "iterate - $@"
- [ $# -lt 2 ] && return 2
+ [[ $# -lt 2 ]] && return 2
local oldIFS="$IFS"
local token
@@ -471,14 +470,14 @@ function iterate()
for token in $* ; do
IFS="$oldIFS"
- eval "$func \"$token\""
+ eval "$func \"\$token\""
[[ $BREAK ]] && break
done
IFS="$oldIFS"
else
while read -r -d "$2" token ; do
- eval "$func \"$token\""
+ eval "$func \"\$token\""
[[ $BREAK ]] && break
done
# debug "leftover token: $token"
@@ -547,10 +546,10 @@ function select_list_sub() {
message -n "$msgstr"
read -t $PROMPT_DELAY -n 1 _answer
[[ "$_answer" ]] || _answer=$_default
- _result="$(hash_get $hashname $_answer)"
+ hash_get_ref $hashname $_answer _result
done
echo
- eval $returnvar=\"$_result\"
+ eval $returnvar=\"\$_result\"
}
#---------------------------------------------------------------------
@@ -562,7 +561,7 @@ function select_list_sub() {
#---------------------------------------------------------------------
function set_term_title()
{
- if [ "$SET_TERM_TITLE" != "on" ]; then return; fi
+ if [[ $SET_TERM_TITLE != on ]]; then return; fi
case $TERM in
xterm*|rxvt*) echo -ne "\e]0;$@\007"
;;
@@ -612,7 +611,7 @@ function real_list_add () {
for i in $@; do
local found=0
function list_add_sub() {
- if [ "$i" == "$1" ]; then
+ if [[ $i == $1 ]]; then
found=1
fi
}
@@ -725,10 +724,10 @@ function real_persistent_load () {
local PERSISTENT_LOADING=yes
local PERSISTENT_FILE=${1:-$SPELL_CONFIG.p}
lock_file "$PERSISTENT_FILE"
- if [ -f "$PERSISTENT_FILE" ]; then
+ if [[ -f $PERSISTENT_FILE ]]; then
. "$PERSISTENT_FILE"
local line
- persistent_add `while read line; do echo ${line%%=*}; done <
"$PERSISTENT_FILE"`
+ persistent_add $(while read line; do echo ${line%%=*}; done <
"$PERSISTENT_FILE")
fi
unlock_file "$PERSISTENT_FILE"
}
@@ -1065,7 +1064,7 @@ function get_spell_files() {
#---------------------------------------------------------------------
function misc_is_function() {
local FUNCTION_NAME=$1
- [ "`type -t $FUNCTION_NAME`" = "function" ]
+ [[ "$(type -t $FUNCTION_NAME)" == "function" ]]
}
@@ -1137,7 +1136,7 @@ function mk_tmp_dirs() {
fi
- if [ -e $FULL_DIR ] ; then
+ if [[ -e $FULL_DIR ]]; then
message "Looks like you had an old $SCRIPT_NAME on PID $$. Cleaning it
out..." >&2
rm -rf $FULL_DIR
fi
diff --git a/var/lib/sorcery/modules/libsecurity
b/var/lib/sorcery/modules/libsecurity
index 92201e2..f6a4e49 100755
--- a/var/lib/sorcery/modules/libsecurity
+++ b/var/lib/sorcery/modules/libsecurity
@@ -36,8 +36,8 @@ function gaze_checkmd5 () {
fi
tMD5=${MD5[$MD5num]}
- GRIMOIRE=`echo $i | sed -e 's/\/[^\/]*\/[^\/]*\/DETAILS//' -e 's/\/.*\///'`
- SECTION=`echo $i | sed -e 's/\/[^\/]*\/DETAILS//' -e 's/\/.*\///'`
+ GRIMOIRE=$(echo $i | sed -e 's/\/[^\/]*\/[^\/]*\/DETAILS//' -e
's/\/.*\///')
+ SECTION=$(echo $i | sed -e 's/\/[^\/]*\/DETAILS//' -e 's/\/.*\///')
if test "$SECTION" == "$SPELL" || test "$SECTION" == "DETAILS"
then
echo -en "${SPELL_COLOR}$SPELL${DEFAULT_COLOR} "
@@ -53,12 +53,12 @@ function gaze_checkmd5 () {
APPEND=
else
OLDESTSOURCE="$SOURCE"
- OLDSOURCE="`echo $SOURCE | sed -e 's/\./\\\./g'`"
- SOURCE="`echo $SOURCE | sed -e 's/\.[bt].*/\./'`"
- SOURCE="`ls $SOURCE_CACHE/$SOURCE* 2> /dev/null | cut -d'/' -f 5 |
head -n 1`"
+ OLDSOURCE="$(echo $SOURCE | sed -e 's/\./\\\./g')"
+ SOURCE="$(echo $SOURCE | sed -e 's/\.[bt].*/\./')"
+ SOURCE="$(ls $SOURCE_CACHE/$SOURCE* 2> /dev/null | cut -d'/' -f 5 |
head -n 1)"
if [ "$SOURCE" ]
then
- if [ -z "`echo ${SOURCE#$OLDSOURCE.} | egrep '^[0-9]{14}$'`" ]
+ if [[ -z $(echo ${SOURCE#$OLDSOURCE.} | egrep '^[0-9]{14}$') ]]
then
APPEND="FUZZ s/$OLDSOURCE/$SOURCE/ "
else
@@ -72,12 +72,12 @@ function gaze_checkmd5 () {
fi
if test -z "$PRECACHEDF"
then
- if test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'gzip' &&
- test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'bzip2' &&
- test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'compress'"'"'d' &&
- test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'Zip' &&
- test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'RPM' &&
- test `guess_compressor $SOURCE_CACHE/$SOURCE` != 'tar'
+ if test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'gzip' &&
+ test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'bzip2' &&
+ test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'compress'"'"'d'
&&
+ test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'Zip' &&
+ test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'RPM' &&
+ test $(guess_compressor $SOURCE_CACHE/$SOURCE) != 'tar'
then
fMD5=`cat $SOURCE_CACHE/$SOURCE 2> /dev/null | md5sum | cut -d' '
-f1 | head -n 1`
else
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index 0b6057a..dc0c658 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -237,7 +237,9 @@ function remove_depends_status()
#---------------------------------------------------------------------
function get_uncommitted_depends_file() {
local SPELL=$1
- local temp_spell_depends=$(hash_get "uncommitted_hash" $SPELL)
+ local temp_spell_depends
+ hash_get_ref "uncommitted_hash" $SPELL temp_spell_depends
+
if ! [[ $temp_spell_depends ]] ; then
temp_spell_depends="$UNCOMMITTED_DEPENDS/$SPELL"
hash_put "uncommitted_hash" "$SPELL" "$temp_spell_depends"
@@ -702,7 +704,7 @@ function real_get_spell_provider() {
if [[ $3 ]] ; then
dep_status=$DEPENDS_STATUS
else
- dep_status=$(hash_get uncommitted_hash $1)
+ hash_get_ref uncommitted_hash $1 dep_status
[[ $dep_status ]] || dep_status=$DEPENDS_STATUS
fi
search_depends_status_exact $dep_status "$1" ".*($2)" \
@@ -723,7 +725,7 @@ function real_is_depends_enabled() {
if [[ $3 ]] ; then
dep_status=$DEPENDS_STATUS
else
- dep_status=$(hash_get uncommitted_hash $1)
+ hash_get_ref uncommitted_hash $1 dep_status
[[ $dep_status ]] || dep_status=$DEPENDS_STATUS
fi
[[ -n $(search_depends_status_simple $dep_status "$1" "$2" 'on' ) ]]
diff --git a/var/lib/sorcery/modules/liburl b/var/lib/sorcery/modules/liburl
index 7b6199d..f9e993f 100755
--- a/var/lib/sorcery/modules/liburl
+++ b/var/lib/sorcery/modules/liburl
@@ -298,7 +298,7 @@ function url_rank() {
iterate url_rank_divide_by_prefix " $IFS" $urlList
for tmp_prefix in $(hash_get_table_fields url_div_hash) ; do
- tmp_list=$(hash_get url_div_hash $tmp_prefix)
+ hash_get_ref url_div_hash $tmp_prefix tmp_list
debug liburl "urls are $tmp_list"
# the awk command turns netselect output like this:
# 69 url1
@@ -329,7 +329,7 @@ function url_rank() {
# try really hard not to lose urls by appending missing ones to the end
# of the list, please tell me if theres a faster way to do this
function url_rank_iterator2() {
- echo $sortedList|grep -q "$1" || sortedList="$sortedList $1"
+ real_list_find "$sortedList" "$1" || sortedList="$sortedList $1"
}
iterate url_rank_iterator2 " $IFS" $urlList
diff --git a/var/lib/sorcery/modules/url_handlers/url_http
b/var/lib/sorcery/modules/url_handlers/url_http
index ff6381d..589180c 100755
--- a/var/lib/sorcery/modules/url_handlers/url_http
+++ b/var/lib/sorcery/modules/url_handlers/url_http
@@ -96,7 +96,7 @@ function url_ftp_verify() {
local DIRECTORY=`dirname $URL`
local OUTPUT=`wget --passive-ftp -t 1 -T 30 -O - --spider -S
"$DIRECTORY/" 2>&1`
- if echo $OUTPUT | grep -q " $FILENAME "; then
+ if real_list_find "$OUTPUT" "$FILENAME"; then
rm -f .listing
else
echo $OUTPUT | sed 's/LIST.*//g'
- [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (0f0b04d24609c86967ca4df497b76937978a2a7b), Jaka Kranjc, 03/26/2008
Archive powered by MHonArc 2.6.24.