MarkusMcNugen / docker-qBittorrentvpn

Docker container which runs a headless qBittorrent client with WebUI and optional OpenVPN
https://hub.docker.com/r/markusmcnugen/qbittorrentvpn/
GNU General Public License v3.0
171 stars 92 forks source link

Add warning of possible undesired line-ending conversion when cloning in Windows #56

Open brogers5 opened 4 years ago

brogers5 commented 4 years ago

The last image was pushed 5 months ago to Docker Hub, and qBittorrent has since become out-of-date by a few releases. Given this, I figured I'd build my own image so I could use the latest version.

In the process, I initially encountered some run-time failures when starting the container:

/etc/openvpn/start.sh: line 3: set: - : invalid option, set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...], /etc/openvpn/start.sh: line 4: $'\r': command not found, /etc/openvpn/start.sh: line 7: $'\r': command not found, /etc/openvpn/start.sh: line 134: syntax error near unexpected token elif', /etc/openvpn/start.sh: line 134:elif [[ $VPN_ENABLED == "no" ]]; then ',

The root cause ended up being that I had Git for Windows configured to checkout text files (including this script) with Windows-style line-endings, as officially recommended for Windows users. Thankfully, this is a simple fix: checkout with Unix-style line-endings instead, preferably on a per-repository basis.

I added a quick blurb to the README instructing Windows users to clone accordingly to work around this.

brogers5 commented 4 years ago

Ran into this same problem in another project and pushed another commit implementing a solution I liked better: adding a .gitattributes file to force a specific line-ending for Bash scripts, regardless of how Git is configured. This ought to enable a more hands-off approach.