Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added install.sh script #625

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Added install.sh script #625

wants to merge 4 commits into from

Conversation

singul4ri7y
Copy link
Contributor

@singul4ri7y singul4ri7y commented Aug 17, 2024

Changelog:

  • Added install.sh.

One script to rule them all, one script to find them, one script to bring them all and in the ease-of-use bind them.

  • Update the ci.yml script accordingly. If this PR gets merged, we may not need to put our hands on this script ever again (hopefully), Yay!

Resolves #620

@singul4ri7y
Copy link
Contributor Author

Though this script is not as advanced as localua.sh, but it is simple and should suffice for most of the use cases. We may add improvements to it in the future.

Copy link
Member

@hugomg hugomg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need some more time to think about where we want to go with this script.

Some parts of it, such as installing Luarocks, service the Github CI. Other parts, such as the usage, service our users and the README. Unfortunately, it seems that at times they pull in opposite directions.

install.sh Outdated
install_pallene
;;
--help)
usage 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the exit 0, outside the usage, instead of inside it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability; make the function only do one thing.

install.sh Outdated
cd $CLONE_DIR
wget -O - https://luarocks.org/releases/luarocks-$LUAROCKS_VERSION.tar.gz | tar xzf -
cd luarocks-$LUAROCKS_VERSION
./configure --with-lua=/usr/local
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of hardcoded paths in an installation script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But Lua internals will always be installed in /usr/local prefix. If there is a valid, MYCFLAGS way to install Lua to a different prefix, we should make it variable. Otherwise, it is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. Now LUA_PREFIX env variable controls related to install and lua prefix.

install.sh Outdated
if [ "${PALLENE_LOCAL:-0}" -eq 1 ]; then
SUPERUSER=
LOCAL_FLAG=--local
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest if-else

@singul4ri7y
Copy link
Contributor Author

singul4ri7y commented Aug 17, 2024

Some parts of it, such as installing Luarocks, service the Github CI. Other parts, such as the usage, service our users and the README. Unfortunately, it seems that at times they pull in opposite directions.

A tool can be useful to multiple usecases, just because it is working for both CI and users doesn't mean it's bad in general. We don't need something so powerful like localua.sh, which does everything regarding Lua under the sun. We need a simple script which is really useful in CI and increases UX by not allowing users to read through the entire readme and copy pastE commands. Users can install the entire Pallene ecosystem just with a single command (Here ecosystem means, Pallene, Lua internals and Pallene Tracer ;)). If users want, say they want to update just the Lua internals, they can do it in a single command too. So, I cannot see how it is not for the users.

Is the script super feature-rich? No, we don't need that.
Is the script getting most of the work done? Yes.
Will be more features added to the script if need be, which conforms to Pallene ecosystem? Yes.


# Versions
LUA_VERSION=5.4.7
LUAROCKS_VERSION=3.9.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the LUA_VERSION and PT_VERSION, the LUAROCKS_VERSION is only there because our CI needs a Lua version. In theory we could always go with a more recent version. (And in fact, it's probably about time we bump this to a newer Luarocks...)

CURR_DIR=$(pwd)

# Where to install/locate Lua
LUA_PREFIX=${LUA_PREFIX:-/usr/local}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please initialize everything that has a default value here on top. That way it's easier to see what all the configuration options are. (For example, PALLENE_LOCAL, etc)

echo
echo "Pallene Tracer:"
echo " Use PT_TESTS=1 to run Pallene Tracer tests after installation, e.g."
echo " PT_TESTS=1 ./install.sh ptracer"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the PT_TESTS functionality? I would rather have the CI run those in a separate step than integrate them into the installation script. It complicates the script, and also introduces a dependency on busted.

echo
echo " Use LUA_PLAT to define Lua platform. Defualt is 'linux'."
echo " Available platforms: guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris"
echo " e.g. LUA_PLAT=linux-readline ./install.sh lua"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default plat should be "guess"
In the documentation, we should encourage users to use linux-readline option.

usage
exit 1
;;
esac
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a way to make the script smarter, and only install the things that have a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An install.sh to make life easier
2 participants