Ladder99 / ladder99

Ladder99 - connects factory devices to database and visualizations using MTConnect, an open standard.
https://mriiot.com
Apache License 2.0
27 stars 10 forks source link

/home/fiab/ladder99/shell/l99: line 56: /home/fiab/shell/commands/using: No such file or directory #230

Closed Dowster64 closed 12 months ago

Dowster64 commented 12 months ago

When running l99 from command line with new user 'fiab' the path to the using dir looks like it's missing ladder99. It should say using the 'example'

Using 'example' for Ladder99 setup, as found in the 'setups' folder.

Dowster64 commented 12 months ago

I've included the commands I ran, and also the command after. Looks like a problem with $repo_root which isn't an env variable btw. $L99_HOME is set correctly though. On my system it's L99_HOME=/home/fiab/ladder99

fiab@fiabtest:~/ladder99 $ l99
/home/fiab/ladder99/shell/l99: line 46: ${$L99_HOME:-$repo_root}: bad substitution

Usage: l99 COMMAND [PARAMS]

Run a Ladder99 command.

COMMAND
    build     build a cross-platform Docker image, push to Docker hub
    dev       start services (builds images locally)
    disk      show disk usage for current setup
    download  clone a git repo to use as current setup
    images    list downloaded Docker images
    init      create a new setup folder
    list      list running services
    logs      follow and search logs of a running or stopped service
    restart   restart services (stop then start)
    start     start services (pulls images from Docker hub as needed)
    stop      stop running services
    update    update source code for ladder99 and current setup
    use       specify setup to use with l99 commands

Run the command with -h for help on that command.

Examples
    l99 list
    l99 use example
    l99 disk
    l99 start agent
    l99 images
    l99 logs agent error
    l99 stop agent
    l99 update
    l99 init my-company

/home/fiab/ladder99/shell/l99: line 56: /home/fiab/shell/commands/using: No such file or directory
fiab@fiabtest:~/ladder99 $ l99 use example
/home/fiab/ladder99/shell/l99: line 46: ${$L99_HOME:-$repo_root}: bad substitution
/home/fiab/ladder99/shell/l99: line 69: /home/fiab/shell/commands/use: No such file or directory
fiab@fiabtest:~/ladder99 $
Dowster64 commented 12 months ago

Note, I just learnt how to git checkout a specific tag namely v0.11.7 few :-)

ottobolyos commented 12 months ago

I have just fixed this very same issue last night (PR #228; d8b9bbed8c58bca082cec26ee7f2c5efecf3b7c1). The problem laid in the fact that the scripts didn’t use absolute paths (using a variable), thus when you run them from a different CWD from the (cloned) repository root folder, it would fail to run the scripts executed from the respective scripts.

Pull the changes from the master branch and you should be good to go.

One note: we update ~/.bashrc in shell/install/cli, however, when you run the script multiple times, it would append ~/.bashrc multiple times. I am about to fixed that issue, however, for now, you should remove the duplicate lines from it. It should not cause any issues, but it slows its processing.

Update: I have just fixed the config addition to ~/.bashrc (see PR #232; 76158b2abea8e7eb8d97340d72fcf688136e8e69). Now, when you run shell/commands/cli (possibly via shell/l99), it will remove the existing Ladder99 config if it exists first, then it will append a new config.