From ab96d9630f90a716eeaaeaff53978ccf55a4645a Mon Sep 17 00:00:00 2001 From: Ghozy Arif Fajri Date: Wed, 4 Mar 2015 10:55:57 +0700 Subject: [PATCH] auto check if 'twit' command exists --- tweet.sh | 16 +++++++++++++++- twit.py | 0 2 files changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 twit.py diff --git a/tweet.sh b/tweet.sh index afce500..b28cf7f 100755 --- a/tweet.sh +++ b/tweet.sh @@ -9,7 +9,6 @@ ua="Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ # change directory to script's directory DIR="$( cd "$( dirname "$0" )" && pwd )" cd "$DIR" -#rm temp/*_output setup() { mkdir -p temp @@ -21,6 +20,21 @@ setup() { menit=$(date +%M) aksi_array=() + # check if twit command exists + if [ ! -f /usr/bin/twit ]; then + echo "[tweet.sh] command 'twit' tidak ditemukan! buat link di '/usr/bin/twit'" + ln -s "$DIR/twit.py" "/usr/bin/twit" > /dev/null 2>&1 + # success? + if [ ! -f /usr/bin/twit ]; then + echo "[tweet.sh] ERROR: gagal membuat link ke '/usr/bin/twit' !" + echo "[tweet.sh] periksa permission atau buat link secara manual" + exit + else + echo "[tweet.sh] SUKSES: link command 'twit' berhasil dibuat" + echo "" + fi + fi + # load plugin for f in plugin/*; do . $f diff --git a/twit.py b/twit.py old mode 100644 new mode 100755