WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Quick Firefox Updater Script  (Read 6120 times)

Offline maluvia

  • Newbie
  • *
  • Posts: 22
Quick Firefox Updater Script
« on: January 20, 2015, 10:47:48 AM »
Wrote a simple script to create a new firefox extension after firefox has updated itself.
(This is how I have been updating my firefox for the past year.)
This can be kept in  ~/.local/bin, and run every time firefox updates itself.

Don't know if this will be useful to anyone, but am attaching the script.
This is my first ever script, so any feedback is appreciated :-)
I <3 Tiny Core

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Quick Firefox Updater Script
« Reply #1 on: January 20, 2015, 04:18:34 PM »
good job, but now we have three such scripts, two are already extension's in the repo

http://forum.tinycorelinux.net/index.php/topic,17879.msg108266.html#msg108266
« Last Edit: January 20, 2015, 04:20:05 PM by coreplayer2 »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Quick Firefox Updater Script
« Reply #2 on: January 20, 2015, 05:29:35 PM »
Having multiple options is mostly always a plus though. (:
Also this one will pack any modifications made to firefox into the created extension.

One suggestion.
Make sure squashfs-tools (or squashfs-tools-4.x.tcz on TC 5.x) are available.
Code: [Select]
tce-load -w squashfs-tools.tcz
tce-load -i squashfs-tools.tcz
« Last Edit: January 20, 2015, 05:31:21 PM by Misalf »
Download a copy and keep it handy: Core book ;)

Offline maluvia

  • Newbie
  • *
  • Posts: 22
Re: Quick Firefox Updater Script
« Reply #3 on: January 21, 2015, 09:41:15 AM »
Updated the script to check for squashfs-tools, and attached updated script.

I just like this one because it is simple, and really fast.
Thanks for the feedback :-)
I <3 Tiny Core

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Quick Firefox Updater Script
« Reply #4 on: January 21, 2015, 10:18:51 AM »
You could replace this
Code: [Select]
if [ -f "/usr/local/tce.installed/squashfs-tools" ]
then
echo "${GREEN}Installed${NORMAL}"
elif [ -f "/etc/sysconfig/tcedir/optional/squashfs-tools.tcz" ]
then echo "${GREEN}Loading squashfs-tools:${NORMAL}" && tce-load -i squashfs-tools.tcz
else echo "${GREEN}Installing squashfs-tools:${NORMAL}" && tce-load -wi squashfs-tools.tcz
fi

with just this
Code: [Select]
tce-load -w squashfs-tools
tce-load -i squashfs-tools

It would just say that  "squashfs-tools.tcz is already downloaded."  if present. Otherwise download it.
The next command will only load it if not already loaded.

tce-load -wi ...  will add an entry to the onboot.lst for the tcz which might not be wanted.
tce-load -wil ...  will not load the extension if already downloaded.
So a combination of two commands (with -w and -i parameter respectively) is more reliable for different situations and less code.


Or to make it more error aware
Code: [Select]
tce-load -w squashfs-tools
tce-load -i squashfs-tools
if [ ! -e /usr/local/tce.installed/squashfs-tools* ]; then
echo "Failed to download/install squashfs-tools. Exiting"
sleep 5
exit 1
fi
Download a copy and keep it handy: Core book ;)

Offline maluvia

  • Newbie
  • *
  • Posts: 22
Re: Quick Firefox Updater Script
« Reply #5 on: January 23, 2015, 02:40:22 PM »
@Misalf
I redid the squashfs check and added the failsafe, but using a different form  of conditionals that reduced that part of the script to 3 lines, and simplified another part also
This enables it to do more, with 6 less lines, and all under 80 columns.
This turned out to be a good learning exercise. Thanks for the suggestions :-)

I <3 Tiny Core