Tomotaka SUWA
t-suw****@users*****
2006年 11月 27日 (月) 15:16:28 JST
Index: AquaSKK/Package/scripts/postflight
diff -u AquaSKK/Package/scripts/postflight:1.2 AquaSKK/Package/scripts/postflight:1.2.2.1
--- AquaSKK/Package/scripts/postflight:1.2 Wed Apr 26 22:36:14 2006
+++ AquaSKK/Package/scripts/postflight Mon Nov 27 15:16:28 2006
@@ -10,9 +10,9 @@
chown $USER $ASKK
fi
-###
-### generate new user defaults
-###
+# ======================================================================
+# generate new user defaults
+# ======================================================================
OLD_DOMAIN="org.ccm-software.AquaSKKServer"
NEW_DOMAIN="jp.sourceforge.AquaSKKServer"
@@ -50,37 +50,33 @@
chown $USER $NEW_PLIST
fi
-###
-### generate DictionarySet.plist
-###
+# ======================================================================
+# generate DictionarySet.plist
+# ======================================================================
DIC_PATH=$ASKK/DictionarySet
DIC_PLIST=$DIC_PATH.plist
-# already exists ?
-if [ -f $DIC_PLIST ]; then
- echo $DIC_PLIST already exists.
- exit 0;
-fi
-
-# create initial plist
-cat >$DIC_PLIST<<EOF
+# not exists ?
+if [ ! -f $DIC_PLIST ]; then
+ # create initial plist
+ cat >$DIC_PLIST<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
EOF
-# read old paths
-SUB_PATH=`defaults read $OLD_PATH dic.path.sub`
-MAIN_PATH=`defaults read $OLD_PATH dic.path.main`
-KOTOERI_PATH=`defaults read $OLD_PATH dic.path.kotoeri|sed 's/[,()"]//g'`
-
-# skk dictionary
-if [ -z $SUB_PATH ]; then
- SUB_PATH=~/.skk-jisyo
-fi
-cat >>$DIC_PLIST<<EOF
+ # read old paths
+ SUB_PATH=`defaults read $OLD_PATH dic.path.sub`
+ MAIN_PATH=`defaults read $OLD_PATH dic.path.main`
+ KOTOERI_PATH=`defaults read $OLD_PATH dic.path.kotoeri|sed 's/[,()"]//g'`
+
+ # skk dictionary
+ if [ -z $SUB_PATH ]; then
+ SUB_PATH=~/.skk-jisyo
+ fi
+ cat >>$DIC_PLIST<<EOF
<dict>
<key>active</key>
<true/>
@@ -91,13 +87,14 @@
</dict>
EOF
-if [ -z $MAIN_PATH ]; then
- MAIN_PATH=SKK-JISYO.L
- DICT_TYPE=11
-else
- DICT_TYPE=10
-fi
-cat >>$DIC_PLIST<<EOF
+ if [ -z $MAIN_PATH ]; then
+ MAIN_PATH=SKK-JISYO.L
+ DICT_TYPE=11
+ else
+ DICT_TYPE=10
+ fi
+
+ cat >>$DIC_PLIST<<EOF
<dict>
<key>active</key>
<true/>
@@ -108,9 +105,9 @@
</dict>
EOF
-# kotoeri dictionary
-for path in $KOTOERI_PATH; do
-cat >>$DIC_PLIST<<EOF
+ # kotoeri dictionary
+ for path in $KOTOERI_PATH; do
+ cat >>$DIC_PLIST<<EOF
<dict>
<key>active</key>
<true/>
@@ -120,14 +117,26 @@
<integer>20</integer>
</dict>
EOF
-done
+ done
-cat >>$DIC_PLIST<<EOF
+ cat >>$DIC_PLIST<<EOF
</array>
</plist>
EOF
-# change owner
-chown $USER $DIC_PLIST
+ # change owner
+ chown $USER $DIC_PLIST
+fi
+
+# ======================================================================
+# convert skk-user-dic to skk-jisyo.utf8
+# ======================================================================
+
+OLD_USER_DIC=$ASKK/skk-user-dic
+NEW_USER_DIC=$ASKK/skk-jisyo.utf8
+
+if [ ! -f $NEW_USER_DIC -a -f $OLD_USER_DIC ]; then
+ iconv -f EUC-JP -t UTF-8 $OLD_USER_DIC > $NEW_USER_DIC
+fi
exit 0