Worked on updating installation files, e.g. install.sh, requirements.txt, and setup.py. Maybe broken, proceed with caution.
This commit is contained in:
parent
d81d563bb6
commit
7bbc45bda2
184
install.sh
184
install.sh
@ -1,12 +1,141 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#Basic install script for Fenrir.
|
# Install script for Fenrir Screen Reader
|
||||||
read -rp "This will install Fenrir. Press ctrl+C to cancel, or enter to continue."
|
set -e
|
||||||
|
|
||||||
|
# Check if running as root
|
||||||
|
if [[ $(whoami) != "root" ]]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check Python version
|
||||||
|
pythonVersion=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
|
||||||
|
requiredVersion="3.8"
|
||||||
|
if ! python3 -c "import sys; exit(0 if sys.version_info >= (3, 8) else 1)" 2>/dev/null; then
|
||||||
|
echo "Python ${requiredVersion} or higher is required. Current version: ${pythonVersion}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Fenrir Screen Reader Installation"
|
||||||
|
echo "=================================="
|
||||||
|
read -rp "This will install the Fenrir screen reader. Press Ctrl+C to cancel, or Enter to continue."
|
||||||
|
|
||||||
|
# Check for pip3
|
||||||
|
if ! command -v pip3 &> /dev/null; then
|
||||||
|
echo "pip3 is required but not installed. Please install pip3 first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function to check dependencies
|
||||||
|
checkDependencies() {
|
||||||
|
echo "Checking dependencies..."
|
||||||
|
if python3 check-dependencies.py; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install dependencies with pip
|
||||||
|
installWithPip() {
|
||||||
|
echo "Installing Python dependencies with pip..."
|
||||||
|
pip3 install -r requirements.txt --break-system-packages
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to detect package manager and provide instructions
|
||||||
|
detectPackageManager() {
|
||||||
|
if command -v apt &> /dev/null; then
|
||||||
|
echo "apt"
|
||||||
|
elif command -v dnf &> /dev/null; then
|
||||||
|
echo "dnf"
|
||||||
|
elif command -v yum &> /dev/null; then
|
||||||
|
echo "yum"
|
||||||
|
elif command -v pacman &> /dev/null; then
|
||||||
|
echo "pacman"
|
||||||
|
elif command -v zypper &> /dev/null; then
|
||||||
|
echo "zypper"
|
||||||
|
else
|
||||||
|
echo "unknown"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to show package manager instructions
|
||||||
|
showPackageInstructions() {
|
||||||
|
local pm=$1
|
||||||
|
echo "Package manager installation instructions:"
|
||||||
|
case $pm in
|
||||||
|
"apt")
|
||||||
|
echo " sudo apt update"
|
||||||
|
echo " sudo apt install python3-evdev python3-daemonize python3-dbus python3-pyudev python3-pexpect"
|
||||||
|
echo " sudo apt install python3-pyte python3-setproctitle python3-enchant python3-xdg"
|
||||||
|
echo " sudo apt install speech-dispatcher espeak-ng sox alsa-utils"
|
||||||
|
;;
|
||||||
|
"dnf"|"yum")
|
||||||
|
echo " sudo $pm install python3-evdev python3-daemonize python3-dbus python3-pyudev python3-pexpect"
|
||||||
|
echo " sudo $pm install python3-pyte python3-setproctitle python3-enchant python3-pyxdg"
|
||||||
|
echo " sudo $pm install speech-dispatcher espeak-ng sox alsa-utils"
|
||||||
|
;;
|
||||||
|
"pacman")
|
||||||
|
echo " sudo pacman -S python-evdev python-daemonize python-dbus python-pyudev python-pexpect"
|
||||||
|
echo " sudo pacman -S python-pyte python-setproctitle python-pyenchant python-pyxdg"
|
||||||
|
echo " sudo pacman -S speech-dispatcher espeak-ng sox alsa-utils"
|
||||||
|
;;
|
||||||
|
"zypper")
|
||||||
|
echo " sudo zypper install python3-evdev python3-daemonize python3-dbus python3-pyudev python3-pexpect"
|
||||||
|
echo " sudo zypper install python3-pyte python3-setproctitle python3-enchant python3-pyxdg"
|
||||||
|
echo " sudo zypper install speech-dispatcher espeak-ng sox alsa-utils"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo " Unknown package manager. Please install the dependencies manually."
|
||||||
|
echo " Required packages: evdev, daemonize, dbus-python, pyudev, pexpect, pyte, setproctitle"
|
||||||
|
echo " System packages: speech-dispatcher, espeak-ng, sox, alsa-utils"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Initial dependency check
|
||||||
|
echo "Performing initial dependency check..."
|
||||||
|
if ! checkDependencies; then
|
||||||
|
echo ""
|
||||||
|
echo "Some dependencies are missing. You have two options:"
|
||||||
|
echo "1. Install using pip (not recommended uses --break-system-packages)"
|
||||||
|
echo "2. Install using your system package manager (recommended assuming I got the package names and package manager syntax right)"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
read -rp "Use pip to install Python dependencies? (y/N): " usePip
|
||||||
|
usePip="${usePip:0:1}"
|
||||||
|
|
||||||
|
if [[ "${usePip^}" == "Y" ]]; then
|
||||||
|
installWithPip
|
||||||
|
else
|
||||||
|
packageManager=$(detectPackageManager)
|
||||||
|
echo ""
|
||||||
|
showPackageInstructions "$packageManager"
|
||||||
|
echo ""
|
||||||
|
echo "Please install the packages above, then press Enter to continue..."
|
||||||
|
read -r
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check dependencies again
|
||||||
|
echo "Rechecking dependencies..."
|
||||||
|
if ! checkDependencies; then
|
||||||
|
echo "Some dependencies are still missing. Please install them manually."
|
||||||
|
echo "You can run 'python3 check-dependencies.py' to see which ones are missing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "All dependencies satisfied!"
|
||||||
|
|
||||||
|
# Install Fenrir application files
|
||||||
|
echo "Installing Fenrir application files..."
|
||||||
|
|
||||||
# Fenrir main application
|
# Fenrir main application
|
||||||
install -m755 -d /opt/fenrirscreenreader
|
install -m755 -d /opt/fenrirscreenreader
|
||||||
cp -af src/* /opt/fenrirscreenreader
|
cp -af src/* /opt/fenrirscreenreader
|
||||||
|
|
||||||
ln -fs /opt/fenrirscreenreader/fenrir /usr/bin/fenrir
|
ln -fs /opt/fenrirscreenreader/fenrir /usr/bin/fenrir
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
install -m755 -d /usr/share/fenrirscreenreader/tools
|
install -m755 -d /usr/share/fenrirscreenreader/tools
|
||||||
cp -af tools/* /usr/share/fenrirscreenreader/tools
|
cp -af tools/* /usr/share/fenrirscreenreader/tools
|
||||||
@ -45,22 +174,47 @@ else
|
|||||||
install -m644 -D "config/settings/settings.conf" /etc/fenrirscreenreader/settings/settings.conf
|
install -m644 -D "config/settings/settings.conf" /etc/fenrirscreenreader/settings/settings.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Install systemd service if systemd is available
|
||||||
|
if command -v systemctl &> /dev/null; then
|
||||||
|
echo "Installing systemd service..."
|
||||||
|
|
||||||
# end message
|
# Detect which service file to use
|
||||||
|
if [ -f "/etc/arch-release" ] || [ -f "/etc/manjaro-release" ]; then
|
||||||
|
serviceFile="autostart/systemd/Arch/fenrir.service"
|
||||||
|
else
|
||||||
|
serviceFile="autostart/systemd/Debian/fenrir.service"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$serviceFile" ]; then
|
||||||
|
install -m644 "$serviceFile" /etc/systemd/system/fenrir.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
echo "Systemd service installed. Enable with: sudo systemctl enable fenrir"
|
||||||
|
else
|
||||||
|
echo "Warning: Systemd service file not found: $serviceFile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning: Systemd not detected. Manual service setup may be required."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Final message
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Installation complete.
|
|
||||||
install path:/opt/fenrirscreenreader
|
|
||||||
settings path:/etc/fenrirscreenreader
|
|
||||||
|
|
||||||
To test Fenrir:
|
Installation complete!
|
||||||
sudo fenrir
|
=============================
|
||||||
|
Install path: /opt/fenrirscreenreader
|
||||||
|
Settings path: /etc/fenrirscreenreader
|
||||||
|
|
||||||
To have Fenrir start on system boot using systemd:
|
Next steps:
|
||||||
download service file: https://raw.githubusercontent.com/chrys87/fenrir/master/autostart/systemd/Arch/fenrir.service
|
1. Test Fenrir: sudo fenrir
|
||||||
move the service file to: /etc/systemd/system/fenrir.service
|
2. Enable autostart: sudo systemctl enable fenrir
|
||||||
sudo systemctl enable fenrir
|
3. Configure audio (run both as user and root):
|
||||||
|
- PulseAudio: /usr/share/fenrirscreenreader/tools/configure_pulse.sh
|
||||||
|
- PipeWire: /usr/share/fenrirscreenreader/tools/configure_pipewire.sh
|
||||||
|
|
||||||
Pulseaudio users may want to run
|
For help:
|
||||||
/usr/share/fenrirscreenreader/tools/configure_pulse.sh
|
- Documentation: https://git.stormux.org/storm/fenrir
|
||||||
once from their user account, then once from the root.
|
- Configuration: sudo fenrir --help
|
||||||
|
- Dependency check: python3 check-dependencies.py
|
||||||
|
|
||||||
|
Fenrir installation successful!
|
||||||
EOF
|
EOF
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
daemonize
|
daemonize>=2.5.0
|
||||||
evdev
|
evdev>=1.4.0
|
||||||
pexpect
|
dbus-python>=1.3.0
|
||||||
pyenchant
|
pyperclip>=1.8.0
|
||||||
pyperclip
|
pyudev>=0.24.0
|
||||||
pyte
|
pyte>=0.8.0
|
||||||
pyudev
|
setproctitle>=1.3.0
|
||||||
pyxdg
|
setuptools>=65.0.0
|
||||||
setproctitle
|
pexpect>=4.8.0
|
||||||
|
|
||||||
|
# Optional dependencies for enhanced functionality:
|
||||||
|
# pyenchant>=3.2.0 # For spell checking commands
|
||||||
|
# pyxdg>=0.28 # For XDG base directory support
|
||||||
|
# PyGObject>=3.42.0 # For GStreamer sound driver
|
||||||
|
# pyatspi>=2.40.0 # For AT-SPI input driver
|
||||||
|
# speechd>=0.11.0 # For speech-dispatcher Python bindings
|
||||||
|
22
setup.py
22
setup.py
@ -94,17 +94,17 @@ setup(
|
|||||||
data_files=dataFiles,
|
data_files=dataFiles,
|
||||||
|
|
||||||
# Dependent packages (distributions)
|
# Dependent packages (distributions)
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.8',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"evdev>=1.1.2",
|
"evdev>=1.4.0",
|
||||||
"daemonize>=2.5.0",
|
"daemonize>=2.5.0",
|
||||||
"dbus-python>=1.2.8",
|
"dbus-python>=1.3.0",
|
||||||
"pyperclip",
|
"pyperclip>=1.8.0",
|
||||||
"pyudev>=0.21.0",
|
"pyudev>=0.24.0",
|
||||||
"setuptools",
|
"setuptools>=65.0.0",
|
||||||
"setproctitle",
|
"setproctitle>=1.3.0",
|
||||||
"pexpect",
|
"pexpect>=4.8.0",
|
||||||
"pyte>=0.7.0",
|
"pyte>=0.8.0",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -113,12 +113,12 @@ if not forceSettingsFlag:
|
|||||||
# create settings file from example if not exist
|
# create settings file from example if not exist
|
||||||
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
||||||
try:
|
try:
|
||||||
copyfile('config/fenrirscreenreader/settings/settings.conf', '/etc/fenrirscreenreader/settings/settings.conf')
|
copyfile('config/settings/settings.conf', '/etc/fenrirscreenreader/settings/settings.conf')
|
||||||
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(f"Could not copy settings file to destination: {e}")
|
print(f"Could not copy settings file to destination: {e}")
|
||||||
else:
|
else:
|
||||||
print('settings.conf file found. It is not overwritten automatical')
|
print('settings.conf file found. It is not overwritten automatically')
|
||||||
|
|
||||||
print('')
|
print('')
|
||||||
print('To have Fenrir start at boot:')
|
print('To have Fenrir start at boot:')
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
version = "2025.06.16"
|
version = "2025.06.16"
|
||||||
codeName = "testing"
|
codeName = "installation-script-updates"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user