1. AIO installer problem
- Posted by SDPringle Sep 15, 2015
- 1546 views
I tried to install with the AIO installer and it crashes with the following message:
/home/duro/data/euphoria/wxeu/install_AIO.ex:12 in procedure logMsg() variable <no-name> has not been assigned a value ... called from /home/duro/data/euphoria/wxeu/install_AIO.ex:1 --> See ex.err
Running the source code below is working now, no immediate crash yet. It looks the problem is only in the binary.
Shawn
Forked from Re: Is there any chance of a .deb file for wxEuphoria?
[Jean-Marc, Does it install more than the OpenEuphoria standard package or does it install everything? Looking at distrowatch.org, I see the top three distributions use apt-get (Mint, Ubuntu, and Debian). This is encouraging for me.
SDPringle
Hi Shawn,
It does following:
- check that user is connected as root
- install all packages listed in file dependencies.txt
- create the target directory (only one level, no mkdir -p but this could be changed)
- untar the archive containing a preinstalled OpenEuphoria 4.1 plus wxEuphoria include file and libraries, plus my own include files
- update and apply environment variables (PATH, EUDIR, EUINC)
Here is the code of the version I used for the 32-bit package installer:
include std/filesys.e include std/error.e include std/io.e include std/pipeio.e as pipe object void = 0 sequence InitialDir integer f_debug ------------------------------------------------------------------------------ public procedure logMsg(sequence msg) puts(f_debug, msg & "\n") flush(f_debug) puts(1, msg & "\n") end procedure ------------------------------------------------------------------------------ public function execCommand(sequence cmd) sequence s = "" object z = pipe:create() object p = pipe:exec(cmd, z) if atom(p) then printf(2, "Failed to exec() with error %x\n", pipe:error_no()) pipe:kill(p) return -1 end if object c = pipe:read(p[pipe:STDOUT], 256) while sequence(c) and length(c) do s &= c if atom(c) then printf(2, "Failed on read with error %x\n", pipe:error_no()) pipe:kill(p) return -1 end if c = pipe:read(p[pipe:STDOUT], 256) end while --Close pipes and make sure process is terminated pipe:kill(p) return s end function ------------------------------------------------------------------------------ function isInstalled(sequence package) sequence s = execCommand("dpkg-query -s " & package & " | grep Status") if length(s) and match("ok installed", s) then return 1 else return 0 end if end function ------------------------------------------------------------------------------ procedure installIfNot(sequence package) if isInstalled(package) then logMsg(package & " already installed") else logMsg("apt-get install -y " & package) sequence s = execCommand("apt-get install -y " & package) logMsg(s) end if end procedure ------------------------------------------------------------------------------ sequence cmd = command_line() sequence targetDirectory = "/usr/local/euphoria-4.1.0" integer lg = length(cmd) if lg < 3 then logMsg("Usage: install_AIO [<target directory>]") logMsg("Using default target directory: /usr/local/euphoria-4.1.0") else targetDirectory = cmd[3] end if sequence info = pathinfo(cmd[2]) void = chdir(info[PATH_DIR]) InitialDir = current_dir() f_debug = open(InitialDir&SLASH&info[PATH_BASENAME]&".log", "w") crash_file(InitialDir&SLASH&info[PATH_BASENAME]&".err") -- verify user is root sequence s = execCommand("id") logMsg(s) if not match("uid=0(root) gid=0(root) groupes=0(root)", s) then logMsg("Need to be run as root") close(f_debug) abort(1) end if -- install dependencies s = read_lines(InitialDir&SLASH&"dependencies.txt") for i = 1 to length(s) do installIfNot(s[i]) end for -- install OpenEuphoria 4.1 s = execCommand("mkdir "&targetDirectory) logMsg(s) s = execCommand("tar -xvf "&InitialDir&SLASH&"eu41.tgz -C "&targetDirectory) logMsg(s) -- update environment variables if append_lines("/etc/bash.bashrc", { "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:"&targetDirectory&"/bin", "export EUDIR="&targetDirectory, "export EUINC="&targetDirectory&"/include/" }) = -1 then logMsg("Failed to append lines to /etc/bash.bashrc") close(f_debug) abort(1) end if -- apply environment variables s = execCommand(". "&SLASH&"/etc/bash.bashrc") logMsg(s) close(f_debug)
Regards
Jean-Marc
2. Re: AIO installer problem
- Posted by petelomax Sep 15, 2015
- 1550 views
Running the source code below is working now, no immediate crash yet. It looks [like] the problem is only in the binary.
If you call logMsg() before opening f_debug, that'll do it. Try running the source without specifying a directory on the command line.
integer f_debug procedure logMsg() ?f_debug end procedure sequence cmd = command_line() integer lg = length(cmd) if lg < 3 then logMsg() end if f_debug = 5 -- open(...) logMsg() -- close(f_debug)
Pete
3. Re: AIO installer problem
- Posted by SDPringle Sep 15, 2015
- 1533 views
It seems that I wasn't clear when I described what happened.
I had already installed 4.1 via a complicated process of backups, eubins and mercurial. After this, I downloaded AIO installer: I ran it as root. The installer didn't work. The installer is some kind of bound or compiled binary.
I grabbed the source that was posted in the thread this is forked from and that did work. I don't need any help modifying the source to get it working because the source code did work.
The problem is these AIO installers are on the front page of Open Euphoria and are apparently broken versions of the working source code.
4. Re: AIO installer problem
- Posted by petelomax Sep 15, 2015
- 1521 views
Excuse me for trying to be helpful. There is a very obvious (to me) bug in that code you posted.
What I should have done is kept my trap shut, and wait for someone to take your word for the fact there was no problem in the source code, so try a rebuild, re-upload, and watch it still crash.
Pete
5. Re: AIO installer problem
- Posted by SDPringle Sep 15, 2015
- 1498 views
I am sorry for offending you Pete. And, you were right about the bug. I guess there are two source code listings in the thread and for this post I copied and pasted the wrong one. No wonder you saw a bug when the code was working!
The one I actually run copied from my editor was:
include std/filesys.e include std/error.e include std/io.e include std/pipeio.e as pipe object void = 0 sequence InitialDir integer f_debug ------------------------------------------------------------------------------ public function execCommand(sequence cmd) sequence s = "" object z = pipe:create() object p = pipe:exec(cmd, z) if atom(p) then printf(2, "Failed to exec() with error %x\n", pipe:error_no()) pipe:kill(p) return -1 end if object c = pipe:read(p[pipe:STDOUT], 256) while sequence(c) and length(c) do s &= c if atom(c) then printf(2, "Failed on read with error %x\n", pipe:error_no()) pipe:kill(p) return -1 end if c = pipe:read(p[pipe:STDOUT], 256) end while --Close pipes and make sure process is terminated pipe:kill(p) return s end function ------------------------------------------------------------------------------ function isInstalled(sequence package) sequence s = execCommand("dpkg-query -s " & package & " | grep Status") if length(s) and match("ok installed", s) then return 1 else return 0 end if end function ------------------------------------------------------------------------------ procedure installIfNot(sequence package) if isInstalled(package) then puts(2, package & " already installed\n") else puts(2, "apt-get install -y " & package & "\n") sequence s = execCommand("apt-get install -y " & package) puts(2, s & "\n") end if end procedure ------------------------------------------------------------------------------ sequence cmd = command_line() integer lg = length(cmd) if lg>2 then puts(1, "Usage: eui install_AIO.ex\n") end if sequence info = pathinfo(cmd[2]) void = chdir(info[PATH_DIR]) InitialDir = current_dir() f_debug = open(InitialDir&SLASH&info[PATH_BASENAME]&".log", "w") crash_file(InitialDir&SLASH&info[PATH_BASENAME]&".err") sequence s = read_lines(InitialDir&SLASH&"dependencies.txt") for i = 1 to length(s) do installIfNot(s[i]) end for s = execCommand("tar -xf "&InitialDir&SLASH&"eu41.tgz -C /usr/local/euphoria-4.1.0") if append_lines("/etc/bash.bashrc", { "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/euphoria-4.1.0/bin", "export EUDIR=/usr/local/euphoria-4.1.0", "export EUINC=/usr/local/euphoria-4.1.0/include/" }) = -1 then puts(2, "Failed to append lines to /etc/bash.bashrc\nAre you connected as root?\n") end if close(f_debug)
6. Re: AIO installer problem
- Posted by petelomax Sep 16, 2015
- 1478 views
I am sorry for offending you Pete
No worries
7. Re: AIO installer problem
- Posted by jmduro Sep 17, 2015
- 1474 views
I tried to install with the AIO installer and it crashes with the following message:
/home/duro/data/euphoria/wxeu/install_AIO.ex:12 in procedure logMsg() variable <no-name> has not been assigned a value ... called from /home/duro/data/euphoria/wxeu/install_AIO.ex:1 --> See ex.err
Running the source code below is working now, no immediate crash yet. It looks the problem is only in the binary.
Shawn
Sure there is a problem: /home/duro is my home directory. Yours should be different.
I have to check if somewhere during compilation full pathnames are used instead of relative ones or references to environment variables.
Regards
Jean-Marc
8. Re: AIO installer problem
- Posted by jmduro Sep 17, 2015
- 1462 views
Sure there is a problem: /home/duro is my home directory. Yours should be different.
I have to check if somewhere during compilation full pathnames are used instead of relative ones or references to environment variables.
Regards
Jean-Marc
OK I understand now. I wrote in a file which pathname was defined later (InitialDir). I should not have used logMsg before I defined InitialDir and as Pete wrote before I opened f_debug.
Sorry
Jean-Marc