more install things

This commit is contained in:
2025-09-25 15:34:30 +02:00
parent 89ad062d42
commit 8e3462aaf2
5 changed files with 214 additions and 10 deletions

View File

@@ -16,7 +16,6 @@ NC='\033[0m' # No Color
INSTALL_DIR="/opt/video_player"
CONFIG_DIR="/etc/video_player"
SERVICE_NAME="video-player"
USER="pi"
# Function to print colored output
print_status() {
@@ -35,6 +34,19 @@ print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Load environment variables from .env file if it exists
if [[ -f ".env" ]]; then
print_status "Loading configuration from .env file..."
source .env
else
print_warning "No .env file found, using default values"
fi
# Set defaults if not defined in .env
USER="${USER:-pi}"
GROUP="${GROUP:-pi}"
GPIO_GROUP="${GPIO_GROUP:-gpio}"
# Function to check if running as root
check_root() {
if [[ $EUID -ne 0 ]]; then
@@ -175,8 +187,8 @@ remove_gpio_rules() {
remove_gpio_group() {
print_status "Removing user from gpio group..."
if groups "$USER" | grep -q "gpio"; then
gpasswd -d "$USER" gpio
if groups "$USER" | grep -q "$GPIO_GROUP"; then
gpasswd -d "$USER" "$GPIO_GROUP"
print_success "User removed from gpio group"
else
print_warning "User not in gpio group"