-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
49 lines (38 loc) · 1.15 KB
/
setup.sh
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
#!/bin/bash
# Check if .env file already exists
if [ -f ".env" ]; then
echo ".env file already exists. Please delete or backup before running this script."
exit 1
fi
echo "Setting up your environment variables."
echo "Press enter to accept the default value shown in brackets."
# Loop through .env.example file
while IFS='=' read -r key default_value; do
# Skip if line is empty
if [ -z "$key" ]; then
continue
fi
# Prompt for value with default
read -p "$key=($default_value) " value
# Use default value if no input is given
if [ -z "$value" ]; then
value=$default_value
fi
# Write to .env file
echo "$key=$value" >>.env
done <.env.example
echo "Creating .env file with your settings..."
# Create cupsd.conf if it doesn't exist
if [ ! -f "cupsd.conf" ]; then
echo "Creating cupsd.conf file..."
touch cupsd.conf
fi
# Create printers.conf if it doesn't exist
if [ ! -f "printers.conf" ]; then
echo "Creating printers.conf file..."
touch printers.conf
fi
# Run docker compose up
echo "Starting docker compose..."
docker compose up -d
echo "Setup complete! Your project is starting up."