From 17181674b7c366c4ca7805f70f0f8a873827972b Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 24 Mar 2011 14:01:16 -0400 Subject: [PATCH] CC-2016: Rearrange python scripts for reusability -fixed path issue that was happening on some systems --- install/airtime-uninstall.php | 2 +- install/installInit.php | 4 ++-- python_apps/pypo/install/pypo-uninstall.py | 2 +- python_apps/pypo/scripts/ls_lib.liq | 4 ++-- python_apps/pypo/scripts/notify.sh | 9 ++++++++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index d30b4ee76..fa81129cb 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -82,7 +82,7 @@ if ($results == 0) { AirtimeInstall::DeleteFilesRecursive($CC_CONFIG['storageDir']); -$command = "python ".__DIR__."/../pypo/install/pypo-uninstall.py"; +$command = "python ".__DIR__."/../python_apps/pypo/install/pypo-uninstall.py"; system($command); $command = "python ".__DIR__."/../python_apps/show-recorder/install/recorder-uninstall.py"; diff --git a/install/installInit.php b/install/installInit.php index ffad0ac29..fe70cff5a 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -214,8 +214,8 @@ class AirtimeInstall { } public static function RemoveSymlinks(){ - exec("rm /usr/bin/airtime-import"); - exec("rm /usr/bin/airtime-clean-storage"); + exec("rm /usr/bin/airtime-import >/dev/null 2>&1"); + exec("rm /usr/bin/airtime-clean-storage >/dev/null 2>&1"); } diff --git a/python_apps/pypo/install/pypo-uninstall.py b/python_apps/pypo/install/pypo-uninstall.py index 6dcc42ce5..cd22e9c4c 100644 --- a/python_apps/pypo/install/pypo-uninstall.py +++ b/python_apps/pypo/install/pypo-uninstall.py @@ -50,6 +50,6 @@ try: remove_path("/etc/service/pypo-liquidsoap") remove_user("pypo") - print "Uninstall complete." + print "Pypo uninstall complete." except Exception, e: print "exception:" + str(e) diff --git a/python_apps/pypo/scripts/ls_lib.liq b/python_apps/pypo/scripts/ls_lib.liq index 27ed94f06..8447e5100 100644 --- a/python_apps/pypo/scripts/ls_lib.liq +++ b/python_apps/pypo/scripts/ls_lib.liq @@ -1,6 +1,6 @@ def notify(m) - system("./notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}") - print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}") + system("/opt/pypo/bin/scripts/notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}") + print("/opt/pypo/bin/scripts/notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']}") end # A function applied to each metadata chunk diff --git a/python_apps/pypo/scripts/notify.sh b/python_apps/pypo/scripts/notify.sh index 6298f13dd..8c407282b 100755 --- a/python_apps/pypo/scripts/notify.sh +++ b/python_apps/pypo/scripts/notify.sh @@ -4,4 +4,11 @@ # needed here to keep dirs/configs clean # # and maybe to set user-rights # ############################################ -cd ../ && ./pypo-notify.py $1 $2 $3 $4 $5 $6 $7 $8 & +pwd + +# Absolute path to this script +SCRIPT=`readlink -f $0` +# Absolute path this script is in +SCRIPTPATH=`dirname $SCRIPT` + +cd ${SCRIPTPATH}/../ && ./pypo-notify.py $1 $2 $3 $4 $5 $6 $7 $8 &