diff options
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | PKGBUILD | 21 | ||||
-rwxr-xr-x | iceweasel-sync | 61 |
3 files changed, 97 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..557bc1259e37 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = iceweasel-sync + pkgdesc = Speed up Iceweasel using tmpfs + pkgver = 20130304 + pkgrel = 1 + url = http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs + arch = i686 + arch = x86_64 + license = GPL + depends = rsync + depends = iceweasel + source = iceweasel-sync + md5sums = 4e7949eaed8f284233d2ecdecc28534c + +pkgname = iceweasel-sync + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..894f49b23f14 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,21 @@ +# Contributor: Ramana Kumar <firstnameatxrchzdotnet> +pkgname=iceweasel-sync +pkgver=20130304 +pkgrel=1 +pkgdesc="Speed up Iceweasel using tmpfs" +arch=('i686' 'x86_64') +url="http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs" +license=('GPL') +depends=('rsync' 'iceweasel') +makedepends=() +source=($pkgname) +md5sums=('4e7949eaed8f284233d2ecdecc28534c') +build() { + sed -i "3 c\ +LINK=$(ls -d1 ~/.mozilla/firefox/*.default | head -n 1 | xargs basename) +" $pkgname + install -D $pkgname $pkgdir/usr/bin/$pkgname + cd $pkgdir/usr/bin + cp -p $pkgname icesync + echo "iceweasel-sync && iceweasel && iceweasel-sync" > icesync +} diff --git a/iceweasel-sync b/iceweasel-sync new file mode 100755 index 000000000000..f0148c44c10e --- /dev/null +++ b/iceweasel-sync @@ -0,0 +1,61 @@ +#!/bin/bash +STATIC=main +LINK= +VOLATILE=/dev/shm/$USER/firefox + +usage() +{ + echo "Usage: firefox-sync [-dh] [-p profile-basename]" +} + +longhelp() +{ + usage + cat <<EOF + +This program syncs your firefox profile to a ramdisk (/dev/shm) and back. + +-h prints this help message +-d prints the default profile directory +-p [dir] set the profile basename +EOF +exit 0 +} + +while getopts dhp: options +do +case $options in + d) echo "default profile directory is ~/.mozilla/firefox/$LINK" + exit 0;; + h) longhelp;; + p) LINK="$OPTARG";; + ?) usage + exit 0;; + esac +done + +if [ -z "$LINK" ]; then + echo "Profile directory not set. Try the -p option" > /dev/stderr + exit 1 +fi + +[[ -r $VOLATILE ]] || install -dm700 $VOLATILE + +cd ~/.mozilla/firefox + +if [ ! -e "$LINK" ]; then + echo "~/.mozilla/firefox/$LINK does not exist" > /dev/stderr + exit 1 +fi + +if [[ `readlink $LINK` != $VOLATILE ]]; then + mv $LINK $STATIC + ln -s $VOLATILE $LINK +fi + +if [[ -e $LINK/.unpacked ]]; then + rsync -av --delete --exclude .unpacked ./$LINK/ ./$STATIC/ +else + rsync -av ./$STATIC/ ./$LINK/ + touch $LINK/.unpacked +fi |