Skip to content

Instantly share code, notes, and snippets.

@monkstone
Last active October 16, 2020 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monkstone/412d7b26381dcfdb4cd5a454731745a4 to your computer and use it in GitHub Desktop.
Save monkstone/412d7b26381dcfdb4cd5a454731745a4 to your computer and use it in GitHub Desktop.
Installer for PiCrate on Manjaro ARM
#!/usr/bin/env bash
# Bash Script to install PiCrate and dependencies on Manjaro Arm
# anticipating JRuby-9.3.0.0 which will match MRI ruby-2.6
MRI_RUBY="2.6.0"
GEM_RC="${HOME}/.gemrc"
GEM="${HOME}/.gem/ruby/${MRI_RUBY}"
function gem_rc {
if [[ (-f ${GEM_RC}) ]]
then
cat "$GEM_RC"
else
touch "$GEM_RC"
echo "---" >> "$GEM_RC"
echo "gem: \"--no-document\"" >> "$GEM_RC"
fi
}
gem_rc
function install_java {
if [ -x "$(command -v java)" ]
then
java -version
else
sudo pacman -S jdk-openjdk
echo "Installed OpenJDK"
fi
}
install_java
function java_home {
if [[ (-n ${JAVA_HOME}) ]]
then
echo "${JAVA_HOME}"
else
sudo touch "$JDK_PROFILE"
echo "${JDK_STRING}" | sudo tee -a "${JDK_PROFILE}"
fi
}
function install_jruby {
if [ -x "$(command -v jruby)" ]
then
jruby --version
else
sudo pacman -S jruby
echo "Installed JRuby"
fi
}
install_jruby
function create_gem_home {
if [[ (-n ${GEM_HOME}) ]]
then
echo "GEM_HOME=${GEM_HOME}"
else
mkdir -p "${GEM}"
commands=(
"GEM_HOME=${GEM}"
"GEM_PATH=${GEM}"
"PATH=\"\${GEM_PATH}/bin:\${PATH}\""
)
for cmd in "${commands[@]}"
do
echo "export ${cmd}" >> ~/.bashrc
done
fi
}
create_gem_home
function install_picrate {
export GEM_HOME="${GEM}"
export PATH="${GEM}"/bin:"${PATH}"
jgem install picrate
}
install_picrate
function install_geany {
if [ -x "$(command -v geany)" ]
then
geany --version
else
sudo pacman -S geany
echo "Installed geany"
fi
}
install_geany
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment