From a3bdba992715f6282e112e06a2beee15d20b69ca Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 14 Jan 2014 22:07:39 +0400 Subject: [PATCH] Remove absolute directory ~/lib to make it portable --- bkmk-add | 4 ++-- bkmk-chk | 4 ++-- bkmk-publish | 4 ++-- bkmk-rsync | 4 ++-- bkmk-sort | 4 ++-- bkmk2db | 4 ++-- doc/TODO | 2 -- set-path | 10 ++++++++++ set-title-list | 4 ++-- 9 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 set-path diff --git a/bkmk-add b/bkmk-add index 5e737e9..01f403c 100755 --- a/bkmk-add +++ b/bkmk-add @@ -4,10 +4,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH=$HOME/lib/bookmarks_db:$PATH +. "`dirname \"$0\"`"/set-path bkmk2db || exit 1 diff --git a/bkmk-chk b/bkmk-chk index aca60b1..3e5e5fe 100755 --- a/bkmk-chk +++ b/bkmk-chk @@ -7,10 +7,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH="$HOME/lib/bookmarks_db:$PATH" +. "`dirname \"$0\"`"/set-path ln -s "$HOME"/Desktop/bookmarks-*.json bookmarks_db.json && BKMK_STORAGE=json convert_st.py pickle && diff --git a/bkmk-publish b/bkmk-publish index c75048a..2f0b0d3 100755 --- a/bkmk-publish +++ b/bkmk-publish @@ -4,11 +4,11 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" umask 077 -PATH=$HOME/lib/bookmarks_db:$PATH +. "`dirname \"$0\"`"/set-path STARTDIR="`pwd`" BKMK_FORMAT=NETSCAPE db2bkmk.py -p "Private links" -o bookmarks.html || exit 1 diff --git a/bkmk-rsync b/bkmk-rsync index 5244ebb..0e73217 100755 --- a/bkmk-rsync +++ b/bkmk-rsync @@ -4,10 +4,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH=$HOME/lib/bookmarks_db:$PATH +. "`dirname \"$0\"`"/set-path umask 077 bkmk2db || exit 1 diff --git a/bkmk-sort b/bkmk-sort index debb35c..c802f22 100755 --- a/bkmk-sort +++ b/bkmk-sort @@ -4,10 +4,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH=$HOME/lib/bookmarks_db:$PATH +. "`dirname \"$0\"`"/set-path bkmk2db || exit 1 diff --git a/bkmk2db b/bkmk2db index 514dd18..4eae2eb 100755 --- a/bkmk2db +++ b/bkmk2db @@ -4,10 +4,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH="$HOME/lib/bookmarks_db:$PATH" +. "`dirname \"$0\"`"/set-path if [ ! -f ./bookmarks_db.pickle -a ! -f ./bookmarks_db.flad ]; then if [ -f ./bookmarks.html ]; then diff --git a/doc/TODO b/doc/TODO index 85c2de7..5705e21 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,5 +1,3 @@ -Remove absolute directory ~/lib to make it portable. - Switch simple robot to urllib2. A new robot based on PycURL. diff --git a/set-path b/set-path new file mode 100644 index 0000000..43ff756 --- /dev/null +++ b/set-path @@ -0,0 +1,10 @@ +START_DIR="`pwd`" +cd "`dirname \"$0\"`" +CWD="`pwd`" +cd "$START_DIR" +if echo "$PATH" | grep -vq "\(^\|:\)$CWD\(:\|$\)"; then + PATH="$CWD:$PATH" +fi +START_DIR='' +CWD='' +unset START_DIR CWD diff --git a/set-title-list b/set-title-list index 0ce876a..4bc22c4 100755 --- a/set-title-list +++ b/set-title-list @@ -4,10 +4,10 @@ # This file is a part of Bookmarks database and Internet robot. # # __author__ = "Oleg Broytman " -# __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design" +# __copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design" # __license__ = "GNU GPL" -PATH="$HOME/lib/bookmarks_db:$PATH" +. "`dirname \"$0\"`"/set-path set-title-list.py "$@" || exit 1 -- 2.39.2