Heard about this project on Linux Unplugged, wanted to give it a try. I use zsh, and the install.sh butchered my prompt by trying to source ~/.bashrc into a zsh session. I re-wrote the script to detect if the user is running bash or zsh and change the output file accordingly, but this install.sh doesn't seem to be in the git tree anywhere so I wasn't able to make a pull request.
Also, before editing a user's bashrc/zshrc we should give them the opportunity to do it manually if they wish. I know a lot of people (myself included) have a lot of custom stuff in their shell startup and the thought of an automated script messing with it always makes me nervous. (Yes, this script just appends lines to the end, but still.)
Here's what I wrote, it could definitely be improved upon but I wanted to at least pass on the two minutes of work I did!
#!/bin/sh
SCRIPT_DIRECTORY=$(dirname "$(readlink -f "$0")")
if [ "$SHELL" = "/bin/bash" ]; then
RCFILE=~/.bashrc
elif [ "$SHELL" = "/usr/bin/zsh" ]; then
RCFILE=~/.zshrc
else
RCFILE=~/.profile # if we can't detect the shell, use a sane default that all modern shells look at
fi
echo "This installation script will try and set things up automatically."
echo "In order to do so, some environment variables will be appended to $RCFILE"
echo "If you want to do this manually, hit CTRL-C now and examine this script."
echo "Otherwise, just hit enter and we'll do the work for you!"
read wait # just wait for the user to read
echo "" >> $RCFILE # in case the rcfile doesn't end with a newline, forcefully add one
echo "# mp4grep environment variables -------" >> $RCFILE
echo "export MP4GREP_CACHE='$SCRIPT_DIRECTORY/.mp4grep_cache'" >> $RCFILE
echo "export MP4GREP_MODEL='$SCRIPT_DIRECTORY/model'" >> $RCFILE
echo -n 'export PATH="$PATH:' >> $RCFILE
echo "$SCRIPT_DIRECTORY/bin\"" >> $RCFILE
echo "# --------------------------------------" >> $RCFILE
echo "Completed environment setup for mp4grep: "
echo "MP4GREP_CACHE=$SCRIPT_DIRECTORY/.mp4grep_cache"
echo "MP4GREP_MODEL=$SCRIPT_DIRECTORY/model"
echo -n 'PATH=$PATH:'
echo "$SCRIPT_DIRECTORY/bin"
echo ""
echo "Variables exported in $RCFILE"
source $RCFILE