summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 99136b3846d9ae520d52d5c011c87026031f2a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Maintainer: Santiago Lo Coco <mail at slococo dot com dot ar>

pkgname=firefox-sync
pkgver=20220831
pkgrel=1
pkgdesc="Speed up Firefox using tmpfs."
arch=('any')
url='http://wiki.archlinux.org/index.php/Speed-up_Firefox_using_tmpfs'
license=('GPL')
source=("${pkgname}".sh "${pkgname}.service" "${pkgname}-cron.service" "${pkgname}-cron.timer")
sha256sums=('f7d50c514437c17df99cdfe53c26e939163d9a6cfe055c51f8c2f20f57c46b07'
            'f3ca08a806a8938244a7dbe2f8db690963d6a381643884216b1a960c396ec6b9'
            '7769dced29810910ba91fa41461513d05085b5bbf1a9d78740e5300072190333'
            '51eabc82394e344756b86105a7b738d5a026bca490c17d87ef7d72339995db7c')

prepare() {
    _linkname="$(grep "LINK=" "/usr/bin/${pkgname}" 2> /dev/null | head -n1 | cut -d= -f2)"
    if [[ -f "/usr/bin/${pkgname}" && "$_linkname" != "" ]]; then
        sed -i "s|^LINK=.*|LINK=$_linkname|" "${pkgname}".sh
    else
        if [[ ! -d "$HOME/.mozilla/firefox" ]]; then
            echo "Firefox profile not found, you need to add your profile to the LINK variable in /usr/bin/firefox-sync" 1>&2 
            return
        fi
        _linkname="$(find -H "$HOME/.mozilla/firefox" -maxdepth 1 -mindepth 1 -type d -name \*.default -printf "%f\n")"
        sed -i "s|^LINK=.*|LINK=$_linkname|" "${pkgname}".sh
    fi
}

package() {
    depends=('rsync' 'firefox')
    install -Dm 755 "${pkgname}".sh "${pkgdir}/usr/bin/${pkgname}"
    install -Dm 644 {"${srcdir}","${pkgdir}"/usr/lib/systemd/user}/"${pkgname}".service
    install -Dm 644 {"${srcdir}","${pkgdir}"/usr/lib/systemd/user}/"${pkgname}-cron".service
    install -Dm 644 {"${srcdir}","${pkgdir}"/usr/lib/systemd/user}/"${pkgname}-cron".timer
}