-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevSetup.sh
More file actions
executable file
·55 lines (43 loc) · 1.93 KB
/
devSetup.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.93 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
#!/bin/bash
# Development Setup Script for Arcanas
# Run this once to set up your development environment
set -e
echo "Setting up Arcanas development environment..."
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)"
exit 1
fi
# Create data directory
echo "Creating /var/lib/arcanas..."
mkdir -p /var/lib/arcanas
chown -R $SUDO_USER:$SUDO_USER /var/lib/arcanas
chmod 755 /var/lib/arcanas
# Setup sudoers for development
echo "Setting up sudoers configuration..."
mkdir -p /etc/sudoers.d
cat > /etc/sudoers.d/arcanas-storage << 'EOF'
# Arcanas storage operations sudoers configuration
# Allows users in sudo group to run storage commands without password
Cmnd_Alias ARCANAS_STORAGE = /bin/mkdir, /usr/bin/mkdir, /bin/mount, /usr/bin/mount, /bin/umount, /usr/bin/umount, /usr/sbin/vgcreate, /usr/sbin/lvcreate, /sbin/mkfs, /usr/sbin/mkfs*, /usr/bin/mergerfs, /bin/sh, /usr/bin/sh, /usr/bin/sed, /bin/sed, /bin/rmdir, /usr/bin/rmdir, /usr/sbin/vgremove, /usr/sbin/lvremove, /usr/sbin/lvs, /usr/sbin/vgs, /usr/sbin/pvdisplay, /usr/sbin/pvremove, /usr/sbin/pvcreate, /usr/sbin/chown, /usr/bin/chown, /bin/chown, /usr/sbin/mdadm, /usr/bin/mdadm, /usr/bin/true, /usr/sbin/wipefs, /sbin/wipefs, /usr/bin/wipefs, /usr/bin/which, /bin/which, /usr/bin/findmnt, /usr/sbin/findmnt, /sbin/blockdev, /usr/sbin/blockdev
%sudo ALL=(ALL) NOPASSWD: ARCANAS_STORAGE
EOF
chmod 440 /etc/sudoers.d/arcanas-storage
# Validate sudoers file
if ! visudo -c -f /etc/sudoers.d/arcanas-storage; then
echo "ERROR: Sudoers file is invalid!"
rm /etc/sudoers.d/arcanas-storage
exit 1
fi
echo ""
echo "✓ Development environment setup complete!"
echo ""
echo "Data directory: /var/lib/arcanas"
echo "Owner: $SUDO_USER:$SUDO_USER"
echo "Sudoers configured for storage operations"
echo ""
echo "You can now run the application with:"
echo " cd backend && go run cmd/server/main.go"
echo " or"
echo " ./nas-dashboard"
echo ""