-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile.toml
More file actions
141 lines (115 loc) · 4.01 KB
/
Makefile.toml
File metadata and controls
141 lines (115 loc) · 4.01 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Makefile.toml - Task automation for sunsetr using cargo-make
# Install cargo-make: cargo install cargo-make
# Run tasks: cargo make <task-name>
[config]
default_to_workspace = false
skip_core_tasks = true
[tasks.default]
description = "Show available tasks"
script = '''
echo "Sunsetr installation tasks"
echo ""
echo "Usage: cargo make <task>"
echo ""
echo "Installation tasks:"
echo " cargo make install - Install everything (binary, service)"
echo " cargo make install-local - Install to ~/.local (no sudo needed)"
echo " cargo make install-binary - Install just the binary"
echo " cargo make install-service - Install systemd user service"
echo " cargo make uninstall - Remove all installed files"
echo ""
echo "For development, use standard cargo commands:"
echo " cargo build - Build debug binary"
echo " cargo build --release - Build release binary"
echo " cargo test - Run tests"
echo " cargo run -- --debug - Run with debug output"
'''
# System Installation Tasks (requires sudo)
[tasks.install]
description = "Install sunsetr system-wide with all components"
script = '''
#!/bin/bash
set -e
echo "Building release binary..."
cargo build --release
echo "Installing sunsetr system-wide..."
# Install binary
echo "Installing binary..."
sudo install -Dm755 target/release/sunsetr /usr/bin/sunsetr
# Install systemd user service
echo "Installing systemd user service..."
sudo install -Dm644 sunsetr.service /usr/lib/systemd/user/sunsetr.service
echo ""
echo "✓ Installation complete!"
echo ""
echo "To start sunsetr as a user service:"
echo " systemctl --user enable --now sunsetr"
echo ""
echo "Or add to your compositor config:"
echo " Hyprland: exec-once = sunsetr"
echo " Niri: spawn-at-startup \"sunsetr\""
'''
[tasks.install-binary]
description = "Install just the sunsetr binary"
script = '''
#!/bin/bash
echo "Building release binary..."
cargo build --release
sudo install -Dm755 target/release/sunsetr /usr/bin/sunsetr
echo "✓ Binary installed to /usr/bin/sunsetr"
'''
[tasks.install-service]
description = "Install systemd user service file"
script = '''
#!/bin/bash
sudo install -Dm644 sunsetr.service /usr/lib/systemd/user/sunsetr.service
echo "✓ Service installed. Enable with: systemctl --user enable --now sunsetr"
'''
# Local Installation Tasks (no sudo)
[tasks.install-local]
description = "Install to ~/.local (no sudo required)"
script = '''
#!/bin/bash
set -e
echo "Building release binary..."
cargo build --release
echo "Installing sunsetr to ~/.local ..."
# Create directories if they don't exist
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/systemd/user
# Install binary
install -Dm755 target/release/sunsetr ~/.local/bin/sunsetr
echo "✓ Binary installed to ~/.local/bin/sunsetr"
# Install systemd user service (modified for local path)
sed 's|/usr/bin/sunsetr|'$HOME'/.local/bin/sunsetr|' sunsetr.service > ~/.local/share/systemd/user/sunsetr.service
echo "✓ Service installed to ~/.local/share/systemd/user/sunsetr.service"
echo ""
echo "✓ Local installation complete!"
echo ""
echo "Make sure ~/.local/bin is in your PATH:"
echo ' export PATH="$HOME/.local/bin:$PATH"'
echo ""
echo "To use the systemd service:"
echo " systemctl --user daemon-reload"
echo " systemctl --user enable --now sunsetr"
'''
# Uninstall Tasks
[tasks.uninstall]
description = "Remove all installed sunsetr files"
script = '''
#!/bin/bash
echo "Uninstalling sunsetr..."
# Stop service if running
systemctl --user stop sunsetr 2>/dev/null || true
systemctl --user disable sunsetr 2>/dev/null || true
# Remove system files
sudo rm -f /usr/bin/sunsetr
sudo rm -f /usr/lib/systemd/user/sunsetr.service
# Legacy sleep hook cleanup (can be removed in future versions)
sudo rm -f /usr/lib/systemd/system-sleep/sunsetr-resume 2>/dev/null || true
sudo rm -f /lib/systemd/system-sleep/sunsetr-resume 2>/dev/null || true
# Remove local files
rm -f ~/.local/bin/sunsetr
rm -f ~/.local/share/systemd/user/sunsetr.service
echo "✓ Sunsetr has been uninstalled"
'''