71 lines
1.9 KiB
Bash
Executable File
71 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
ERR='\033[0;31m'
|
|
WARN='\033[0;33m'
|
|
NC='\033[0m'
|
|
|
|
path=`dirname "$(readlink -f "$0")"`
|
|
|
|
if [ $EUID -ne 0 ]; then
|
|
echo -e "${ERR}In order to install this utility, root permissions must be granted.${NC}"
|
|
echo "This script will add files to the following directories:"
|
|
echo "/usr/local/bin/"
|
|
echo "/usr/local/share/man/man1/"
|
|
echo "/etc/"
|
|
echo ""
|
|
echo 'Please run as root by switching to superuser first or running as "sudo install"'
|
|
echo "Alternatively, you can manually install this utility by symlinking $path/rsstube in /usr/local/bin/ and $path/rsstube.1 in /usr/local/share/man/man1/"
|
|
echo "Afterwards, run mandb as root to update your manual database."
|
|
echo "Copy the templates/config file to /etc/rsstube/"
|
|
exit
|
|
fi
|
|
|
|
execpath=/usr/local/bin/rsstube
|
|
manpath=/usr/local/share/man/man1/rsstube.1
|
|
file_problem=""
|
|
|
|
if [[ -e $execpath ]]
|
|
then
|
|
# rm $execpath
|
|
echo -e "${WARN}Error: $execpath already exists.${NC}"
|
|
echo "If it was added from a version of rsstube < 2.0.0, then please delete it before installing:"
|
|
echo "sudo rm $execpath"
|
|
file_problem="true"
|
|
fi
|
|
|
|
if [[ -e $manpath ]]
|
|
then
|
|
# rm $manpath
|
|
echo -e "${WARN}Error: $manpath already exists.${NC}"
|
|
echo "If it was added from a version of rsstube < 2.0.0, then please delete it before installing:"
|
|
echo "sudo rm $manpath"
|
|
file_problem="true"
|
|
fi
|
|
|
|
if [[ -e /usr/bin/rsstube ]]
|
|
then
|
|
echo -e "${WARN}Error: /usr/bin/rsstube exists and has a conflicting name.${NC}"
|
|
echo "Please delete /usr/bin/rsstube:"
|
|
echo "sudo rm /usr/bin/rsstube"
|
|
file_problem="true"
|
|
fi
|
|
|
|
if [[ -n $file_problem ]]
|
|
then
|
|
echo -e "${WARN}Failed to install. Please fix above problems before trying again.${NC}"
|
|
exit
|
|
fi
|
|
|
|
|
|
ln -s $path/rsstube /usr/local/bin/rsstube
|
|
ln -s $path/rsstube.1 /usr/local/share/man/man1/rsstube.1
|
|
mandb
|
|
if [[ ! -d /etc/rsstube ]]
|
|
then
|
|
mkdir /etc/rsstube
|
|
fi
|
|
cp templates/config /etc/rsstube/config
|
|
|
|
echo "rsstube is now installed. You can use it by typing:"
|
|
echo "rsstube <url>"
|