Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Setup environment variables
- PATH=$PATH
- export PATH
- INSTALL_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
- ENV_VARIABLE="SYNCHRONIZED_LIGHTS_HOME=${INSTALL_DIR}"
- exists=`grep -r "$ENV_VARIABLE" /etc/profile*`
- if [ -z "$exists" ]; then
- echo "# Lightshow Pi Home" > /etc/profile.d/lightshowpi.sh
- echo "$ENV_VARIABLE" >> /etc/profile.d/lightshowpi.sh
- echo "export SYNCHRONIZED_LIGHTS_HOME" >> /etc/profile.d/lightshowpi.sh
- echo "" >> /etc/profile.d/lightshowpi.sh
- echo "# Add Lightshow Pi bin directory to path" >> /etc/profile.d/lightshowpi.sh
- echo "PATH=\$PATH:${INSTALL_DIR}/bin" >> /etc/profile.d/lightshowpi.sh
- echo "export PATH" >> /etc/profile.d/lightshowpi.sh
- # Force set this environment variable in this shell (as above doesn't take until reboot)
- export $ENV_VARIABLE
- fi
- KEEP_EN="Defaults env_keep="SYNCHRONIZED_LIGHTS_HOME""
- exists=`grep "$KEEP_EN" /etc/sudoers`
- if [ -z "$exists" ]; then
- echo "$KEEP_EN" >> /etc/sudoers
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement