Skip to content

Issue with configure-instance.sh script on mac #51

Description

@SamEdwardes

I am following the guide here:

I ran the following commands:

$ git clone https://github.com/TeamPiped/Piped-Docker

$ cd Piped-Docker

$ ./configure-instance.sh 
Enter a hostname for the Frontend (eg: piped.kavin.rocks):
piped.example.xyz
Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):
piped-api.example.xyz
Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):
piped-proxy.example.xyz
Enter the reverse proxy you would like to use (either caddy or nginx):
caddy
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config/docker-compose.c ...": command c expects \ followed by text

I was able to fix it by modifying the configure-instance.sh script:

#!/bin/sh
echo "Enter a hostname for the Frontend (eg: piped.kavin.rocks):" && read -r frontend
echo "Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):" && read -r backend
echo "Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):" && read -r proxy
echo "Enter the reverse proxy you would like to use (either caddy or nginx):" && read -r reverseproxy

rm -rf config/
rm -f docker-compose.yml

cp -r template/ config/

conffiles=$(find config -type f ! -name '*.yml')
sed -i '' "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i '' "s/PROXY_HOSTNAME/$proxy/g" $conffiles

sed -i '' "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml

mv config/docker-compose.$reverseproxy.yml docker-compose.yml

Why was it not working? Per Chat GPT:

Use Portable sed Syntax: The -i option in sed can behave differently on different systems (e.g., macOS vs Linux). To make it more portable, especially on macOS, you might need to provide an empty string for the backup extension:

sed -i '' "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i '' "s/PROXY_HOSTNAME/$proxy/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml
On Linux, the -i option can be used without a backup extension:

sed -i "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i "s/PROXY_HOSTNAME/$proxy/g" $conffiles
sed -i "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions