2013-04-15 10:42 keltezéssel, Wesley Sangster írta:
> Is there a command for sogo-tool to insert the values into the conf
> file like the defaults write used to?
I'm not sure it's working as well, but try free this bash script to
convert GNUstep defaults (created by defaults write sogod) to
/etc/sogo/sogo.conf format.
This script only reads the XML file and displays the .conf format to the
screen (can be redirect to file).
# sogoconvert.sh ---------------------
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
OLD=`nl -w 1 ~sogo/GNUstep/Defaults/.GNUstepDefaults | sed
"s/^\([0-9]\+\)\t\s*/\1|/"`
MAX=$(echo "$OLD" | tail -1 | cut -d'|' -f1)
HOOK=1
unset HC
unset inarray
for LN in $(seq 1 $MAX); do
LINE=$(echo "$OLD" | egrep "^$LN\|" | cut -d'|' -f2-)
TAG=`echo "$LINE" | sed "s/^<\([^>]\+\)>.*/\1/" | tr A-Z a-z`
VAL=`echo "$LINE" | sed "s/^.*>\([^<]\+\)<.*/\1/"`
case "$TAG" in
"dict")
echo "$HC{"
HOOK=$(expr $HOOK + 2)
HC=$(echo " " | colrm $HOOK)
unset inarray
;;
"/dict")
echo "$HC}"
HOOK=$(expr $HOOK \- 2)
HC=$(echo " " | colrm $HOOK)
;;
"key")
echo -n "$HC$VAL = "
;;
"array")
echo -e "("
inarray=1
;;
"/array")
[ "$inarray" ] && echo
echo "$HC);"
unset inarray
;;
"string")
if [ -z "$inarray" ]; then
echo "$VAL;"
elif [ $inarray -eq 1 ]; then
echo -n "$HC $VAL"
inarray=2
else
echo -ne ",\n$HC $VAL"
fi
;;
esac
done
echo "}"
# End of script
Maybe some lines can be remove from the output. Could someone try it?
Thanks,
Peti
--
[email protected]
https://inverse.ca/sogo/lists