juliawin icon indicating copy to clipboard operation
juliawin copied to clipboard

Make an equivalent Linux script

Open heetbeet opened this issue 5 years ago • 6 comments

From https://www.reddit.com/r/Julia/comments/gbedwz/julia_windows_installation_script_with_batteries/fp7s8xl/

  • write python or bash code to replace the Windows .bat parts
  • get to the Julia part as fast as possible, and try to cross-platform generalise as much as poossible
  • maybe seperate the bat / julia / python code and allow the installer scripts to automatically get the julia part from github as a proper .jl file (added security issues).
  • get some bash glue going to replace the .bat entry points

This is a good template for the bash glue:

#--------------------------------------------------
# I might be a symlink, so here is my actual location
#--------------------------------------------------
#From https://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

#--------------------------------------------------
# Setup the environment variables and paths for Juliawin
#--------------------------------------------------
__environmentcode__

#--------------------------------------------------
# Finally, run this binary please
#--------------------------------------------------
"$DIR/__relativepathtobin__" "$@"

heetbeet avatar May 02 '20 09:05 heetbeet

If we really want to, we can have Batch, Python and Julia within one script, and tell Linux to run it as Python. It would feel strange to run a .bat extension in linux, but it works :P

#!/usr/bin/env python
""" 
clear
:: ========== Batch part ==========
@echo off

echo Hello world from bat
python "%~0"
julia "%~0"

exit /b 
"""
#=
# ========== Python part ==========
print("Hello world from Python")

""" 
=#
# ========== Julia part ==========
print("Hello world from Julia")

# """

heetbeet avatar May 02 '20 10:05 heetbeet

This is implemented, but not in main branch yet. There are also still some bugs to fix.

heetbeet avatar May 06 '20 10:05 heetbeet

I removed all the linux parts for now untill I can focus on adding a proper linux implimentation

heetbeet avatar May 17 '20 19:05 heetbeet

MacOS support will be great as well.

Maybe use PowerShell to support them all?

RoyiAvital avatar May 12 '23 18:05 RoyiAvital

Since I've been able to only sparsely maintaining this project, I'm scaling back on extra features to rather focus on GitHub actions with a continual release cycle. Since I don't have a Mac, and since I don't have a linux port yet (which I think would be the first step for cross-platform use) I'm not going to put work into an MacOS release.

heetbeet avatar May 24 '23 05:05 heetbeet

Once you have something for Linux I'd be happy to try helping on the macOS front. Though, have you thought about using PowerShell? It might maje things easier for multi OS support, no?

RoyiAvital avatar May 24 '23 05:05 RoyiAvital