2023-03-06 18:47:06 +00:00
#!/bin/bash
# Install Script for niminit v1.0
# (c) Sangelo, 2023
# Read LICENSE for more info
2023-03-06 20:57:32 +00:00
# Check for macOS
if [ [ $OSTYPE = = 'darwin' * ] ] ; then
2023-03-06 21:02:23 +00:00
echo "Warning: MacOS is currently untested. If there's any issues, please report them on GitHub."
read -p "Are you sure you want to continue? [y/N] " macOSChoice
2023-03-06 21:01:23 +00:00
case " $macOSChoice " in
2023-03-06 20:57:32 +00:00
[ yY] [ eE] [ sS] | [ yY] | [ zZ] | [ jJ] )
echo "Continuing with experimental support..."
2023-03-06 20:59:40 +00:00
; ;
2023-03-06 20:57:32 +00:00
*)
echo "Exiting..."
exit 0
2023-03-06 20:59:40 +00:00
; ;
2023-03-06 20:58:29 +00:00
esac
2023-03-06 20:57:32 +00:00
fi
2023-03-06 21:37:24 +00:00
# Compile program
2023-03-06 22:44:59 +00:00
nim c -o:bin/niminit src/niminit &&
2023-03-06 21:37:24 +00:00
# Create local bin folder if it doesn't exist
mkdir -p $HOME /.local/bin &&
# Copy binary to local bin folder
cp bin/niminit $HOME /.local/bin/niminit &&
# Create config directory & copy files
mkdir -p $HOME /.config/niminit &&
2023-03-07 19:20:21 +00:00
cp -r config/* $HOME /.config/niminit &&
2023-03-06 18:53:08 +00:00
2023-03-06 18:47:06 +00:00
# Print info message to export local bin if not already
2023-03-06 21:24:20 +00:00
printf "\n"
printf "\e[92m>>> \e[0mDone! If you haven't already added your local bin folder to your PATH, you can do so by adding the following line to your .profile, .bashrc or .zshrc"
2023-03-06 21:28:26 +00:00
printf "\n\e[1m\e[91mexport \e[0m\e[33m\$HOME./local/bin:\$PATH\n"