Wrapper for SQLiteManager extension in MZ browsers

Business software, financial software, etc.
Post Reply
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Wrapper for SQLiteManager extension in MZ browsers

#1 Post by musher0 »

Hello all.

Please find attached a wrapper script which will enable you to run as a
stand-alone app the SQLiteManager extension available on some Mozilla-
type browsers. (E.g. Firefox, SeaMonkey, and similar.)

This is an overblown ;) edit of a one-liner written by BK way back when.

~~~~~~~~~~

Requirements --
-- A Mozilla-type browser

-- its SQLiteManager extension.

-- The new yaf-splash utility (all Puppies have it now).


Features --
-- It checks if you have the extension and then an MZ browser; tells you
if you don't and exits.

-- SQLiteManager.desktop file provided for convenience; will show in
Business or Database sub-section of your menu.

-- Issues messages in console if run from console, through yaf-splash
if run from X


Peculiarity --
-- If you have installed the SQLiteManager extension, say, in Light and in
SeaMonkey, it will run the first one it finds (In alphabetical order) and exit

~~~~~~~~~~

Constructive or improvement-oriented comments welcome.

Enjoy.

~~~~~~~~~~

Code: Select all

#!/bin/sh
# sqlitemanager.sh
# Original script by Barry Kauler, 2009? ;-)
# Edited for MRUF-lst by musher0. # Edit 2: 2017-08-05, 13 h 55. GPL3
# Please see https://opensource.org/licenses/GPL-3.
####

# Note --
# Sqlitemanager does not have position handling for the command line.
# We should try to "cd" as close as we can to the DB file before running it.

case "${LANG:0:2}" in fr)TXTMSG3="
    SQLiteManager se lance.

... Merci de votre patience ...
"
TXTMSG4="
On n'a trouvé aucun navigateur
   qui supporte sqlitemanager.
"
TXTMSG5="
SQLitemanager n'est pas installé.
" ;;
			en|*)TXTMSG3="
SQLiteManager is launching.

   ... Thanks for waiting ...
"
TXTMSG4="
  No browser was found
to support sqlitemanager.
"
TXTMSG5="
SQLitemanager is not installed.
" ;;
esac

PasInstalle () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG5" &
	}

PasTrouve () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG4" &
	}

Attente () {
yaf-splash -font Liberation -fontsize 13 -margin 1 -fg grey91 -bg black -bg_gradient true -icon /usr/local/share/pixmaps/5817-64_SQLiteManager.png -wrap false -timeout 6 -text "$TXTMSG3" &

# Why bcm is not showing any text for this, I don't know.
# But I'm leaving the code here in case someone does.
# bcm -u /usr/local/share/pixmaps/5817-64_SQLiteManager.png -a 1 -g c:c -d 6 -b "#000000FF" -c "#0c0c0c8F" -t "<span font='LiberationSerif Bold Italic 18' color='$Color1' gravity='north' gravity_hint='line'>"$TXTMSG3"</span>" 2>/dev/null &
	}

MZBrwsrChck () {
	if [ "`which $BrowseR`" = "" ];then
		if [ -t 1 ];then echo "TXTMSG4"
		else PasTrouve
		fi
	else # sqlitemanager is launched
		SqliT="chrome chrome://sqlitemanager/content/sqlitemanager.xul"
		[ -t 1 ] && echo "$TXTMSG3" || Attente
		$BrowseR --$SqliT 2>/dev/null
		exit # The script runs the first SQLiteManager it finds and exits.
	fi; }

## Action
for brwsr in light mozilla # We can add palemoon, etc.
do	S="`tree -fi ~/.$brwsr/* -L 3 | grep SQLite`"
	if [ "${S}" ];then BrowseR="`echo "$S" | awk -F"/" '{ print $4 }'`"
		MZBrwsrChck
	else
		if [ -t 1 ];then echo "STXTMSG5."
		else PasInstalle
		fi
	fi
done
~~~~~~~~~~
Attachments
SQLiteManager-wrapper-0.1.pet
(3.22 KiB) Downloaded 684 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

I have a problem in Quirky 8.3 and Easy, have this pet for SQLiteManager:
http://distro.ibiblio.org/quirky/quirky ... .1-all.pet

If I start seamonkey from a terminal, I see a message that SQLiteManager is a foreign extension and is being disabled.

That means it won't run standalone either.

Have to start SeaMonkey, go to Addons Manager in the menu, and click the button to enable SQLiteManager.

Consequently, I have created a new /usr/bin/sqlitemanager.sh that tests if the addon has been enabled:

Code: Select all

#!/bin/sh
#sqlitemanager is an addon for mozilla browsers.
#want to start it standalone.

export TEXTDOMAIN=sqlitemanager
export OUTPUT_CHARSET=UTF-8

SQLflg=''
for aINI in `ls -1 /root/.mozilla/*/*/extensions.ini | tr '\n' ' '`
do
 SQLflg="$(grep -o 'SQLiteManager' $aINI)"
 [ "$SQLflg" ] && break
done

if [ ! "$SQLflg" ];then
 MSG1="$(gettext 'Sorry, SQLiteManager is disabled. You need to run the Mozilla browser first, choose Addons Manager, and enable SQLiteManager addon.')"
 popup "background=#ff8080 level=top terminate=ok|<big>${MSG1}</big>"
else
 BROWSER="$(echo -n $aINI | cut -f 4 -d '/')" #ex: seamonkey
 exec ${BROWSER} -chrome chrome://sqlitemanager/content/sqlitemanager.xul
fi

###END###
The only problem that I can see with that script, is it relies upon the browser name to be /root/.mozilla/seamonkey, /root/.mozilla/firefox, etc.
It works for seamonkey, but I don't know if the other Mozilla browsers create a directory named like that, for example, does palemoon create /root/.mozilla/palemoon?
[/code]
[url]https://bkhome.org/news/[/url]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Hello BarryK.

Strange... I never had a problem running SQLiteManager stand-alone with my script
above or with your old one-liner.

I have never had to enable it before use either. It installed, I clicked on the menu entry,
and away I went. Maybe I forgot?

In any case, one enables something only once. The next times, one shouldn't have to.
This is the concept of enabling, I believe? It's strange that you would have to enable it
every time you use it, inside the browser or stand-alone.

I must say I tend to stick to 32-bit environments. Perhaps this is the reason? Different
behavior for different environments?

~~~~~

In answer to your question about where the user dirs are in MZ browsers, this much
I know:

Name ................................ 1st level....... 2nd level (user profile)

Mozilla-Light (aka "Light") .. ~/.light ...... ~/.light/light/RandomNumber
Firefox............................... ~/.mozilla ... ~/.mozilla/firefox/RandomNumber
SeaMonkey ........................ ~/.mozilla ... ~/.mozilla/seamonkey/RandomNumber

In Light, this is where the SQLiteManager extension is on my DPupStretch-7:
/root/.light/light/3xijgjry.default/extensions/SQLiteManager@mrinalkant.blogspot.com.xpi
Mutatis mutandis for the other MZ browsers. Otherwise the author would have gone nuts.

I'm not familiar with Pale Moon. I think it uses the dir name ~/.MoonChild Productions
(with the space) for the 1st level. Beyond that, I'd rather let an experienced user
provide the answer.

~~~~~

IHTH.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hello again BarryK.

This is what I get when I run my script:
1502016074761 addons.webextension.{72b2e02b-3a71-4895-886c-fd12ebe36ba3} WARN Loading extension '{72b2e02b-3a71-4895-886c-fd12ebe36ba3}': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
1502016074853 addons.webextension.{72b2e02b-3a71-4895-886c-fd12ebe36ba3} WARN Please specify whether you want browser_style or not in your browser_action options.
1502016075006 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing background.persistent: Event pages are not currently supported. This will run as a persistent background page.
1502016075042 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing author: An unexpected property was found in the WebExtension manifest.
1502016075043 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing version_name: An unexpected property was found in the WebExtension manifest.
1502016075043 addons.webextension.firefox@ghostery.com WARN Loading extension 'firefox@ghostery.com': Reading manifest: Error processing options_page: An unexpected property was found in the WebExtension manifest.
1502016075564 addons.webextension.firefox@ghostery.com WARN Please specify whether you want browser_style or not in your browser_action options.
Screenshot attached.

BFN.
Attachments
This-is-what-I-get.jpg
(159.27 KiB) Downloaded 478 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#5 Post by BarryK »

musher0,
You would have SQLiteManager already enabled, as you installed it from a running browser.

However, in my case it is a PET, which is different.

Running my script, there are no error messages. But then, I have used the latest version of SQLiteManager from the source repository -- I think I posted a link on my blog.
[url]https://bkhome.org/news/[/url]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Hello BarryK.

Personally, I don't see a problem. To be frank, I even see it as splitting hairs.

Simply mention to the user that (s)he has to enable SQLiteManager from
his/her browser after the petget has installed the extension? (I believe you
already did in one of your SQLIteManager articles on your blog?)

Or perhaps discuss the issue with "lazierthanthou", the developer of
SQLiteManageron github? Maybe he can incorporate in his code a "sensor"
or "hook" to detect the stand-alone situation and accommodate the user.

Hopefully, we are talking about the same thing.

A few years ago, one could download and install a stand-alone SQLite
Manager that ran separately from any MZ browser, like ThunderBird or
Kompozer did. It had the MZ "heart" (the famous "xul"). IIRC, that version
ran fine on first run without need for enabling.

There now is a similar SQL utility with the same name, but limited to
WhineDose and Mac systems. It appears to be from a company rather
than from a soloist developer.

Sorry I couldn't help you more on this. Best of luck.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply