-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for rm-sync in xochitl package (#718)
* Add support for rm-sync in xochitl package Recent xochitl versions renamed the sync service and binary to rm-sync. This updates the xochitl package to support both. * Use file checks to determine rm-sync vs sync * Update package/xochitl/package Co-authored-by: Nathaniel van Diepen <[email protected]> * Update to use new disable-unit method * Update package * Update package version * Fix unit-exists --------- Co-authored-by: Nathaniel van Diepen <[email protected]>
- Loading branch information
Showing
4 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
pkgnames=(xochitl) | ||
pkgdesc="Read documents and take notes" | ||
url=https://remarkable.com | ||
pkgver=0.0.0-17 | ||
pkgver=0.0.0-18 | ||
timestamp=2022-11-07T20:19:57Z | ||
section="readers" | ||
maintainer="Mattéo Delabre <[email protected]>" | ||
|
@@ -24,7 +24,7 @@ source=( | |
toltec-after-launcher.conf | ||
toltec-wrapper.conf | ||
env-readme | ||
manual-sync.service | ||
manual-sync@.service | ||
) | ||
sha256sums=( | ||
SKIP | ||
|
@@ -59,19 +59,30 @@ package() { | |
install -D -m 644 -t "$pkgdir"/etc/systemd/system/remarkable-reboot.service.d \ | ||
"$srcdir"/toltec-after-launcher.conf | ||
install -D -m 644 -t "$pkgdir"/etc/systemd/system \ | ||
"$srcdir"/manual-sync.service | ||
"$srcdir"/manual-sync@.service | ||
} | ||
|
||
configure() { | ||
systemctl daemon-reload | ||
|
||
# sync.service interferes with launchers | ||
# we use manual-sync.service instead | ||
if [[ "x$(systemctl is-enabled sync.service)" != "xmasked" ]]; then | ||
# sync.service and rm-sync.service interfere with launchers | ||
# we use manual-sync@.service instead | ||
if [ -f /usr/bin/sync ] && ! is-masked sync.service; then | ||
systemctl mask sync.service | ||
fi | ||
if ! is-active manual-sync.service; then | ||
systemctl enable --now manual-sync.service | ||
|
||
if [ -f /usr/bin/rm-sync ] && ! is-masked rm-sync.service; then | ||
systemctl mask rm-sync.service | ||
fi | ||
|
||
# manual-sync.service has been changed to [email protected] | ||
# Make sure to disable and stop the old version | ||
disable-unit manual-sync.service | ||
|
||
if [ -f /usr/bin/rm-sync ] && ! is-active [email protected]; then | ||
systemctl enable --now [email protected] | ||
elif [ -f /usr/bin/sync ] && ! is-active [email protected]; then | ||
systemctl enable --now [email protected] | ||
fi | ||
|
||
if is-enabled xochitl.service && ! is-enabled launcher.service; then | ||
|
@@ -83,14 +94,18 @@ configure() { | |
} | ||
|
||
preremove() { | ||
disable-unit manual-sync.service | ||
disable-unit [email protected] | ||
disable-unit [email protected] | ||
} | ||
|
||
postremove() { | ||
systemctl daemon-reload | ||
|
||
if [[ "x$(systemctl is-enabled sync.service)" == "xmasked" ]]; then | ||
systemctl unmask sync.service 2> /dev/null | ||
if [ -f /usr/bin/sync ] && is-masked sync.service; then | ||
systemctl unmask sync.service | ||
fi | ||
if [ -f /usr/bin/rm-sync ] && is-masked rm-sync.service; then | ||
systemctl unmask rm-sync.service | ||
fi | ||
|
||
if is-enabled xochitl.service && is-enabled launcher.service; then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,22 @@ for file in /opt/etc/xochitl.env.d/*.env; do | |
source "$file" | ||
fi | ||
done | ||
|
||
# If for some reason, sync.service is no longer masked, re-mask it | ||
# The package install should have handled this, but something may | ||
# have changed it. | ||
if [[ "x$(systemctl is-enabled sync.service)" != "xmasked" ]]; then | ||
systemctl mask sync.service | ||
fi | ||
if ! systemctl is-active --quiet manual-sync.service; then | ||
systemctl enable --now manual-sync.service | ||
|
||
if [[ "x$(systemctl is-enabled rm-sync.service)" != "xmasked" ]]; then | ||
systemctl mask rm-sync.service | ||
fi | ||
|
||
if [ -f /usr/bin/rm-sync ] && ! is-active [email protected]; then | ||
systemctl enable --now [email protected] | ||
elif [ -f /usr/bin/sync ] && ! is-active [email protected]; then | ||
systemctl enable --now [email protected] | ||
fi | ||
|
||
exec -a /usr/bin/xochitl /usr/bin/xochitl "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters