-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsetup-tts-lock-dir.sh
More file actions
executable file
·53 lines (45 loc) · 1.69 KB
/
setup-tts-lock-dir.sh
File metadata and controls
executable file
·53 lines (45 loc) · 1.69 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
#!/usr/bin/env bash
#
# setup-tts-lock-dir.sh
#
# Sets up a secure, shared TTS lock directory at /run/agentvibes.
#
# WHY: The default TTS lock file lives in /tmp which has the sticky bit set,
# meaning only the file owner can delete it. When multiple users (e.g. a server
# user and a local user) both use AgentVibes, a crashed process leaves a stale
# lock that the other user cannot clear — permanently silencing TTS.
#
# This script creates /run/agentvibes owned by the tts-users group with no
# sticky bit, so any group member can clear a stale lock regardless of who
# created it. play-tts-piper.sh auto-detects and uses this directory.
#
# PREREQUISITES:
# - Run as a user with sudo access
# - Both users must be in the tts-users group (AgentVibes installer handles this)
#
# USAGE:
# bash setup-tts-lock-dir.sh
#
set -euo pipefail
echo "🔧 Setting up AgentVibes shared TTS lock directory..."
# Check sudo is available
if ! sudo -n true 2>/dev/null && ! sudo -v 2>/dev/null; then
echo "❌ sudo access required" >&2
exit 1
fi
# Create the directory
sudo mkdir -p /run/agentvibes
# Own by root, tts-users group
sudo chown root:tts-users /run/agentvibes
# 2775 = setgid (new files inherit tts-users group) + group-writable + NO sticky bit
# No sticky bit is intentional: any tts-users member can delete any member's stale lock
sudo chmod 2775 /run/agentvibes
echo "✅ Created /run/agentvibes"
ls -la /run/ | grep agentvibes
echo ""
echo "ℹ️ Note: /run/ is tmpfs — this directory will NOT survive a reboot."
echo " To make it persistent, add to /etc/tmpfiles.d/agentvibes.conf:"
echo ""
echo " d /run/agentvibes 2775 root tts-users -"
echo ""
echo " Then run: sudo systemd-tmpfiles --create"