AIO installer problem

new topic     » topic index » view thread      » older message » newer message

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?

jmduro said...
SDPringle said...

[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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu