#!/bin/sh # # Installation script for Pombo. # if [ $(id -ru) -ne 0 ]; then echo "! You need to have root rights !" exit 1 fi inst_dir=/usr/local/bin [ -d ${inst_dir} ] || inst_dir=/usr/local/sbin script=$(readlink -f "$0") # Absolute path install.sh script is in src_dir=$(dirname "$script") # Absolute path of Pombo main dir (without trailing /) src_dir=$(dirname "$src_dir") echo "\nInstalling (verbose) ..." [ -f /etc/pombo.conf ] && mv -fv /etc/pombo.conf /etc/pombo.conf.$(date '+%s') install -v ${src_dir}/pombo.conf /etc echo "« chmod 600 /etc/pombo.conf »" chmod 600 /etc/pombo.conf install -v ${src_dir}/pombo.py ${inst_dir}/pombo echo "« chmod +x ${inst_dir}/pombo »" chmod +x ${inst_dir}/pombo if test -f /etc/crontab ; then # Retro-compatibility (version <= 0.0.9) if [ $(grep -c "/usr/local/bin/pombo" /etc/crontab) != 0 ] ; then echo "« sed -i '/usr/local/bin/pombo/d' /etc/crontab »" sed -i '\/usr\/local\/bin\/pombo/d' /etc/crontab fi fi [ -f /etc/cron.d/pombo ] && rm -fv /etc/cron.d/pombo # Launch Pombo on boot echo "« @reboot root sleep 10 && ${inst_dir}/pombo >>/etc/cron.d/pombo »" echo "@reboot root sleep 10 && ${inst_dir}/pombo" >>/etc/cron.d/pombo # Launch Pombo every 15 minutes echo "« */15 * * * * root ${inst_dir}/pombo >>/etc/cron.d/pombo »" echo "*/15 * * * * root ${inst_dir}/pombo" >>/etc/cron.d/pombo [ -f /var/local/pombo ] && rm -fv /var/local/pombo echo "Done." echo "\nChecking dependancies ..." ok=1 for package in python gpg ifconfig iwlist traceroute streamer; do test=$(which ${package}) [ $? != 0 ] && echo " ! ${test}.... ${package} needed but not installed." && ok=0 done echo "Shell script uses Python $(python --version)" python ${src_dir}/tools/check-imports.py case ${ok} in 1) echo "Done." ;; *) echo "Please install necessary tools before continuing." ;; esac cat <