Tiny Core Linux
Tiny Core Extensions => TCE Tips & Tricks => Topic started by: maluvia on January 20, 2015, 07: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 :-)
-
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 (http://forum.tinycorelinux.net/index.php/topic,17879.msg108266.html#msg108266)
-
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.
tce-load -w squashfs-tools.tcz
tce-load -i squashfs-tools.tcz
-
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 :-)
-
You could replace this
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
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
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
-
@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 :-)