install & automount

This commit is contained in:
2025-09-25 15:08:51 +02:00
parent 97547f4f80
commit cfd1b0bc43
4 changed files with 251 additions and 16 deletions

View File

@@ -75,7 +75,6 @@ install_packages() {
python3-venv \
vlc \
vlc-plugin-base \
vlc-plugin-video-output \
ffmpeg \
git \
curl \
@@ -98,16 +97,6 @@ install_packages() {
libatlas-base-dev \
gfortran \
libhdf5-dev \
libhdf5-103 \
python3-pyqt5 \
python3-pyqt5.qtwidgets \
python3-pyqt5.qtgui \
python3-pyqt5.qtcore \
libgtk-3-dev \
libcanberra-gtk3-module \
libcanberra-gtk3-dev \
libcanberra-gtk-dev \
libcanberra-dev \
pulseaudio \
pulseaudio-utils \
alsa-utils \
@@ -118,7 +107,6 @@ install_packages() {
python3-smbus \
python3-spidev \
python3-pil \
python3-pil.imagetk \
python3-setuptools \
python3-wheel
@@ -179,8 +167,13 @@ copy_files() {
cp ir_remote.py "$INSTALL_DIR/"
cp config_manager.py "$INSTALL_DIR/"
# Copy service file
# Copy USB auto-mount script
cp usb_automount.sh "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/usb_automount.sh"
# Copy service files
cp video-player.service /etc/systemd/system/
cp usb-automount.service /etc/systemd/system/
# Copy configuration templates
mkdir -p "$CONFIG_DIR/templates"
@@ -335,6 +328,30 @@ EOF
print_success "Default configuration created"
}
# Function to setup USB auto-mounting
setup_usb_automount() {
print_status "Setting up USB auto-mounting..."
# Create USB mount directory
mkdir -p /media/usb
chown "$USER:$USER" /media/usb
chmod 755 /media/usb
# Copy udev rules
cp 99-usb-automount.rules /etc/udev/rules.d/
chmod 644 /etc/udev/rules.d/99-usb-automount.rules
# Reload udev rules
udevadm control --reload-rules
udevadm trigger
# Enable USB auto-mount service
systemctl daemon-reload
systemctl enable usb-automount
print_success "USB auto-mounting configured"
}
# Function to setup GPIO permissions
setup_gpio_permissions() {
print_status "Setting up GPIO permissions..."
@@ -449,6 +466,12 @@ EOF
cat > /usr/local/bin/video-player-logs << 'EOF'
#!/bin/bash
sudo journalctl -u video-player -f
EOF
# Create USB management script
cat > /usr/local/bin/video-player-usb << 'EOF'
#!/bin/bash
/opt/video_player/usb_automount.sh "$@"
EOF
# Set permissions
@@ -475,13 +498,15 @@ display_summary() {
echo "Restart: video-player-restart"
echo "Status: video-player-status"
echo "Logs: video-player-logs"
echo "USB: video-player-usb {scan|mount-all}"
echo
echo "Next Steps:"
echo "==========="
echo "1. Add video files to: $VIDEO_FOLDER"
echo "2. Configure IR remote codes in: $CONFIG_DIR/ir_mapping.json"
echo "3. Start the service: video-player-start"
echo "4. Check status: video-player-status"
echo "2. Insert USB drives - they will auto-mount to: /media/usb/"
echo "3. Configure IR remote codes in: $CONFIG_DIR/ir_mapping.json"
echo "4. Start the service: video-player-start"
echo "5. Check status: video-player-status"
echo
echo "For more information, see the documentation in $INSTALL_DIR"
}
@@ -503,6 +528,7 @@ main() {
create_directories
copy_files
create_default_config
setup_usb_automount
setup_gpio_permissions
setup_service
create_sample_video