spiegel-keyman/linux/scripts/install.sh
Eberhard Beilharz ea059df541
chore(linux): Remove legacy projects
This change removes the KMFL legacy projects. They are still
available in the stable-16 branch if we need them.

Also removed some shellcheck warnings.
2023-01-26 11:51:13 +01:00

80 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
# Install keyboardprocessor, ibus-keyman and keyman-config
# It must be run from the keyman/linux directory
set -e
BASEDIR=$(pwd)
SUDOINSTALL=${SUDOINSTALL:-"no"}
INSTALLDIR=${INSTALLDIR:-"/usr/local"}
if [[ "${SUDOINSTALL}" != "no" ]]; then
if [ "$EUID" -ne 0 ]
then
echo "Please run 'make un/install' with sudo"
exit
fi
fi
if [ -f "/usr/share/ibus/component/keyman.xml" ] && [ "${SUDOINSTALL}" == "yes" ]; then
if grep -Fq "/usr/lib/ibus" /usr/share/ibus/component/keyman.xml
then
echo "component file is in ibus-keyman package version so move it"
echo "run 'sudo make uninstall' to put it back"
mv /usr/share/ibus/component/keyman.xml /usr/share/doc/ibus-keyman/
else
echo "component file is local one so overwrite it"
fi
fi
cd keyboardprocessor/arch/release
ninja install
cd "$BASEDIR"
cd build-ibus-keyman
if [[ "${SUDOINSTALL}" == "uninstall" ]]; then
if [ ! -f Makefile ]; then
echo "ibus-keyman must be configured before it is uninstalled. First run 'make configure'"
exit 1
fi
echo "doing make uninstall of ibus-keyman"
make uninstall
else
if [ ! -f Makefile ]; then
echo "ibus-keyman must be configured and built before it is installed. First run 'make' or 'make tmpinstall'"
exit 1
fi
echo "doing make install of ibus-keyman"
make install
fi
cd "$BASEDIR"
cd keyman-config
echo "SUDOINSTALL: ${SUDOINSTALL}"
if [[ "${SUDOINSTALL}" == "yes" ]]; then
if [ ! -d build ]; then
echo "keyman-config must be built before it is installed. Run 'make configure' if needed then 'make'"
exit 1
fi
echo "doing sudo glib-compile-schemas for keyman-config"
cp com.keyman.gschema.xml /usr/share/glib-2.0/schemas/
glib-compile-schemas /usr/share/glib-2.0/schemas/
echo "doing sudo install of keyman-config"
make install
elif [[ "${SUDOINSTALL}" == "uninstall" ]]; then
echo "doing sudo uninstall of keyman-config"
make uninstall
else
echo "doing /tmp install of keyman-config"
make install-temp
fi
cd "$BASEDIR"
if [ -f "/usr/share/doc/ibus-keyman/keyman.xml" ] && [ "${SUDOINSTALL}" == "uninstall" ]; then
echo "putting ibus-keyman package component file back"
mv /usr/share/doc/ibus-keyman/keyman.xml /usr/share/ibus/component/
fi