-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·123 lines (108 loc) · 3.19 KB
/
install.sh
File metadata and controls
executable file
·123 lines (108 loc) · 3.19 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
#!/bin/bash
set -euo pipefail
# DECK Installation Script
echo "DECK Installation Script"
echo "======================="
echo ""
# Check if running as root
if [[ $EUID -eq 0 ]]; then
echo "This script should not be run as root. Please run as a regular user with sudo access."
exit 1
fi
# Default values
INSTALL_DIR="/opt/deck"
DECK_DIR="/var/clide/deck"
USER=$(whoami)
GROUP=$(id -gn)
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--install-dir)
INSTALL_DIR="$2"
shift 2
;;
--deck-dir)
DECK_DIR="$2"
shift 2
;;
--user)
USER="$2"
shift 2
;;
--group)
GROUP="$2"
shift 2
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--install-dir DIR] [--deck-dir DIR] [--user USER] [--group GROUP]"
exit 1
;;
esac
done
echo "Installation settings:"
echo " Install directory: ${INSTALL_DIR}"
echo " DECK directory: ${DECK_DIR}"
echo " User: ${USER}"
echo " Group: ${GROUP}"
echo ""
# Confirm installation
read -p "Continue with installation? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Installation cancelled."
exit 0
fi
# Create directories
echo "Creating directories..."
sudo mkdir -p "${INSTALL_DIR}"
sudo mkdir -p "${DECK_DIR}"/{active,waiting,config,logs}
# Copy files
echo "Copying files..."
sudo cp -r src "${INSTALL_DIR}/"
sudo cp deck.service /tmp/deck.service
# Set permissions
echo "Setting permissions..."
sudo chown -R "${USER}:${GROUP}" "${DECK_DIR}"
sudo chmod 755 "${INSTALL_DIR}"/src/*.sh
# Create symlink for deck command
echo "Creating deck command..."
sudo ln -sf "${INSTALL_DIR}/src/deck.sh" /usr/local/bin/deck
# Update systemd service file
echo "Configuring systemd service..."
sudo sed -i "s|/opt/deck|${INSTALL_DIR}|g" /tmp/deck.service
sudo sed -i "s|User=clide|User=${USER}|g" /tmp/deck.service
sudo sed -i "s|Group=clide|Group=${GROUP}|g" /tmp/deck.service
sudo sed -i "s|/var/clide/deck|${DECK_DIR}|g" /tmp/deck.service
sudo sed -i "s|ReadOnlyPaths=/opt/deck|ReadOnlyPaths=${INSTALL_DIR}|g" /tmp/deck.service
# Install systemd service
sudo cp /tmp/deck.service /etc/systemd/system/deck.service
sudo systemctl daemon-reload
# Create default configuration
if [[ ! -f "${DECK_DIR}/config/deck.conf" ]]; then
echo "Creating default configuration..."
cat > "${DECK_DIR}/config/deck.conf" <<EOF
# DECK Configuration
MAX_CONCURRENT=3
QUEUE_DIR="${DECK_DIR}"
TIMEOUT_HOURS=24
AUTO_CLEANUP=true
PRIORITY_LABELS="urgent,security,hotfix"
LOG_LEVEL="info"
EOF
fi
echo ""
echo "Installation complete!"
echo ""
echo "Next steps:"
echo " 1. Start the daemon: sudo systemctl start deck"
echo " 2. Enable on boot: sudo systemctl enable deck"
echo " 3. Check status: deck status"
echo " 4. View logs: deck logs --tail"
echo " 5. Monitor queue: deck monitor --continuous"
echo ""
echo "Example usage:"
echo " deck queue myorg/myrepo 123 # Queue an issue"
echo " deck status # Check queue status"
echo " deck release myorg/myrepo 123 # Release completed issue"
echo ""