dotfiles/scripts/janet.sh

44 lines
901 B
Bash
Raw Normal View History

2021-11-24 14:14:39 +00:00
#!/usr/bin/env bash
2021-12-11 07:51:17 +00:00
VERSION="1.19.2"
2021-11-24 14:14:39 +00:00
function install () {
cd ~
2021-12-11 07:51:17 +00:00
wget https://github.com/janet-lang/janet/archive/refs/tags/v${VERSION}.tar.gz
tar zxvf v${VERSION}.tar.gz
cd janet-${VERSION}
sudo make
sudo make test
sudo mv -v build bin
cd ~
sudo mv -v janet-${VERSION} /opt/janet
sudo rm v${VERSION}.tar.gz
sudo rm -rf janet-${VERSION}
sudo ln -s /opt/janet/bin/janet /usr/local/bin/janet
2021-11-24 14:14:39 +00:00
git clone --depth=1 https://github.com/janet-lang/jpm.git
cd jpm
2021-12-11 07:51:17 +00:00
sudo /opt/janet/bin/janet bootstrap.janet
cd ~
sudo rm -rf jpm
2021-11-24 14:14:39 +00:00
printf "\n\n"
2021-12-11 07:51:17 +00:00
janet -v
}
function uninstall () {
echo "uninstalling janet"
sudo rm -rf /opt/janet
sudo rm /usr/local/bin/jpm
sudo rm /usr/local/bin/janet
2021-11-24 14:14:39 +00:00
}
if [ "$1" == "install" ]; then
install
elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then
uninstall
else
echo "please specify args with install or uninstall"
fi