Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] Spellfoster

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Ismael Luceno <ismael.luceno AT gmail.com>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] Spellfoster
  • Date: Fri, 11 Apr 2008 01:30:14 -0300

El Thu, 10 Apr 2008 10:36:02 +0200
Jaka Kranjc <smgl AT lynxlynx.info> escribió:

> On Thursday 10 of April 2008 04:30:42 Ismael Luceno wrote:
> > New version :).
> "sustained" is not a status like installed, held or exiled. This is
> an additional property and you can find the list of spells
> in /var/lib/sorcery/sustained .
>
> LP

Fixed, thanks :).

BTW, about the feature request...

Once you have selected something it's added to the list, so I still
can't figure out how having an extra list could be useful...

--
Ismael Luceno
#!/bin/bash
KEEPFILE=/var/lib/spellfoster/keep

. /etc/sorcery/config

get_new_orphans() {
local each

compute_reverse_installed_depends my_hash
{
get_all_spells_with_status 'installed'
get_all_spells_with_status 'held'
} | while read each; do
if [ -z "`hash_get my_hash $each`" ]; then
grep -q "^$each\$" "$KEEPFILE" ||
echo "$each"
fi
done | sort
}

generate_dialog() {
local spell status

cat << "EOF"
dialog --title Spellfoster --separate-output \
--checklist 'Select spells to keep' 0 0 0 \
EOF
while read spell; do
codex_find_spell_by_name "$spell" > /dev/null &&
codex_set_current_spell_by_name "$spell" && {
#query_spell_status "$spell" status
#[ "$status" = auto-installed ] &&
# status=on || status=off
status=on
echo "$spell \"$SHORT\" $status \\"
}
done
}


if [ "$UID" -gt 0 ]; then
echo 'Enter the root password, please.'
PARAMS=`consolidate_params "$@"`
exec su -c "$0 $PARAMS" root
fi

if [ ! -f "$KEEPFILE" ]; then
libdir="`dirname "$KEEPFILE"`"
[ -d "$libdir" ] || mkdir -p "$libdir"
cat /var/lib/sorcery/sustained > "$KEEPFILE"
unset libdir
fi

TMP="`mktemp`"

while true; do
spells="`get_new_orphans`"
[ -z "$spells" ] && exit

echo "$spells" | generate_dialog >> "$TMP"
. "$TMP" 2>> "$KEEPFILE" || exit

num_spells="`echo "$spells" | wc -w`"
dialog --yesno "Do you really want to dispel the $num_spells
unselected spells?" 0 0 || exit

echo "$spells" | while read spell; do
grep -q "^$spell\$" "$KEEPFILE" ||
dispel "$spell"
done
done
rm -f "$TMP"

Attachment: signature.asc
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page