codenjoyme / codenjoy-portable-linux

1 stars 4 forks source link

Oneliner for ubuntu not works #7

Open BlackVS opened 3 years ago

BlackVS commented 3 years ago

https://github.com/codenjoyme/codenjoy-portable-linux:

cd /srv & sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/codenjoyme/codenjoy-portable-linux/master/install.sh) codenjoy" root

Running this command under non-root user will not install server due to bash will start in root. I.e.:

root@ubnt-codenjoy:/# ls
bin  boot  cdrom  dev  etc  home  lib  lib32  lib64  libx32  lost+found  media  mnt  opt  proc  root  run  sbin  snap  **srv**  swap.img  sys  tmp  usr  var

# ll
total 3987536
drwxr-xr-x  20 root root       4096 May  6 04:31 ./
drwxr-xr-x  20 root root       4096 May  6 04:31 ../
...
drwxr-xr-x   2 root root       4096 May  6 16:13 srv/

#cd /srv & sudo su -c "bash" root
[1] 1932

# pwd
/

Why? sudo su -c "bash" starts new process in defualt for user directory. For user root - it will start from / directory. I.e. sources will be downloaded to /codenjoy, not to /srv/codenjoy and rest of script fails due to can't find downloaded files

Solution:

sudo su -c "cd /srv;bash <(wget -qO- https://raw.githubusercontent.com/codenjoyme/codenjoy-portable-linux/master/install.sh) codenjoy" root
codenjoyme commented 3 years ago

Thanks, I'll fix it