summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorQue Quotion2018-01-18 02:35:09 +0900
committerQue Quotion2018-01-18 02:35:09 +0900
commit94bbc96015df83a92071357a7b5d907c4f8ea66f (patch)
tree269e09e8c89b216022b2a80930d049f044d90f26
parentc7af434397f8cd6b03266024b3bac0526ec26191 (diff)
downloadaur-94bbc96015df83a92071357a7b5d907c4f8ea66f.tar.gz
Much better method: use a systemd service to sync at login and logout
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD19
-rwxr-xr-xfirefox-sync6
-rw-r--r--firefox-sync.desktop10
-rw-r--r--firefox-sync.service11
5 files changed, 27 insertions, 27 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 337c66b5e35d..6b6805fd2c2b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = firefox-sync
pkgdesc = Speed up Firefox using tmpfs
- pkgver = 20180112
+ pkgver = 20180118
pkgrel = 1
url = http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs
arch = i686
@@ -10,9 +10,9 @@ pkgbase = firefox-sync
depends = rsync
depends = firefox
source = firefox-sync
- source = firefox-sync.desktop
- md5sums = 4e7949eaed8f284233d2ecdecc28534c
- md5sums = 710f182537f640ce8ca77474e7943113
+ source = firefox-sync.service
+ md5sums = 069e493c9025889787f0181c75f8c727
+ md5sums = bc73b9d80232fea8a8bef24bfb125fe6
pkgname = firefox-sync
diff --git a/PKGBUILD b/PKGBUILD
index 15af9da0b02c..8f071efe0fbc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Que Quotion <quequotion@bugmenot.com>
# Contributor: Ramana Kumar <firstname@member.fsf.org>
pkgname=firefox-sync
-pkgver=20180112
+pkgver=20180118
pkgrel=1
pkgdesc="Speed up Firefox using tmpfs"
arch=('i686' 'x86_64')
@@ -9,20 +9,13 @@ url="http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs"
license=('GPL')
depends=('rsync' 'firefox')
makedepends=('bash')
-source=(${pkgname} 'firefox-sync.desktop')
-md5sums=('4e7949eaed8f284233d2ecdecc28534c'
- '710f182537f640ce8ca77474e7943113')
+source=(${pkgname} "${pkgname}.service")
+md5sums=('069e493c9025889787f0181c75f8c727'
+ 'bc73b9d80232fea8a8bef24bfb125fe6')
package() {
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
- bash -c '{
-echo "#!/bin/bash"
-echo "firefox-sync && firefox \"\${@}\" && firefox-sync"
-} > syncfox'
- find ${pkgdir}/usr/bin -type f -exec chmod 755 {} \;
- find ${pkgdir}/usr/bin -type d -exec chmod 755 {} \;
- install -Dm 644 {"${srcdir}","${pkgdir}"/etc/xdg/autostart}/firefox-sync.desktop
+ install -Dm 755 ${pkgname} ${pkgdir}/usr/bin/${pkgname}
+ install -Dm 644 {"${srcdir}","${pkgdir}"/usr/lib/systemd/user}/"${pkgname}".service
}
diff --git a/firefox-sync b/firefox-sync
index f0148c44c10e..3073321be85b 100755
--- a/firefox-sync
+++ b/firefox-sync
@@ -18,6 +18,7 @@ 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
+-r restores on-disk profile (use only before uninstalling firefox-sync)
EOF
exit 0
}
@@ -29,6 +30,11 @@ case $options in
exit 0;;
h) longhelp;;
p) LINK="$OPTARG";;
+ r) mv "$VOLATILE" "~/.mozilla/firefox/$LINK-copy"
+ mv ~/.mozilla/firefox/"$LINK"{,-trash}
+ mv ~/.mozilla/firefox/"$STATIC"{,-trash}
+ mv ~/.mozilla/firefox/"$LINK"{-copy,}
+ rm -rf ~/.mozilla/firefox/{"$LINK","$STATIC"}-trash;;
?) usage
exit 0;;
esac
diff --git a/firefox-sync.desktop b/firefox-sync.desktop
deleted file mode 100644
index baaa10b5e90b..000000000000
--- a/firefox-sync.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Name=Firefox-sync
-GenericName=Firefox-sync
-Comment=Sync Firefox profile to shared memory.
-Exec=firefox-sync
-Icon=firefox
-Terminal=false
-Type=Application
-Categories=Network;
diff --git a/firefox-sync.service b/firefox-sync.service
new file mode 100644
index 000000000000..c9e88512a118
--- /dev/null
+++ b/firefox-sync.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Synchronize tmpfs and on-disk Firefox profiles
+
+[Service]
+Type=idle
+RemainAfterExit=true
+ExecStart=/usr/bin/firefox-sync
+ExecStop=/usr/bin/firefox-sync
+
+[Install]
+WantedBy=default.target