summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorOmar Vega Ramos <ovruni@gnu.org.pe>2017-01-02 03:36:47 -0500
committerOmar Vega Ramos <ovruni@gnu.org.pe>2017-01-02 03:36:47 -0500
commitca026b287990ffbf3a35e09ae447bea33243417a (patch)
treef72e9b93a035496d51e9f9bd124f1a7fe0d13bd0 /pcr
parentffee505fbe7ae77dc01e5c7601ec353ff8932f4e (diff)
downloadabslibre-ca026b287990ffbf3a35e09ae447bea33243417a.tar.gz
abslibre-ca026b287990ffbf3a35e09ae447bea33243417a.tar.bz2
abslibre-ca026b287990ffbf3a35e09ae447bea33243417a.zip
profile-sync-daemon: add new package to [pcr]
Diffstat (limited to 'pcr')
-rw-r--r--pcr/profile-sync-daemon/PKGBUILD28
-rw-r--r--pcr/profile-sync-daemon/psd.install150
2 files changed, 178 insertions, 0 deletions
diff --git a/pcr/profile-sync-daemon/PKGBUILD b/pcr/profile-sync-daemon/PKGBUILD
new file mode 100644
index 000000000..c1583c241
--- /dev/null
+++ b/pcr/profile-sync-daemon/PKGBUILD
@@ -0,0 +1,28 @@
+# Maintainer (Arch): graysky <graysky AT archlinux DOT us>
+# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
+
+pkgname='profile-sync-daemon'
+pkgver=6.31
+pkgrel=1.parabola1
+pkgdesc='Syncs browser profiles to tmpfs reducing SSD/HDD calls and speeding-up browsers.'
+arch=('any')
+url='https://github.com/graysky2/profile-sync-daemon'
+license=('MIT')
+depends=('procps-ng' 'rsync' 'systemd' 'findutils')
+conflicts=('goanysync' 'go-anysync-git' 'iceweasel-sync'
+'tmpfs-store' 'tmpfs-sync' 'user-profile-sync-daemon')
+source=("http://repo-ck.com/source/$pkgname/$pkgname-$pkgver.tar.xz")
+install=psd.install
+sha256sums=('3aa6f83ad5cb47653d486124233d6af7cf79e58bd1e57a4bcd34029012be9a13')
+
+build() {
+ cd "$pkgname-$pkgver"
+ make
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ install -Dm644 MIT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ rm -f "$pkgdir/usr/share/man/man1/psd-overlay-helper.1.gz"
+}
diff --git a/pcr/profile-sync-daemon/psd.install b/pcr/profile-sync-daemon/psd.install
new file mode 100644
index 000000000..4b8639d70
--- /dev/null
+++ b/pcr/profile-sync-daemon/psd.install
@@ -0,0 +1,150 @@
+## arg 1: the new package version
+## arg 2: the old package version
+
+users=$(loginctl --no-legend list-users | awk '{ print $2 }' | sed ':a;N;$!ba;s/\n/ /g')
+
+pre_upgrade() {
+ # version 6.00 is a major rebuild
+ # yes, I realize that pacman should not stop services but in this case it
+ # is required or else browser profiles (user data) can get renamed and confuse
+ # people if it does not happen
+ if [ $(vercmp $2 6.00) -lt 0 ]; then
+ echo 'ATTENTION: MAJOR CHANGES TO PSD WITH VERSION 6.00+'
+ echo '-> 1. A global /etc/psd.conf is no longer used. $HOME/.config/psd/psd.conf will be'
+ echo '-> created when psd is invoked the first time.'
+ echo '-> 2. A system service is no longer used. A user service is provided and can be'
+ echo '-> used like this: systemctl --user start psd.service'
+ echo '-> 3. Users wanting to use overlayfs mode MUST have sudo access with nopasswd to'
+ echo '-> /usr/bin/psd-overlay-helper. See the man page for an example configured with visudo.'
+
+ # stop system service now since it will be removed upon updating
+ systemctl is-active psd.service &>/dev/null
+ if [ $? -eq 0 ]; then
+ systemctl stop psd.service &>/dev/null
+ fi
+ fi
+
+ # version 6.01 redefines the location of tmpfs for the software so it is
+ # required that pacman stop the user service here if running
+ if [ $(vercmp $2 6.01) -lt 0 ]; then
+ for i in "$users"; do
+ running="$(su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')"
+ if [[ "$running" = "active" ]]; then
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
+ echo '-> Internal changes to psd require it to be stopped now before updating.'
+ echo '-> Recommend that you diff /usr/share/doc/psd/psd.conf against ~/.config/psd/psd.conf'
+ fi
+ done
+ fi
+
+ if [ $(vercmp $2 6.03) -lt 0 ]; then
+ for i in "$users"; do
+ HOMEDIR="$(getent passwd $i | cut -d: -f6)"
+ if [[ -d "$HOMEDIR"/.psd ]]; then
+ echo '-> The use of $HOME/.psd is deprecated.'
+ echo '-> Psd will move it for you upon next invocation to $XDG_CONFIG_HOME/psd'
+ fi
+ done
+
+ # version 6.05 impliments changes to both the service and the way overlayfs is mounted/umount
+ # so it is required that pacman stop the user service here if running
+ if [ $(vercmp $2 6.05) -lt 0 ]; then
+ for i in "$users"; do
+ running="$(su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')"
+ if [[ "$running" = "active" ]]; then
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
+ echo '-> Internal changes to psd require it to be stopped now before updating.'
+ echo '-> Users of overlayfs: you must run the following before starting the service: psd p'
+ fi
+ done
+ fi
+ fi
+
+ # version 6.07 has minor changes to config file
+ if [ $(vercmp $2 6.07) -lt 0 ]; then
+ echo '-> Recommend that you diff /usr/share/psd/psd.conf against ~/.config/psd/psd.conf'
+ fi
+
+ # version 6.10 relocates pid file
+ if [ $(vercmp $2 6.10) -lt 0 ]; then
+ for i in "$users"; do
+ running="$(su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')"
+ if [[ "$running" = "active" ]]; then
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
+ echo '-> Internal changes to psd require it to be stopped now before updating.'
+ fi
+ done
+ fi
+
+ # version 6.14 changes the way overlayfs works
+ if [ $(vercmp $2 6.14) -lt 0 ]; then
+ for i in "$users"; do
+ running="$(su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')"
+ if [[ "$running" = "active" ]]; then
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
+ echo '-> Internal changes to psd require it to be stopped now before updating.'
+ fi
+ done
+ fi
+
+ # version 6.16 has minor changes to config file
+ if [ $(vercmp $2 6.16) -lt 0 ]; then
+ echo '-> Recommend that you diff /usr/share/psd/psd.conf against ~/.config/psd/psd.conf'
+ fi
+
+ # version 6.22 has minor changes to config file
+ if [ $(vercmp $2 6.22) -lt 0 ]; then
+ echo '-> Recommend that you diff /usr/share/psd/psd.conf against ~/.config/psd/psd.conf'
+ fi
+
+ # version 6.30 has minor changes to config file
+ if [ $(vercmp $2 6.30) -lt 0 ]; then
+ echo '-> Recommend that you diff /usr/share/psd/psd.conf against ~/.config/psd/psd.conf'
+ fi
+}
+
+post_upgrade() {
+ # version 6.01 redefines the location of tmpfs for the software so it is
+ # required that pacman stop the user service here if running
+ if [ $(vercmp $2 6.01) -lt 0 ]; then
+ _daemon_refresh
+ fi
+
+ # version 6.05 impliments changes to both the service and the way overlayfs is mounted/umount
+ # so it is required that pacman stop the user service here if running
+ if [ $(vercmp $2 6.05) -lt 0 ]; then
+ _daemon_refresh
+ fi
+
+ # version 6.10 relocates pid file
+ if [ $(vercmp $2 6.10) -lt 0 ]; then
+ _daemon_refresh
+ fi
+
+ # version 6.11 modified services
+ if [ $(vercmp $2 6.11) -lt 0 ]; then
+ _daemon_refresh
+ fi
+
+ # version 6.14 modified services
+ if [ $(vercmp $2 6.14) -lt 0 ]; then
+ _daemon_refresh
+ fi
+}
+
+pre_remove() {
+ for i in "$users"; do
+ running="$(su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user is-active psd')"
+ if [[ "$running" = "active" ]]; then
+ echo "--> In order to preserve your profiles, pacman will now stop your psd service."
+ echo "--> Any running and managed browsers will be exited."
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user stop psd.service'
+ fi
+ done
+}
+
+_daemon_refresh() {
+ for i in "$users"; do
+ su $i -s /bin/sh -c 'XDG_RUNTIME_DIR=/run/user/$UID systemctl --user daemon-reload'
+ done
+}