diff --git a/src/usr/local/kobocloud/config.sh b/src/usr/local/kobocloud/config.sh index 61d1162..395c953 100755 --- a/src/usr/local/kobocloud/config.sh +++ b/src/usr/local/kobocloud/config.sh @@ -1,11 +1,12 @@ #!/bin/bash -ConfigFile=`dirname $0`/kobocloudrc.tmpl +KC_HOME=$(dirname $0) +ConfigFile=$KC_HOME/kobocloudrc.tmpl if uname -a | grep -q x86 then #echo "PC detected" - . `dirname $0`/config_pc.sh + . $KC_HOME/config_pc.sh else - . `dirname $0`/config_kobo.sh + . $KC_HOME/config_kobo.sh fi diff --git a/src/usr/local/kobocloud/config_kobo.sh b/src/usr/local/kobocloud/config_kobo.sh index 7574027..eed91f2 100755 --- a/src/usr/local/kobocloud/config_kobo.sh +++ b/src/usr/local/kobocloud/config_kobo.sh @@ -4,4 +4,4 @@ Lib=/mnt/onboard/.add/kobocloud/Library SD=/mnt/sd/kobocloud UserConfig=/mnt/onboard/.add/kobocloud/kobocloudrc Dt="date +%Y-%m-%d_%H:%M:%S" -CURL="`dirname $0`/curl --cacert \"`dirname $0`/ca-bundle.crt\" " +CURL="$KC_HOME/curl --cacert \"$KC_HOME/ca-bundle.crt\" " diff --git a/src/usr/local/kobocloud/get.sh b/src/usr/local/kobocloud/get.sh index 004b4c9..d007dd0 100755 --- a/src/usr/local/kobocloud/get.sh +++ b/src/usr/local/kobocloud/get.sh @@ -2,12 +2,12 @@ #Kobocloud getter #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh #check if Kobocloud contains the line "UNINSTALL" if grep -q '^UNINSTALL$' $UserConfig; then echo "Uninstalling KoboCloud!" - `dirname $0`/uninstall.sh + $KC_HOME/uninstall.sh exit 0 fi @@ -33,15 +33,15 @@ while read url; do else echo "Getting $url" if echo $url | grep -q '^https*://www.dropbox.com'; then # dropbox link? - `dirname $0`/getDropboxFiles.sh "$url" "$Lib" + $KC_HOME/getDropboxFiles.sh "$url" "$Lib" elif echo $url | grep -q '^https*://filedn.com'; then - `dirname $0`/getpCloudFiles.sh "$url" "$Lib" + $KC_HOME/getpCloudFiles.sh "$url" "$Lib" elif echo $url | grep -q '^https*://[^/]*pcloud'; then - `dirname $0`/getpCloudFiles.sh "$url" "$Lib" + $KC_HOME/getpCloudFiles.sh "$url" "$Lib" elif echo $url | grep -q '^https*://drive.google.com'; then - `dirname $0`/getGDriveFiles.sh "$url" "$Lib" + $KC_HOME/getGDriveFiles.sh "$url" "$Lib" else - `dirname $0`/getOwncloudFiles.sh "$url" "$Lib" + $KC_HOME/getOwncloudFiles.sh "$url" "$Lib" fi fi done < $UserConfig diff --git a/src/usr/local/kobocloud/getDropboxFiles.sh b/src/usr/local/kobocloud/getDropboxFiles.sh index 807d7c4..2d01b93 100755 --- a/src/usr/local/kobocloud/getDropboxFiles.sh +++ b/src/usr/local/kobocloud/getDropboxFiles.sh @@ -4,7 +4,7 @@ baseURL="$1" outDir="$2" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh baseURL=`echo "$baseURL" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'` @@ -25,7 +25,7 @@ do outFileName=`echo $linkLine | sed -e 's|.*/\(.*\)?dl=.*|\1|'` #echo $outFileName localFile="$outDir/$outFileName" - `dirname $0`/getRemoteFile.sh "$linkLine" "$localFile" + $KC_HOME/getRemoteFile.sh "$linkLine" "$localFile" if [ $? -ne 0 ] ; then echo "Having problems contacting Dropbox. Try again in a couple of minutes." exit diff --git a/src/usr/local/kobocloud/getGDriveFiles.sh b/src/usr/local/kobocloud/getGDriveFiles.sh index a825d3d..0c89797 100755 --- a/src/usr/local/kobocloud/getGDriveFiles.sh +++ b/src/usr/local/kobocloud/getGDriveFiles.sh @@ -4,7 +4,7 @@ baseURL="$1" outDir="$2" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh # get directory listing echo "Getting $baseURL" @@ -26,7 +26,7 @@ do outFileName=`echo $fileName | tr ' ' '_'` localFile="$outDir/$outFileName" - `dirname $0`/getRemoteFile.sh "$linkLine" "$localFile" + $KC_HOME/getRemoteFile.sh "$linkLine" "$localFile" if [ $? -ne 0 ] ; then echo "Having problems contacting Google Drive. Try again in a couple of minutes." exit diff --git a/src/usr/local/kobocloud/getOwncloudFiles.sh b/src/usr/local/kobocloud/getOwncloudFiles.sh index 4ea1780..a26df76 100755 --- a/src/usr/local/kobocloud/getOwncloudFiles.sh +++ b/src/usr/local/kobocloud/getOwncloudFiles.sh @@ -4,7 +4,7 @@ baseURL="$1" outDir="$2" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh # webdav implementation # https://myserver.com/s/shareLink @@ -16,7 +16,7 @@ echo $shareID echo $davServer # get directory listing -`dirname $0`/getOwncloudList.sh $shareID $davServer | +$KC_HOME/getOwncloudList.sh $shareID $davServer | while read relativeLink do # process line @@ -24,7 +24,7 @@ do linkLine=$davServer/$relativeLink localFile="$outDir/$outFileName" # get remote file - `dirname $0`/getRemoteFile.sh "$linkLine" "$localFile" $shareID + $KC_HOME/getRemoteFile.sh "$linkLine" "$localFile" $shareID if [ $? -ne 0 ] ; then echo "Having problems contacting Owncloud. Try again in a couple of minutes." exit diff --git a/src/usr/local/kobocloud/getOwncloudList.sh b/src/usr/local/kobocloud/getOwncloudList.sh index f421a61..8816668 100755 --- a/src/usr/local/kobocloud/getOwncloudList.sh +++ b/src/usr/local/kobocloud/getOwncloudList.sh @@ -4,7 +4,7 @@ user="$1" davServer="$2" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh echo ' diff --git a/src/usr/local/kobocloud/getRemoteFile.sh b/src/usr/local/kobocloud/getRemoteFile.sh index ff9c3e3..d1109ad 100755 --- a/src/usr/local/kobocloud/getRemoteFile.sh +++ b/src/usr/local/kobocloud/getRemoteFile.sh @@ -6,7 +6,7 @@ user="$3" outputFileTmp="/tmp/kobo-remote-file-tmp.log" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh curlCommand="$CURL" if [ ! -z "$user" ] && [ "$user" != "-" ]; then diff --git a/src/usr/local/kobocloud/getpCloudFiles.sh b/src/usr/local/kobocloud/getpCloudFiles.sh index 1f2e688..9497dc5 100755 --- a/src/usr/local/kobocloud/getpCloudFiles.sh +++ b/src/usr/local/kobocloud/getpCloudFiles.sh @@ -4,7 +4,7 @@ baseURL="$1" outDir="$2" #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh code=`echo $baseURL | sed 's/.*code=\([a-zA-Z0-9]*\).*/\1/'` @@ -35,7 +35,7 @@ do # process line localFile="$outDir/$outFileName" - `dirname $0`/getRemoteFile.sh "$linkLine" "$localFile" + $KC_HOME/getRemoteFile.sh "$linkLine" "$localFile" if [ $? -ne 0 ] ; then echo "Having problems contacting pCloud. Try again in a couple of minutes." exit diff --git a/src/usr/local/kobocloud/udev_mount.sh b/src/usr/local/kobocloud/udev_mount.sh index b6e1479..96774b2 100755 --- a/src/usr/local/kobocloud/udev_mount.sh +++ b/src/usr/local/kobocloud/udev_mount.sh @@ -1,6 +1,6 @@ #!/bin/sh #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh #create work dirs [ ! -e "$Logs" ] && mkdir -p "$Logs" >/dev/null 2>&1 diff --git a/src/usr/local/kobocloud/udev_program.sh b/src/usr/local/kobocloud/udev_program.sh index 05a16e6..e688a72 100755 --- a/src/usr/local/kobocloud/udev_program.sh +++ b/src/usr/local/kobocloud/udev_program.sh @@ -8,7 +8,7 @@ then fi #load config -. `dirname $0`/config.sh +. $(dirname $0)/config.sh #create work dirs [ ! -e "$Logs" ] && mkdir -p "$Logs" >/dev/null 2>&1 @@ -16,4 +16,4 @@ fi [ ! -e "$SD" ] && mkdir -p "$SD" >/dev/null 2>&1 #output to log -`dirname $0`/get.sh > $Logs/get.log 2>&1 & +$KC_HOME/get.sh > $Logs/get.log 2>&1 &