3 # Dictionary/SOD download script for J-Ben 1.2.1
4 # This script is intended to be executed from the src folder,
5 # as it downloads files to relative paths ../dicts and ../sods.
11 if [ "$yn" == "Y" ]; then
13 elif [ "$yn" == "N" ]; then
18 if [ ! -z "$1" ]; then
22 if [ "$yn" == "y" ]; then
24 elif [ "$yn" == "n" ]; then
27 echo -ne "Please enter \"Y\" or \"N\": "
32 # Check for existance of wget, tar and gzip, and bail if not found
33 if ! which wget
&> /dev
/null
; then
34 echo -e "wget not found. wget is required to automatically download dictionaries and stroke order\ndiagrams."
37 if ! which tar &> /dev
/null
; then
38 echo -e "tar not found. tar is required for unpacking downloaded stroke order diagram packages."
41 if ! which gzip &> /dev
/null
; then
42 echo -e "wget not found. wget is required to automatically download dictionaries and stroke order\ndiagrams."
46 # Ask for auto-dl of dictionaries
51 "\nJ-Ben needs dictionary files in order to work properly. From now, you\n"\
52 "will be given a choice of files to download. However, you can skip\n"\
53 "this if you wish to set them up yourself.\n\n"\
55 "Select dictionary files for download and auto-installation? [Y/n]: "
57 if [ "$?" == "0" ]; then dl_dicts
=0; fi
59 if [ $dl_dicts ]; then
61 "\nEDICT2: Extended English-Japanese word dictionary.\n\n"\
63 "This is the standard English-Japanese dictionary file used by J-Ben.\n"\
64 "Download this unless you already have a copy from elsewhere\n"\
65 "(ex.: from your Linux distribution)\n\n"\
67 "Download EDICT2? [Y/n]: "
69 if [ "$?" == "0" ]; then dl_edict2
=0; fi
72 "\nKANJIDIC: Standard character dictionary.\n\n"\
74 "This is the standard character dictionary file used by J-Ben,\n"\
75 "containing information on 6,355 kanji characters.\n"\
76 "Download this unless you already have a copy from elsewhere\n"\
77 "(ex.: from your Linux distribution)\n\n"\
79 "Download KANJIDIC? [Y/n]: "
81 if [ "$?" == "0" ]; then dl_kanjidic
=0; fi
84 "\nKANJIDIC2: Extended character dictionary.\n\n"\
86 "KANJIDIC2 is an expanded character dictionary file, containing data\n"\
87 "on 13,108 kanji characters. It contains much extra information not\n"\
88 "found in KANJIDIC, but may be overkill for most users. It's also a\n"\
89 "large file and will increase the load time of J-Ben significantly.\n\n"\
91 "Download KANJIDIC2? [y/N]: "
93 if [ "$?" == "0" ]; then dl_kanjidic2
=0; fi
96 # Ask for auto-dl of stroke order diagrams
97 # * Static charts [Y/n]
100 "\nJ-Ben supports stroke order diagrams from the SODER project at\n"\
101 "KanjiCafe.com. These are not required, but are recommended.\n\n"\
103 "Do you wish to download stroke order diagrams? [Y/n]: "
105 if [ "$?" == "0" ]; then dl_sods
=0; fi
107 if [ $dl_sods ]; then
109 "\nStatic Stroke Order Diagrams\n\n"\
111 "This package contains stroke order diagrams for 1,513 kanji characters.\n"\
112 "These diagrams are not animated, showing a grid with one stroke drawn and\n"\
113 "highlighted per box. These are highly recommended.\n\n"\
115 "Do you wish to download static (non-animated) stroke order diagrams? [Y/n]: "
117 if [ "$?" == "0" ]; then dl_static_sods
=0; fi
120 "\nAnimated Stroke Order Diagrams\n\n"\
122 "This package contains animated stroke order diagrams for 1,513 kanji\n"\
123 "characters. These diagrams show a single box which walks through each of the\n"\
124 "kanji strokes in sequence. Some users prefer these.\n\n"\
126 "Do you wish to download animated stroke order diagrams? [y/N]: "
128 if [ "$?" == "0" ]; then dl_anim_sods
=0; fi
131 # Download all selected files and place in ../dicts or ../sods
132 echo -e "\nDownloading selected components:"
133 if [ $dl_edict2 ]; then echo "* EDICT2"; fi
134 if [ $dl_kanjidic ]; then echo "* KANJIDIC"; fi
135 if [ $dl_kanjidic2 ]; then echo "* KANJIDIC2"; fi
136 if [ $dl_static_sods ]; then echo "* KanjiCafe.com static stroke order diagrams"; fi
137 if [ $dl_anim_sods ]; then echo "* KanjiCafe.com animated stroke order diagrams"; fi
139 # Reset dict/sod vars to null; we'll set them if a download completes
144 if [ $dl_edict2 ]; then
145 # Download only if not present.
146 if [ -e "../dicts/edict2.gz" ]; then
147 echo "EDICT2 already downloaded; skipping."
149 wget
-P..
/dicts http
://www.vultaire.net
/software
/jben
/files
/dicts
/edict2.gz
150 if [ "$?" == "0" ]; then dl_dicts
=0; fi
153 if [ $dl_kanjidic ]; then
154 if [ -e "../dicts/kanjidic.gz" ]; then
155 echo "KANJIDIC already downloaded; skipping."
157 wget
-P..
/dicts http
://www.vultaire.net
/software
/jben
/files
/dicts
/kanjidic.gz
158 if [ "$?" == "0" ]; then dl_dicts
=0; fi
161 if [ $dl_kanjidic2 ]; then
162 if [ -e "../dicts/kanjidic2.xml.gz" ]; then
163 echo "KANJIDIC2 already downloaded; skipping."
165 wget
-P..
/dicts http
://www.vultaire.net
/software
/jben
/files
/dicts
/kanjidic2.xml.gz
166 if [ "$?" == "0" ]; then dl_dicts
=0; fi
169 if [ $dl_static_sods ]; then
170 if [ -e "../sods/sod-utf8-hex.tar.gz" ]; then
171 echo "EDICT2 already downloaded; skipping."
173 wget
-P..
/sods http
://www.vultaire.net
/software
/jben
/files
/sods
/sod-utf8-hex.
tar.gz
174 if [ "$?" == "0" ]; then dl_sods
=0; fi
177 if [ $dl_anim_sods ]; then
178 if [ -e "../sods/soda-utf8-hex.tar.gz" ]; then
179 echo "EDICT2 already downloaded; skipping."
181 wget
-P..
/sods http
://www.vultaire.net
/software
/jben
/files
/sods
/soda-utf8-hex.
tar.gz
182 if [ "$?" == "0" ]; then dl_sods
=0; fi
186 #Notify user on success, explain where files were placed.
188 if [ $dl_dicts ]; then echo "Dictionary files were placed in the ../dicts directory."; fi
189 if [ $dl_sods ]; then echo "Stroke order diagrams were placed in the ../sods directory."; fi
191 ##Extract SOD archives if necessary
192 #if [ -e "../sods/sod-utf8-hex.tar.gz" -a ! -e ../sods/sod-utf8-hex ]; then
193 # cd ../sods && tar -xzf sod-utf8-hex.tar.gz
195 #if [ -e "../sods/soda-utf8-hex.tar.gz" -a ! -e ../sods/soda-utf8-hex ]; then
196 # cd ../sods && tar -xzf soda-utf8-hex.tar.gz