jellyfin_raspberry_pi/00-pi_firmware_install.sh

31 lines
1.0 KiB
Bash

#!/bin/bash
# Get the current user
CURRENT_USER=$(whoami)
INSTALL_DIR="/home/$CURRENT_USER/jellyfin_raspberry_pi/x735-v2.5"
# Update system and install dependencies
sudo apt-get update && sudo apt-get upgrade -y
sudo apt install -y python3
sudo apt install -y pigpio python3-pigpio git
#sudo apt install -y python-pigpio
# Clone the repository (if it doesn't already exist)
if [ ! -d "$INSTALL_DIR" ]; then
git clone https://gitea.fortis-scientia.com/RomanNum3ral/x735-v2.5 "$INSTALL_DIR"
fi
cd "$INSTALL_DIR" || exit 1
# Make all shell scripts executable
sudo chmod +x *.sh
# Run the installation script
sudo bash install.sh
# Add alias and Python script to .bashrc for the current user
sudo -u "$CURRENT_USER" bash -c "echo \"alias off='sudo $INSTALL_DIR/x735softsd.sh'\" >> /home/$CURRENT_USER/.bashrc"
sudo -u "$CURRENT_USER" bash -c "echo \"python3 $INSTALL_DIR/pwm_fan_control.py &\" >> /home/$CURRENT_USER/.bashrc"
# Notify user
echo "Setup complete. Please open a new terminal for changes to take effect."