Firefox always up to date (autd) - i686 & x86_64

This section is designed for your 'porteus build scripts' which create Porteus modules for your favorite applications. Scripts should work like the well-known 'SlackBuilds' with minimum user interaction.
tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Firefox always up to date (autd) - i686 & x86_64

Post#1 by tome » 22 Mar 2015, 21:52

This script allows you to to have always up to date Firefox. Now Firefox can check for updates and download them in the background without any need of action.
If you set that only root can update Firefox then:
1. Close current Firefox instance and run Firefox as root from terminal (firefox-autd)
2. Choose from menu: Help->About Firefox
3. Firefox will download updates.

Run this script as root and set your parameters at first section (1. Beginning of settings you should set) of this script

Code: Select all

#!/bin/bash
# Firefox always up to date
# Script by tome
# 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module

# Run as root
if [ `whoami` != "root" ]; then
  ktsuss "$0 $1"
  exit
fi

# 1. Beginning of settings you should set

# Directory where you want to store data on your booting device
mirror=data-mirror

# Change your architecture if needed, i686, x86_64 or `uname -m` (current)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-GB

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module, change path if you boot from iso
where=/mnt/live/porteus/modules

# End of settings you should set

echo
echo Settings:
echo "  mirror "$mirror
echo "  myarch "$myarch
echo "  lang   "$lang
echo "  me     "$me
echo "  where  "$where
echo

# 2. Get booting device
bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
realpath=${bdev}/$mirror

mkdir -p $realpath/apps

# 3. Download/extract
cd /tmp
wget -c http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/ /tmp
if [ ! -e "/tmp/index.html" ]; then echo ""
  echo "[31mCheck your internet connection! Exiting.[0m"
  exit 0
  fi
latest_version=`grep tar.bz2 index.html | tail -n1 | cut -d- -f2- | cut -d '"' -f1 | cut -d '/' -f3`
#old latest_version=`grep tar.bz2 index.html | head -n1 | cut -d- -f2- | cut -d '"' -f1`
echo "Downloading latest version of Mozilla Firefox"
wget -c https://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/$latest_version
# or wget --no-check-certificate -c http...
if [ -e "/tmp/$latest_version" ]; then echo "Extracting $latest_version"
  tar xjvf $latest_version -C $realpath/apps
  else
  clear
  echo ""
  echo "[36mCheck your internet connection! Exiting.[0m"
  exit 0
fi

# 4. Preparing module
rm -rf /tmp/firefox-autd
if [ -e /mnt/live/memory/images/firefox-links.xzm ]; then deactivate /mnt/live/memory/images/firefox-links.xzm
  echo Deactivating old firefox-links.xzm module
  fi
umount $where/firefox-links.xzm
rm -rf $where/firefox-links.xzm
mkdir -p /tmp/firefox-autd/usr/bin
mkdir -p /tmp/firefox-autd/usr/share/applications
mkdir -p /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps
cp $realpath/apps/firefox/browser/chrome/icons/default/default48.png /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps/firefox.png
 
echo '#!/bin/sh' >> /tmp/firefox-autd/usr/bin/firefox-autd
echo 'bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`' >> /tmp/firefox-autd/usr/bin/firefox-autd
echo 'exec ${bdev}/'$mirror'/apps/firefox/firefox "$@"' >> /tmp/firefox-autd/usr/bin/firefox-autd

chmod 755 /tmp/firefox-autd/usr/bin/firefox-autd
chown $me:$me $realpath/apps/firefox


echo "Generating Desktop Files..."

#Creating mozilla-firefox-autd-p.desktop
echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Exec=firefox-autd -no-remote -p %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Name=Firefox Profile Manager' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop

#Creating mozilla-firefox-autd.desktop
echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Exec=firefox-autd %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Name=Firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop

echo "Building the module."
mkdir -p $where
mksquashfs /tmp/firefox-autd $where/firefox-links.xzm -b 256K

#clear
echo -e "\n\n"
echo "DONE"
echo "Activating of $where/firefox-links.xzm"
echo ""
activate $where/firefox-links.xzm

exit 0
Old code 1:

Code: Select all

#!/bin/bash
# Firefox always up to date
# Script by tome
# Run as root
# 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module 

# 1. Beginning of settings you should set

# Directory where you want to store data on your booting device
mirror=data-mirror

# Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-GB

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module
where=/mnt/live/porteus/modules

# End of settings you should set


# 2. Get booting device
bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
realpath=${bdev}/$mirror

mkdir -p $realpath/apps 

# 3. Download/extract
cd /tmp
wget -c http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/ /tmp
if [ ! -e "/tmp/index.html" ]; then echo ""
  echo "[31mCheck your internet connection! Exiting.[0m"
  exit 0
  fi
latest_version=`grep tar.bz2 index.html | head -n1 | cut -d- -f2- | cut -d '"' -f1`
echo "Downloading latest version of Mozilla Firefox"
wget -c http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/firefox-$latest_version 
if [ -e "/tmp/firefox-$latest_version" ]; then echo "Extracting firefox-$latest_version"
  tar xjvf firefox-$latest_version -C $realpath/apps
  else
  clear
  echo ""
  echo "[36mCheck your internet connection! Exiting.[0m"
  exit 0
fi

# 4. Preparing module
rm -rf /tmp/firefox-autd
if [ -e /mnt/live/memory/images/firefox-links.xzm ]; then deactivate /mnt/live/memory/images/firefox-links.xzm 
  echo Deactivating old firefox-links.xzm module
fi
umount $where/firefox-links.xzm
rm -rf $where/firefox-links.xzm
mkdir -p /tmp/firefox-autd/usr/bin
mkdir -p /tmp/firefox-autd/usr/share/applications
mkdir -p /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps
cp $realpath/apps/firefox/browser/chrome/icons/default/default48.png /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps/firefox.png
 
echo '#!/bin/sh' >> /tmp/firefox-autd/usr/bin/firefox-autd
echo 'bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`' >> /tmp/firefox-autd/usr/bin/firefox-autd
echo 'exec ${bdev}/'$mirror'/apps/firefox/firefox "$@"' >> /tmp/firefox-autd/usr/bin/firefox-autd

chmod 755 /tmp/firefox-autd/usr/bin/firefox-autd
chown $me:$me $realpath/apps/firefox


echo "Generating Desktop Files..."

#Creating mozilla-firefox-autd-p.desktop
echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Exec=firefox-autd -no-remote -p %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'Name=Firefox Profile Manager' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop

#Creating mozilla-firefox-autd.desktop
echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Exec=firefox-autd %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'Name=Firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop

echo "Building the module."
mksquashfs /tmp/firefox-autd $where/firefox-links.xzm -b 256K

clear
echo "DONE"
echo "Activating of $where/firefox-links.xzm"
echo ""
activate $where/firefox-links.xzm

exit 0

Todo for next script editing:
echo " realpath to firefox dir "$realpath/apps
ln -s /usr/lib64/mozilla/plugins/*.so /usr/lib/mozilla/plugins


EDIT:
Little changes, thanks Ed_P
Update, thanks tb01 for your additions and spent time

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#2 by Ed_P » 24 Mar 2015, 04:18

Hi tome.

I really like the sound of this script. :good: But I am a little confused in how to use the setup parameters.

Primarily the mirror= variable. I boot Porteus as an ISO and store changes in a save.dat file. Wouldn't I want the mirror= variable set to /home/guest/downloads? Or /tmp/? I assume it has to point to a folder that exists. And if the files that will go into it are simply used to create the module do I need them after the module is created?

Modules that I do currently use are in a folder/directory on the ISO's drive which is NTFS not a Linux format, so I know what to set the where= variable to.
Ed

tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Re: Firefox always up to date (autd) - i686 & x86_64

Post#3 by tome » 24 Mar 2015, 07:03

If you don't know how to set it, leave it as it is, or for example

Code: Select all

mirror=data-Ed_P
You need set only:

Code: Select all

lang=en-US
and

Code: Select all

where=/your/path/to/directory/with/modules
Run and see how it works - it is the best method to understand it.

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#4 by Ed_P » 25 Mar 2015, 20:44

FYI

This is what I see when it runs.

Code: Select all

guest@porteus:~$ firefox-autd.sh
--2015-03-25 16:20:02--  http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
Resolving releases.mozilla.org (releases.mozilla.org)... 2620:101:8008:5::2:8, 63.245.217.181
Connecting to releases.mozilla.org (releases.mozilla.org)|2620:101:8008:5::2:8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/ [following]
--2015-03-25 16:20:03--  http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 72.21.81.253
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|72.21.81.253|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

/tmp: Scheme missing.
Downloading latest version of Mozilla Firefox


Check your internet connection! Exiting.
guest@porteus:~$ 
My internet connection is obviously working, I'm posting this.

My user settings are:

Code: Select all

# Directory where you want to store data on your booting device
mirror=/porteus3.0/data-mirror

# Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-US

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module
where=/mnt/live/porteus/modules
/mnt/live/porteus/modules is emtpy. /mnt/sda5//portesu3.0/data-mirror/apps is empty.

I tried running as root with the same results.




-edit-

Ok, reviewing initial posting I may have missed a step or 2. ie: Checking my current firefox I see that I am running version 31.5 which is the current version. Could that be causing what I'm seeing?
Ed

tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Re: Firefox always up to date (autd) - i686 & x86_64

Post#5 by tome » 26 Mar 2015, 09:40

Sorry and thanks, my mistake, change (remove #) in this line:

Code: Select all

#wget -c http://releases.mozilla.org/pub/mozilla.org....
Should be:

Code: Select all

wget -c http://releases.mozilla.org/pub/mozilla.org....
You should also run this script in terminal as root (su command). Or maybe I should reedit it, so it would work also from guest account, but then you must save changes.

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#6 by Ed_P » 26 Mar 2015, 18:07

Thanks tome, got much further this time.

Code: Select all

guest@porteus:~$ firefox-autd.sh
--2015-03-26 13:52:37--  http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
Resolving releases.mozilla.org (releases.mozilla.org)... 2620:101:8008:5::2:8, 63.245.217.181
Connecting to releases.mozilla.org (releases.mozilla.org)|2620:101:8008:5::2:8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/ [following]
--2015-03-26 13:52:37--  http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 72.21.81.253
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|72.21.81.253|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1067 (1.0K) [text/html]
Saving to: ‘index.html’

100%[======================================>] 1,067       --.-K/s   in 0s      

2015-03-26 13:52:37 (27.1 MB/s) - ‘index.html’ saved [1067/1067]

/tmp: Scheme missing.
FINISHED --2015-03-26 13:52:37--
Total wall clock time: 0.8s
Downloaded: 1 files, 1.0K in 0s (27.1 MB/s)
Downloading latest version of Mozilla Firefox
--2015-03-26 13:52:38--  http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-36.0.4.tar.bz2
Resolving releases.mozilla.org (releases.mozilla.org)... 2620:101:8008:5::2:8, 63.245.217.181
Connecting to releases.mozilla.org (releases.mozilla.org)|2620:101:8008:5::2:8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-36.0.4.tar.bz2 [following]
--2015-03-26 13:52:38--  http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-36.0.4.tar.bz2
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 72.21.81.253
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|72.21.81.253|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 46907496 (45M) [application/x-bzip2]
Saving to: ‘firefox-36.0.4.tar.bz2’

100%[======================================>] 46,907,496   795KB/s   in 58s    

2015-03-26 13:53:36 (791 KB/s) - ‘firefox-36.0.4.tar.bz2’ saved [46907496/46907496]

Extracting firefox-36.0.4.tar.bz2
firefox/
firefox/libfreebl3.so
firefox/browser/
firefox/browser/blocklist.xml
firefox/browser/extensions/
firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/
firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
firefox/browser/omni.ja
 :
 :
 :
firefox/dependentlibs.list
firefox/precomplete
firefox/libnssdbm3.so
firefox/dictionaries/
firefox/dictionaries/en-US.aff
firefox/dictionaries/en-US.dic
umount: /mnt/live/porteus/modules/firefox-links.xzm: not found
Generating Desktop Files...
Building the module.
Could not create destination file: Read-only file system

DONE
Activating of /mnt/live/porteus/modules/firefox-links.xzm

firefox-links.xzm: This is not a valid module
guest@porteus:~$ 
tmp/firefox-36.0.4.tat.bz2 and the /tmp/firefox-autd/folders exist.

I added a root command to the script such that I have:

Code: Select all

#!/bin/bash
# http://forum.porteus.org/viewtopic.php?f=76&t=4473
# Firefox always up to date
# Script by tome
# Run as root
# 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module

if [ `whoami` != "root" ]; then
  ktsuss "$0 $1"
  exit
fi

# Directory where you want to store data on your booting device
mirror=/porteus3.0/data-mirror

# Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-US

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module
where=/mnt/live/porteus/modules

# End of settings you should set
Ed

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#7 by Ed_P » 26 Mar 2015, 21:46

Ok, I modified the user area a little more.

Code: Select all

#!/bin/bash
# http://forum.porteus.org/viewtopic.php?f=76&t=4473
# Firefox always up to date
# Script by tome
# Run as root
# 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module

if [ `whoami` != "root" ]; then
  ktsuss "$0 $1"
  exit
fi

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"

# Directory where you want to store data on your booting device
mirror=/$FOLDER/data-mirror

# Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-US

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module
where=/$FOLDER/Optional

# End of settings you should set

echo Settings
echo mirror $mirror
echo myarch $myarch
echo lang $lang
echo me $me
echo where $where
The script runs, the module is created, deactivate prompt responded to, manually activated the new module firefox-links.xzm, started firefox, checked it's Help menu and see that I'm still running 31.5.

Checked the lxterminal display and see newer messages.

Code: Select all

umount: /porteus3.0/Optional/firefox-links.xzm: not found
Generating Desktop Files...
Building the module.
Could not create destination file: No such file or directory

DONE
Activating of /porteus3.0/Optional/firefox-links.xzm

basename: missing operand
Try 'basename --help' for more information.
umount: /mnt/live/memory/images/: not mounted
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Updating shared library links:  /sbin/ldconfig
/sbin/ldconfig: /usr/lib/libv4lconvert.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l2.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l1.so.0 is not a symbolic link
Ed

tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Re: Firefox always up to date (autd) - i686 & x86_64

Post#8 by tome » 26 Mar 2015, 22:20

Your "$where" path should exist or add to script:

Code: Select all

mkdir -p $where

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#9 by Ed_P » 27 Mar 2015, 00:27

tome wrote:Your "$where" path should exist
It does exist.

Code: Select all

guest@porteus:~$ ls /mnt/sda5/porteus3.0/Optional
003-kde.xzm*   003-mate.xzm*   003-xfce.xzm*  seq.txt*
003-lxde.xzm*  003-razor.xzm*  Quake/         usm-latest-0.0-noarch-1.xzm*
guest@porteus:~$ 

Code: Select all

guest@porteus:~$ sh firefox-autd.sh

Settings:
mirror /porteus3.0/data-mirror
myarch x86_64
lang en-US
me guest
where /porteus3.0/Optional
Ed

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#10 by Ed_P » 27 Mar 2015, 04:30

Progress.

Code: Select all

guest@porteus:~$ firefox-autd.sh

Settings:
  mirror /porteus3.0/data-mirror
  myarch x86_64
  lang   en-US
  me     guest
  where  /mnt/sda5/porteus3.0/Optional
 :
 :
 :
 firefox/libnssdbm3.so
firefox/dictionaries/
firefox/dictionaries/en-US.aff
firefox/dictionaries/en-US.dic
Updating shared library links:  /sbin/ldconfig
/sbin/ldconfig: /usr/lib/libv4lconvert.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l2.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l1.so.0 is not a symbolic link

Updating Razor menu: update-desktop-database
Deactivating old firefox-links.xzm module
umount: /mnt/sda5/porteus3.0/Optional/firefox-links.xzm: not mounted
Generating Desktop Files...
Building the module.
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on /mnt/sda5/porteus3.0/Optional/firefox-links.xzm, block size 262144.
[===================================================================|] 4/4 100%
Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
	compressed data, compressed metadata, compressed fragments, compressed xattrs
	duplicates are removed
Filesystem size 5.06 Kbytes (0.00 Mbytes)
	89.51% of uncompressed filesystem size (5.65 Kbytes)
Inode table size 190 bytes (0.19 Kbytes)
	45.45% of uncompressed inode table size (418 bytes)
Directory table size 234 bytes (0.23 Kbytes)
	70.69% of uncompressed directory table size (331 bytes)
Number of duplicate files found 0
Number of inodes 13
Number of files 4
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 9
Number of ids (unique uids + gids) 1
Number of uids 1
	root (0)
Number of gids 1
	root (0)

DONE
Activating of /mnt/sda5/porteus3.0/Optional/firefox-links.xzm

Updating shared library links:  /sbin/ldconfig
/sbin/ldconfig: /usr/lib/libv4lconvert.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l2.so.0 is not a symbolic link

/sbin/ldconfig: /usr/lib/libv4l1.so.0 is not a symbolic link

Updating Razor menu: update-desktop-database
guest@porteus:~$ 
The problem was the where variable needed to include the BOOTDEVice variable whereas the mirror variable does not.

Code: Select all

#!/bin/bash
# http://forum.porteus.org/viewtopic.php?f=76&t=4473
# Firefox always up to date
# Script by tome
# Run as root
# 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module

if [ `whoami` != "root" ]; then
  ktsuss "$0 $1"
  exit
fi

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}

# Directory where you want to store data on your booting device
mirror=/$FOLDER/data-mirror

# Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
myarch=`uname -m`

# Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW

lang=en-US

# Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
me=guest

# Where you want to place created firefox-links.xzm module
where=$BOOTDEV/$FOLDER/Optional

# End of settings you should set

echo 
echo Settings:
echo "  mirror "$mirror
echo "  myarch "$myarch
echo "  lang   "$lang
echo "  me     "$me
echo "  where  "$where
echo 
But, no matter how I start Firefox I still get the 31.5 version. :(
Ed

tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Re: Firefox always up to date (autd) - i686 & x86_64

Post#11 by tome » 27 Mar 2015, 06:46

But, no matter how I start Firefox I still get the 31.5 version.
Because it doesn't affect your existing Firefox version. Do not start Firefox from desktop bar, go to applications menu -> Internet -> correct Firefox (unfortunately icons and name could be the same), or run from guest terminal - firefox-autd. You should activate firefox-links.xzm module before.

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#12 by Ed_P » 27 Mar 2015, 18:16

tome wrote:Do not start Firefox from desktop bar, go to applications menu -> Internet -> correct Firefox (unfortunately icons and name could be the same)
I did use the menu options, of which there are 3: Firefox, Firefox (web browser) and Firefox Profile Manager. The latter two I believe are new. I didn't try the Profile Manager but I did try the other two and the one in the desktop bar.

Are the libv4*.so file errors a problem?

I'll hack some more and get back to you.
Ed

tb01
White ninja
White ninja
Posts: 12
Joined: 23 Aug 2012, 16:42
Distribution: P-MATE (all) x32/x64, debian
Location: -happydale-

Re: Firefox always up to date (autd) - i686 & x86_64

Post#13 by tb01 » 27 Oct 2015, 21:45

Ed_P wrote:...I'll hack some more and get back to you.
Struggling (somewhat) user here... wondering if this ever achieved a working resolution. I LOVE the idea of it, as keeping FF updated has long been a thorn of running live and modularized distros. I actually stoped using Porteus nearly two years ago because I couldn't find clear instructions, every attempt buggered my installation, and it was entirely user-hostile (for me) to keep wasting time digging through info I didn't (then) understand and was likely outdated and deprecated by the time I was making my efforts.

I did have a glance at this script suggested updates/additions. Having spent (some) time writing scripts in trying to learn, I must admit that what I understood looked really slick! So I copied, pasted and ran -- got the same 'Check your connection' error. So I dug deeper.

I cut and pasted the lines unclear to me, one at a time, into a first terminal window, while using a second to check man-pages of commands which I wasn't familiar. Plugging and playing, at length, I finally got this script to run!

It seems that Mozilla has changed their directory structure since this script was originated, and I've utilized the https addressing as well. In adding my edits to make it work, I've double-hash 'commented-out' the existing lines of code which I edited, entering the working line below, and set them off with blank lines for clarity.

Please post any further tweaks and feedback! This is exactly how I (personally) learn best, and I am so very grateful for the effort expended thus far. Thank you for deriving even a basic concept for how to address this previously insurmountable task.

--Tom

firefox-autd2.sh

Code: Select all

    #!/bin/bash
    # /home/guest/firefox-autd2.sh  ; changed filename to not overwrite original author's work
    # http://forum.porteus.org/viewtopic.php?f=76&t=4473
    # Firefox always up to date
    # Script by tome
    # Run as root
    # 1. User preferences 2. Paths 3. Download/extract 4. Launcher+icon module

    if [ `whoami` != "root" ]; then
      ktsuss "$0 $1"
      exit
    fi

    BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
    VERSION=$(cat /etc/porteus-version)

    ##FOLDER=porteus${VERSION:9:3}
    FOLDER=porteus

    # Directory where you want to store data on your booting device
    mirror=$FOLDER/data-mirror

    # Choose your architecture i686 or x86_64 (eventually `uname -m`, if you have new hardware)
    myarch=`uname -m`

    # Localized version (language) choose one from: ach af an ar as ast az be bg bn-BD bn-IN br bs ca cs cy da de dsb el en-GB en-US en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy-NL ga-IE gd gl gu-IN he hi-IN hr hsb hu hy-AM id is it ja kk km kn ko lij lt lv mai mk ml mr ms nb-NO nl nn-NO or pa-IN pl pt-BR pt-PT rm ro ru si sk sl son sq sr sv-SE ta te th tr uk vi xh xpi zh-CN zh-TW
    lang=en-US

    # Who can update, choose root, guest or your user name, it doesn't matter for ntfs/fat filesystems
    me=guest

    # Where you want to place created firefox-links.xzm module
    where=$BOOTDEV/$FOLDER/optional

    # End of settings you should set

    echo
    echo Settings:
    echo "  mirror "$mirror
    echo "  myarch "$myarch
    echo "  lang   "$lang
    echo "  me     "$me
    echo "  where  "$where
    echo



    # 2. Get booting device
    bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
    realpath=${bdev}/$mirror

    mkdir -p $realpath/apps

    # 3. Download/extract
    cd /tmp
    wget -c http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/
    if [ ! -e "/tmp/index.html" ]; then echo ""
      echo "[31mCheck your internet connection! Exiting.[0m"
      exit 0
      fi

    ##latest_version=`grep tar.bz2 index.html | tail -n1 | cut -d- -f2- | cut -d '"' -f1`
    latest_version=`grep tar.bz2 index.html | tail -n1 | cut -d- -f2- | cut -d '"' -f1 | cut -d '/' -f3`

    echo "Downloading latest version of Mozilla Firefox"

    ##wget -c http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-$myarch/$lang/firefox-$latest_version
    wget -c https://releases.mozilla.org/pub/firefox/releases/latest/linux-$myarch/$lang/$latest_version

    ##if [ -e "/tmp/firefox-$latest_version" ]; then echo "Extracting firefox-$latest_version"
    if [ -e "/tmp/$latest_version" ]; then echo "Extracting $latest_version"

      ##tar xjvf firefox-$latest_version -C $realpath/apps
      tar xjvf $latest_version -C $realpath/apps

      else
      clear
      echo ""
      echo "[36mCheck your internet connection! Exiting.[0m"
      exit 0
    fi

    # 4. Preparing module
    rm -rf /tmp/firefox-autd
    if [ -e /mnt/live/memory/images/firefox-links.xzm ]; then deactivate /mnt/live/memory/images/firefox-links.xzm
      echo Deactivating old firefox-links.xzm module
      fi
    umount $where/firefox-links.xzm
    rm -rf $where/firefox-links.xzm
    mkdir -p /tmp/firefox-autd/usr/bin
    mkdir -p /tmp/firefox-autd/usr/share/applications
    mkdir -p /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps
    cp $realpath/apps/firefox/browser/chrome/icons/default/default48.png /tmp/firefox-autd/usr/share/icons/hicolor/48x48/apps/firefox.png
     
    echo '#!/bin/sh' >> /tmp/firefox-autd/usr/bin/firefox-autd
    echo 'bdev=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`' >> /tmp/firefox-autd/usr/bin/firefox-autd
    echo 'exec ${bdev}/'$mirror'/apps/firefox/firefox "$@"' >> /tmp/firefox-autd/usr/bin/firefox-autd

    chmod 755 /tmp/firefox-autd/usr/bin/firefox-autd
    chown $me:$me $realpath/apps/firefox


    echo "Generating Desktop Files..."

    #Creating mozilla-firefox-autd-p.desktop
    echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'Exec=firefox-autd -no-remote -p %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'Name=Firefox Profile Manager' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop
    echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd-p.desktop

    #Creating mozilla-firefox-autd.desktop
    echo '[Desktop Entry]' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'Exec=firefox-autd %u' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'Icon=firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'Type=Application' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'Categories=Network;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'Name=Firefox' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop
    echo 'X-KDE-StartupNotify=true' >> /tmp/firefox-autd/usr/share/applications/mozilla-firefox-autd.desktop

    echo "Building the module."
    mksquashfs /tmp/firefox-autd $where/firefox-links.xzm -b 256K

    ##clear
    echo -e "\n\n\n"
    echo "DONE"
    echo "Activating of $where/firefox-links.xzm"
    echo ""
    activate $where/firefox-links.xzm

    exit 0

Consider being the change you wish to see in our world...

User avatar
Ed_P
Contributor
Contributor
Posts: 3314
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Firefox always up to date (autd) - i686 & x86_64

Post#14 by Ed_P » 28 Oct 2015, 03:44

tome wrote:I'll hack some more and get back to you.
:oops: 7 months later. :sorry:
tb01 wrote:Please post any further tweaks and feedback! This is exactly how I (personally) learn best, and I am so very grateful for the effort expended thus far. Thank you for deriving even a basic concept for how to address this previously insurmountable task.
Hello Tom. Here's my results of using your updated script. The where value is off. I use /mnt/sda5/porteus3.0/Modules and /mnt/sda5/porteus3.0/Optional for my modules. But that's not the show stopper.

Code: Select all

guest@porteus:~$ chmod +x firefox-*.sh
guest@porteus:~$ firefox-autd2.sh

Settings:
  mirror porteus/data-mirror
  myarch x86_64
  lang   en-US
  me     guest
  where  /mnt/sda5/porteus/optional

--2015-10-27 23:28:36--  http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
Resolving releases.mozilla.org (releases.mozilla.org)... 54.192.54.241
Connecting to releases.mozilla.org (releases.mozilla.org)|54.192.54.241|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://releases.mozilla.org/pub/firefox/releases/latest/linux-x86_64/en-US/ [following]
--2015-10-27 23:28:37--  http://releases.mozilla.org/pub/firefox/releases/latest/linux-x86_64/en-US/
Reusing existing connection to releases.mozilla.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 946 [text/html]
Saving to: ‘index.html’

100%[======================================>] 946         --.-K/s   in 0s      

2015-10-27 23:28:37 (33.2 MB/s) - ‘index.html’ saved [946/946]

Downloading latest version of Mozilla Firefox
--2015-10-27 23:28:37--  https://releases.mozilla.org/pub/firefox/releases/latest/linux-x86_64/en-US/firefox-41.0.2.tar.bz2
Resolving releases.mozilla.org (releases.mozilla.org)... 54.192.54.241
Connecting to releases.mozilla.org (releases.mozilla.org)|54.192.54.241|:443... connected.
ERROR: cannot verify releases.mozilla.org's certificate, issued by ‘/C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA’:
  Unable to locally verify the issuer's authority.
To connect to releases.mozilla.org insecurely, use `--no-check-certificate'.


Check your internet connection! Exiting.

Code: Select all

guest@porteus:~$ bootmode.sh
Boot device: /mnt/sda5
OS: Porteus-v3.0.1
ARCH: x86_64
Kernel: Linux porteus 3.14.15-porteus
Folder: /porteus3.0/
quiet from=/ISOs/Porteus-RazorQT-v3.0.1-x86_64-nu.iso changes=EXIT:/porteus3.0/changes/porteussave.dat extramod=/porteus3.0/Modules volume=40 reboot=cold ramsize=80%

Ed

tome
Contributor
Contributor
Posts: 571
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Poland
Contact:

Re: Firefox always up to date (autd) - i686 & x86_64

Post#15 by tome » 28 Oct 2015, 04:59

replace "wget" with "wget --no-check-certificate'"

Post Reply