Hello, everyone. Using the excellent information in the posts above, Iâve written a shell script that automatically attempts to install and configure spell checking for 64-bit Debian-based systems. Iâve run this script successfully on two different machines.
You should have Scrivener working correctly without spell checking in your environment before running this. My own installs were done on systems based on Debian Wheezy and Debian Jessie. On my systems, in order to get Scrivener working correctly, I needed only to install the i386 libgstreamer-plugins-base package (and its dependencies). All other necessary 32-bit libs came pre-installed. My tests were done on recent releases of SolydK and Crunchbang Linux. You may need to consult earlier posts in this thread if you still have 32-bit library issues.
sudo apt-get install libgstreamer-plugins-base0.10-0:i386
You may also need to perform:
sudo apt-get -f install
to fill in any missing dependencies that the gstreamer library doesnât pull in, depending on your system.
Iâve tested the script when Scrivener is installed both from the .deb and .tar.gz packages. The script is set up to work with the .deb install, but if you install from the .tar.gz package, you can modify the line that starts with âSCRIV_HOME=â to point to the directory where you installed it.
If you installed Scrivener from the .deb package or you installed the .tar.gz package to somewhere you donât normally have write access to, youâll need to run this script using sudo so it can have the proper permissions.
The script is extremely conservative when checking for errors and moving files around - it tries to stop immediately if something goes wrong. If it messes up your Scrivener install, it would probably just be easiest for you to uninstall and reinstall Scrivener, so make sure you back up your work first. This is very unlikely, however. Also, if you run the script a second time, you will get âFile already existsâ-type errors.
On my Crunchbang system, I get a gnome-keyring-pkcs11 error, but this is harmless. An earlier post details how to fix this if it bothers you.
#!/bin/bash
# Modify this variable to point to the directory Scrivener is installed in
SCRIV_HOME="/usr/share/scrivener"
SCRIV_LIB=$SCRIV_HOME/lib
SCRIV_BIN=$SCRIV_HOME/bin
TMP="/tmp/aspell"
ASPELL_DIR="$TMP/aspell"
LIBASPELL_DIR="$TMP/libaspell"
LIBNCURSES_DIR="$TMP/libncurses"
LIBTINFO_DIR="$TMP/libtinfo"
function download() {
apt-get download $1
if [ $? -ne 0 ]; then
echo "Failed to download package: $1"
exit 1
fi
}
function unpack() {
dpkg -x $@
if [ $? -ne 0 ]; then
echo "Failed to unpack package: $1"
exit 1
fi
}
function make_copy() {
cp $@
if [ $? -ne 0 ]; then
echo "Failed to copy file: cp $@"
exit 1
fi
}
function make_link() {
ln -s $@
if [ $? -ne 0 ]; then
echo "Failed to create symlink: $2 -> $1"
exit 1
fi
}
# prepare temp directory
if [ -d $TMP ]; then
rm -rf $TMP
fi
mkdir $TMP
cd $TMP
echo "Downloading and unpacking 32-bit libs..."
# get the needed libraries
download "aspell:i386"
download "libaspell15:i386"
download "libncursesw5:i386"
download "libtinfo5:i386"
# unpack the libraries
unpack $TMP/aspell* $ASPELL_DIR
unpack $TMP/libaspell15* $LIBASPELL_DIR
unpack $TMP/libncursesw5* $LIBNCURSES_DIR
unpack $TMP/libtinfo5* $LIBTINFO_DIR
echo "Setting up aspell libraries..."
# copy new aspell files to scriv
make_copy -rf /usr/lib/aspell $SCRIV_LIB
make_copy -if $ASPELL_DIR/usr/bin/* $SCRIV_BIN
make_copy -rf $LIBASPELL_DIR/usr/lib/aspell/* $SCRIV_LIB/aspell/
make_copy $LIBASPELL_DIR/usr/lib/libaspell.so.15.2.0 $LIBASPELL_DIR/usr/lib/libpspell.so.15.2.0 $SCRIV_LIB
make_copy $LIBNCURSES_DIR/lib/i386-linux-gnu/libncursesw.so.5.9 $SCRIV_LIB
make_copy $LIBTINFO_DIR/lib/i386-linux-gnu/libtinfo.so.5.9 $SCRIV_LIB
# create symlinks in scrivener lib dir
make_link $SCRIV_LIB/libaspell.so.15.2.0 $SCRIV_LIB/libaspell.so
make_link $SCRIV_LIB/libaspell.so.15.2.0 $SCRIV_LIB/libaspell.so.15
make_link $SCRIV_LIB/libpspell.so.15.2.0 $SCRIV_LIB/libpspell.so
make_link $SCRIV_LIB/libpspell.so.15.2.0 $SCRIV_LIB/libpspell.so.15
make_link $SCRIV_LIB/libncursesw.so.5.9 $SCRIV_LIB/libncursesw.so
make_link $SCRIV_LIB/libncursesw.so.5.9 $SCRIV_LIB/libncursesw.so.5
make_link $SCRIV_LIB/libtinfo.so.5.9 $SCRIV_LIB/libtinfo.so
make_link $SCRIV_LIB/libtinfo.so.5.9 $SCRIV_LIB/libtinfo.so.5
# replace symlinks with real files
rm $SCRIV_LIB/aspell/*.rws
cp /var/lib/aspell/*.rws $SCRIV_LIB/aspell/
if [ $? -ne 0 ]; then
echo "Failed to copy aspell dictionary files (aspell not installed?)"
exit 1
fi
# set up env vars
ASPELL_CONF="prefix $SCRIV_HOME"
PATH="$SCRIV_HOME/bin:$PATH"
LD_LIBRARY_PATH="$SCRIV_HOME/lib:$LD_LIBRARY_PATH"
AC_CONF="$SCRIV_HOME"
export ASPELL_CONF PATH LD_LIBRARY_PATH
# check to ensure the new aspell binary is going to work
ldd $SCRIV_BIN/aspell | grep "not found" > /dev/null
if [ $? -eq 0 ]; then
echo "There are missing dependencies for the aspell program $SCRIV_BIN/aspell"
echo "These dependencies are:"
ldd $SCRIV_BIN/aspell
echo "These dependencies must be resolved or spell checking will not work"
exit 1
fi
echo "Generating new dictionary files..."
# generate new dictionary files
RWS_FILES="/usr/share/aspell/*.cwl.gz"
for RWS_FILE in $RWS_FILES; do
BASE=`basename $RWS_FILE`
NAME=`echo $BASE | cut -d'.' -f1`
zcat $RWS_FILE | precat | aspell --per-conf=/dev/null --dont-validate-affixes --local-data-dir=$SCRIV_LIB/aspell --lang=en create master $SCRIV_LIB/aspell/$NAME.rws
done
# backup scrivener launch script
SCRIV_TMP=$TMP/scrivener.sh
cp $SCRIV_BIN/scrivener.sh $SCRIV_TMP
echo "Modifying scrivener startup script..."
# modify env variables in temp scrivener launch script
NEW_SCRIV_TMP=$TMP/scrivener_new.sh
sed "1 a\
ASPELL_CONF=\"prefix $SCRIV_HOME\"\\n\
PATH=\"$SCRIV_HOME/bin:\$PATH\"\\n\
export ASPELL_CONF PATH" $SCRIV_TMP > $NEW_SCRIV_TMP
# replace the original scrivener.sh with the modified one
cp $NEW_SCRIV_TMP $SCRIV_BIN/scrivener.sh
# clean up
rm -rf $TMP
echo "Done."
Kudos to the previous posters. I would never have figured out all the steps to get aspell working without their help.
Good luck!