Skip to content

Commit 3058b97

Browse files
committed
Update environment file location to /etc/simpleprint and ensure proper permissions
1 parent 365485f commit 3058b97

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

install.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,20 @@ sudo systemctl restart "$SERVICE_NAME"
7171

7272
# Ensure .env file exists in /home/coda/simpleprint
7373

74-
# Use ~/.simpleprint/.env for environment
75-
ENV_DIR="$HOME/.simpleprint"
74+
75+
# Use /etc/simpleprint/.env for environment
76+
ENV_DIR="/etc/simpleprint"
7677
ENV_FILE="$ENV_DIR/.env"
7778
if [ ! -d "$ENV_DIR" ]; then
78-
mkdir -p "$ENV_DIR"
79+
sudo mkdir -p "$ENV_DIR"
7980
fi
8081
if [ ! -f "$ENV_FILE" ]; then
8182
echo ".env not found in $ENV_DIR. Creating a default .env file..."
8283
RAW_ENV_URL="https://raw.githubusercontent.com/${REPO}/${TAG}/lib/example.env"
8384
if curl --output /dev/null --silent --head --fail "$RAW_ENV_URL"; then
84-
curl -L "$RAW_ENV_URL" -o "$ENV_FILE"
85+
sudo curl -L "$RAW_ENV_URL" -o "$ENV_FILE"
8586
else
86-
cat <<EOF > "$ENV_FILE"
87+
sudo tee "$ENV_FILE" > /dev/null <<EOF
8788
# Default environment for simpleprint
8889
PRINTER_DEVICE=/dev/usb/lp0
8990
LOG_LEVEL=info

0 commit comments

Comments
 (0)