-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·68 lines (55 loc) · 1.88 KB
/
install.sh
File metadata and controls
executable file
·68 lines (55 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
echo "Installing modpi to /opt/modpi"
# Install dependencies
echo "Installing dependencies..."
sudo apt update
sudo apt install -y git python3-luma.oled python3-smbus python3-psutil fonts-dejavu-core
# Create modpi user if it doesn't exist
if ! id "modpi" &>/dev/null; then
echo "Creating modpi user..."
sudo useradd -r -s /bin/false -d /opt/modpi -G i2c modpi
else
# Ensure existing user is in i2c group
sudo usermod -a -G i2c modpi
fi
# Create installation directory
echo "Setting up installation directory..."
if [[ ! -d /opt/modpi ]]; then
sudo mkdir -p /opt/modpi
sudo chown modpi:modpi /opt/modpi
fi
# Clone or update repository
if [[ ! -d /opt/modpi/.git ]]; then
echo "Cloning modpi repository..."
sudo -u modpi git clone https://github.com/codesmax/modpi.git /opt/modpi
else
echo "Repository already exists, updating..."
sudo -u modpi git -C /opt/modpi pull
fi
# Install systemd service files
echo "Installing systemd services..."
sudo cp /opt/modpi/services/*.service /etc/systemd/system/
# Reload systemd and enable services
echo "Enabling and starting services..."
sudo systemctl daemon-reload
sudo systemctl enable exp-config-startup.service
sudo systemctl enable exp-config-shutdown.service
sudo systemctl enable oled-stats.service
sudo systemctl start exp-config-startup.service
sudo systemctl start oled-stats.service
cat <<EOF
✅ Installation complete!
Services installed:
- exp-config-startup.service (enabled, started)
- exp-config-shutdown.service (enabled)
- oled-stats.service (enabled, started)
Check status with:
sudo systemctl status oled-stats.service
sudo systemctl status exp-config-startup.service
sudo systemctl status exp-config-shutdown.service
View logs with:
sudo journalctl -u exp-config-startup.service -f
sudo journalctl -u exp-config-shutdown.service -f
sudo journalctl -u oled-stats.service -f
EOF