This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

1#!/bin/bash 2# inky_setup.sh - auto setup the inky server 3 4# Check if this is being run from a file 5if [ -f "$0" ]; then 6 echo "Checking for updated setup script..." 7 LATEST=$(curl -s https://raw.githubusercontent.com/taciturnaxolotl/inky/refs/heads/main/setup.sh) 8 LATEST_HASH=$(echo "$LATEST" | sha256sum | cut -d' ' -f1) 9 CURRENT_HASH=$(cat "$0" | sha256sum | cut -d' ' -f1) 10 if [ $? -eq 0 ] && [ ! -z "$LATEST" ] && [ "$LATEST_HASH" != "$CURRENT_HASH" ]; then 11 echo "Applying latest version..." 12 echo "$LATEST" > "$0" 13 exec "$0" "$@" 14 exit 0 15 fi 16else 17 echo "Creating setup script file..." 18 curl -s https://raw.githubusercontent.com/taciturnaxolotl/inky/refs/heads/main/setup.sh > setup.sh 19 chmod +x setup.sh 20 exec ./setup.sh "$@" 21 exit 0 22fi 23 24# Check if running as root 25if [ "$EUID" -ne 0 ]; then 26 echo "Please run as root or with sudo" 27 exit 1 28fi 29 30echo "Setting up Inky camera server from GitHub repository..." 31 32# Check for existing repository 33cd /home/ink 34if [ -d "/home/ink/inky" ]; then 35 read -p "Repository already exists. Would you like to update it? (y/n) " -n 1 -r 36 echo 37 if [[ $REPLY =~ ^[Yy]$ ]]; then 38 cd /home/ink/inky 39 git pull 40 41 cp /home/ink/inky/src/camera_server.py /home/ink/ && chown ink:ink /home/ink/camera_server.py && chmod +x /home/ink/camera_server.py 42 43 # Just restart the service since it's an update 44 echo "Restarting camera service..." 45 systemctl restart camera.service 46 else 47 echo "Okay, not updating" 48 exit 49 fi 50else 51 # Update system packages and install dependencies 52 echo "Updating package lists and installing dependencies..." 53 apt update 54 apt install -y python3-picamera2 python3-websockets python3-rpi.gpio git 55 56 # Create directory for storing photos 57 echo "Creating photos directory..." 58 mkdir -p /home/ink/photos 59 chown ink:ink /home/ink/photos 60 61 git clone https://github.com/taciturnaxolotl/inky.git 62 63 chown -R ink:ink /home/ink/inky 64 65 # Copy camera_server.py to user's home directory 66 echo "Setting up camera server..." 67 cp /home/ink/inky/src/camera_server.py /home/ink/ 68 chown ink:ink /home/ink/camera_server.py 69 chmod +x /home/ink/camera_server.py 70 71 # Copy and set up systemd service 72 echo "Setting up systemd service..." 73 cp /home/ink/inky/src/camera.service /etc/systemd/system/ 74 75 # Test the camera 76 echo "Testing camera..." 77 if command -v rpicam-still &> /dev/null; then 78 mkdir -p /tmp/camera_test 79 if rpicam-still -o /tmp/camera_test/test.jpg; then 80 echo "Camera test successful!" 81 else 82 echo "Camera test failed. Please check your camera connection." 83 fi 84 else 85 echo "rpicam-still not found. Please make sure the camera is properly enabled." 86 fi 87 88 # Enable and start the service 89 echo "Enabling and starting camera service..." 90 systemctl daemon-reload 91 systemctl enable camera.service 92 systemctl start camera.service 93fi 94 95echo "Setup complete!" 96echo "Camera server should now be running." 97echo "You can access the web interface at: http://inky.local" 98echo "Check service status with: sudo systemctl status camera"