Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error: unexpected newline #37

Open
Fyobl opened this issue Oct 28, 2021 · 14 comments
Open

syntax error: unexpected newline #37

Fyobl opened this issue Oct 28, 2021 · 14 comments

Comments

@Fyobl
Copy link

Fyobl commented Oct 28, 2021

Sorry if this is a dumb question but how do i get rid of this error?

/opt/install.sh: /opt/YAMon4/includes/getlatest.sh: line 2: syntax error: unexpected newline

@bangdosa93
Copy link

bangdosa93 commented Nov 3, 2021

it looks like script is broken. I checked and instead of getting the getlatest.sh, it grabs a redirect message, resulting it breaking install.sh

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://usage-monitoring.com/current/YAMon4/Setup/includes/getlatest.sh?1635838701">here</a>.</p>
</body></html>

@Fyobl
Copy link
Author

Fyobl commented Nov 3, 2021

@bangdosa93

What's the fix for this?

@bangdosa93
Copy link

Not sure, I'm not much of a coder X(..
but from the redirect message, I assume that links need to be updated in the all the scripts that get something from the yamon website to use https rather than http

@jwjenkin
Copy link

Open install.sh and change the base url from http:// to https://

@QuzarDC
Copy link

QuzarDC commented Dec 2, 2021

Open install.sh and change the base url from http:// to https://

In my attempts, this alone does not correct the issue. It will allow includes/getlatest.sh to be retrieved, but then that file also manually has the url specified ( see line 19:

local src="http://www.usage-monitoring.com/$directory/YAMon4/Setup/${path}?$_ts"
). Since this file is automatically retrieved by the install script and overwritten on each run, there's no method to merely edit the install script and have this work.

Dvineone's update should make it work: #38

@Fyobl
Copy link
Author

Fyobl commented Dec 2, 2021

@QuzarDC

only had chance yesterday to test this and got the same error! I’m glad you found a fix and hopefully it will get merged!

@BcCamel
Copy link

BcCamel commented Dec 19, 2021

I did find a fix for this issue. As mentioned about the html links reference HTTP:// rather than HTTPS://. You can change the link in the install.sh script to https and then run it. That will download the getatest,sh script to the /opt/YAMon4/includes directory. The problem lies in that when the install.sh is run it downloads a new getlatest.sh script, so if you fix the http problem in the getlatest.sh script it will be overwritten when you run install.sh again. The solution is to run the install.sh script which will give you the newline error. Then edit the getlatest.sh script changing the http lines to https. Then you comment out the lines in the install.sh script that download the getlatest.sh script, and run the install.sh script again. The install.sh script will run but not download the getlatest.sh script, which is already in the directory and the http entries have been fixed. At that point the install.sh script runs normally and performs the install.

Comment out these 2 lines in the install.sh script: should be lines 144 and 145
#_ts=$(date +"%s")
#yget "$getlatest" "$baseurl/$directory/YAMon4/Setup/includes/getlatest.sh?$_ts"

Save the file and run the install.sh and it should install with no problem.

@electricmessiah
Copy link

electricmessiah commented Jan 23, 2022

This does not fix the issue for me. The getlatest.sh just contains some HTML, and if I download that file directly and proceed after commenting out the suggested lines in install.sh, an error appears with version.sh, which also just contains HTML. Has anyone solved this? I can't get it to work!

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://usage-monitoring.com/current/YAMon4/Setup/includes/getlatest.sh?1642903674">here</a>.</p>
</body></html>

@pkerney
Copy link

pkerney commented Mar 13, 2022

The install process is basically broken with missing links everywhere.
Also the scripts are a varying mix of Linux and Windows format files and the Windows ones just don't work on the router.
Refer issue #35

@isslam95
Copy link

isslam95 commented Aug 18, 2022

uninstall curl and using wget to download fix it for me on openwrt

@Avrution
Copy link

Seems this is still broken. Guess sticking with v3 yet again.

@AmateurCoder105
Copy link

Whenever you extract a zip archive containing UNIX formatted text files onto a Windows system, Windows inserts carriage returns into them, effectively corrupting the scripts. I was able to fix this problem using the dos2unix utility which is available on sourceforge (https://sourceforge.net/projects/dos2unix/). I downloaded and extracted the zip archive on my laptop -- I had to use this method because wget wasn't working for me. You run this on Windows (it also supports MAC) and you want to run it to recursively convert all text files. Then I used winscp to copy the entire file structure to the USB drive while it was connected to my router. Afterwards, I was able to run the setup program.

@GabyPCgeeK
Copy link

I was able to get it working by adding -C - -L to curl in install.sh. After it downloads getlatest.sh and fails, add -L to curl on getlatest.sh. Run install.sh one more time and it works.

@mifrey00
Copy link

mifrey00 commented Jun 9, 2023

I was able to get it working by adding -C - -L to curl in install.sh. After it downloads getlatest.sh and fails, add -L to curl on getlatest.sh. Run install.sh one more time and it works.

That worked for me. I just added -L to the curl command in install.sh then run it, then I added -L in getlatest.sh and commented the call yget "$getlatest"... in install.sh to prevent downloading it again and finally ran install.sh again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

13 participants